Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete not working as expected #28

Open
Shivanandroy opened this issue Aug 6, 2021 · 2 comments
Open

Autocomplete not working as expected #28

Shivanandroy opened this issue Aug 6, 2021 · 2 comments

Comments

@Shivanandroy
Copy link

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?

@seperman
Copy link
Owner

@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.

@lazzarello
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants