vi3k6i5 / flashtext

Extract Keywords from sentence or Replace keywords in sentences.
MIT License
5.58k stars 598 forks source link

Wrong extraction when multi-matchs occur #108

Closed fran6w closed 4 years ago

fran6w commented 4 years ago

Hi, Thank you for your great library. I think I found an issue when multi-matchs occur. See example below:

from flashtext import KeywordProcessor kw = KeywordProcessor() kw.add_keyword('ABC', 'X') kw.add_keyword('ABC DEF', 'Y') kw.add_keyword('ABC GHI', 'Y')

kw.extract_keywords('ABC DEF') => ['Y'] that is OK

kw.extract_keywords('ABC DEF and ABC GHI') => ['X', 'Y'] that is not OK

Thank you

Francis