keyword_processor.add_keyword('New Delhi', 'NCR region')
new_sentence = keyword_processor.replace_keywords('I love Big Apple and new delhi.')
new_sentence
Run and output
'I love New York and NCR region.'
想了解更多,请查看FlastText官方文档
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
# Simple Ratio
print(fuzz.ratio("this is a test", "this is a test!"))
# Partial Ratio
print(fuzz.partial_ratio("this is a test", "this is a test!"))
Run and output!