flashtext
flashtext copied to clipboard
Incorrect Output in a specific scenario
Scenario -
Use Dictionary for multiple keywords and one keyword is present in more than one class/category, then, output is incorrect and shows only one class/category.
Below mentioned is example code for detailed explanation.
#Import library
from flashtext import KeywordProcessor
#Define Dictionary
dict_keywords={}
#'Russia' is present in both classes/categories - Europe and Asia
dict_keywords["Europe"]=['France','Germany','Russia']
dict_keywords["Asia"]=['India','Russia','China']
keyword_processor = KeywordProcessor()
keyword_processor.add_keywords_from_dict(dict_keywords)
#Content has 'Russia' keyword
content="Russia is a federal semi-presidential republic"
flashtext_out=keyword_processor.extract_keywords(content)
print(flashtext_out)
#Output - ['Asia']
#Output should consist of both classes/categories - Asia and Europe
@biswajitpatra - If the commit which you have done in your forked instance working fine, could you please create a pull request to this main repo so that this could be the part of release package which we can use
@vi3k6i5 - Could you please confirm if this can be merged into this primary repo?