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

Error when replacing unique words #2

Closed
MarcDelp opened this issue Mar 6, 2018 · 4 comments
Closed

Error when replacing unique words #2

MarcDelp opened this issue Mar 6, 2018 · 4 comments

Comments

@MarcDelp
Copy link

MarcDelp commented Mar 6, 2018

Hi there,

I have a little bug when using your great implementation of FlashText to replace keywords.
It only appears in one case:
Let's say that I have a file containing my words to find and the replacement words.

Appl1,app_1
Appl2,app_2
Appl3,app_3
Appl4,app_4
Appl5,app_5

First word is the word to find in my text, second the replacement word.

I parse my file and feed my FlashText object with it and then I start using it in my application.
My app will take an user input and use FlashText to replace the words I want.

let newInput = AppNamesKeywordProcessor.replaceKeywords(input);

The bug occurs when the user send a single word as sentence, such as

app

In this case, the replace method give me back an empty string. Same with any of "a", "ap", "appl".

Otherwise, if the user sends me a real sentence such as

I am using an app

or

I am talking about Appl1

everything works as expected.

@drenther
Copy link
Owner

I tried but couldn't recreate the bug here - https://runkit.com/drenther/flashtext-bug-recreate

Can you provide an isolated instance recreating this bug? It will help me debug it.

Thank you for opening the issue.

@Themandunord
Copy link

Hi @drenther, I work with @MarcDelp.
I can provide you the runkit example about this bug : https://runkit.com/themandunord/flash-text-js-bug

You can see that the bug happens for the two last tests.

Thanks.

@drenther
Copy link
Owner

Update to the new release 1.0.5
It should fix the bug.
Let me know if it does, I will close the issue then.

Thanks for the patience.

@MarcDelp
Copy link
Author

Yes it seems that everything is working as intended now.
Thank you !

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