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

Casing issue with synonyms #35

Open
iaudouard opened this issue Jan 19, 2022 · 2 comments
Open

Casing issue with synonyms #35

iaudouard opened this issue Jan 19, 2022 · 2 comments

Comments

@iaudouard
Copy link

iaudouard commented Jan 19, 2022

Hi there,
I have encountered a bug that occurs when the synonym key includes uppercase characters.
I use the autocomplete for shows' titles, which have uppercase characters. The problem is that if I run the program below, nothing is returned as an autocomplete suggestion

def autocomplete(query, x):
    valid_chars = string.ascii_letters
    words = {
        'Attack on Titan': {}
    }
    synonyms = {

        "Attack on Titan": ["Shingeki no Kyojin", "AOT"],

    }
    autocomplete = AutoComplete(
        words=words, synonyms=synonyms, valid_chars_for_string=valid_chars)
    return autocomplete.search(word=query, size=x)


print(autocomplete('Shin', 5))

However if you change the key of both dictionaries to "attack on titan", the program works as expected.

@Maurice-D-Elbee
Copy link

Same issue on my side.

@seperman
Copy link
Owner

seperman commented Feb 7, 2022

This is because by default fast autocomplete normalizes words. As a part of normalization, it lowercases everything. But seems like maybe it doesn't by default do it for the synonyms. I will make it normalize the synonyms in the next release.

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