fast-autocomplete icon indicating copy to clipboard operation
fast-autocomplete copied to clipboard

Autocomplete not working as expected

Open Shivanandroy opened this issue 4 years ago • 2 comments

Describe the bug Hi, Can you help me understand this behavior?

To Reproduce

from fast_autocomplete import AutoComplete
words = {'xcode': {}, 'xcode version': {}, 'xcode previous version': {}}
autocomplete = AutoComplete(words=words)

and now when I search, I get this result:

autocomplete.search(word='xcode ver', max_cost=1, size=10)

# output: 
[['xcode'], ['xcode version']]

Isn't "xcode version" should be first suggestion?

Expected behavior I was expecting "xcode version" to be the first suggestion.

# output: 
[['xcode version']]

And if that is an expected behavior, how do I get the desired result? Any idea?

Shivanandroy avatar Aug 06 '21 05:08 Shivanandroy

@Shivanandroy Sorry I just noticed your question. In the current implementation, when it reaches a word in the graph, the word has a higher score than a word it has not reached yet. Maybe I should modify it so when it gets close to a word in the graph, it puts it up high in the results and removes the previous word from the results.

seperman avatar Oct 12 '21 18:10 seperman

Came across this convention while using this library for a corporate coding quiz interview. I'll take a swing at changing the default behavior.

lazzarello avatar May 03 '22 20:05 lazzarello