Sebastian Wdowiarz
Sebastian Wdowiarz

Reputation: 161

Python - get probability/percentage value if string exists in text

I'm trying to figure out if there is any Python library which allows me to get the percentage value of probability if the string that I'm looking for exists in text or if there is any similar.

To get it more clearly, here is the example:

My string is 'Company Ltd' and in text it exists but under the phrase 'Company Limited'. The other example, 'Boeing BG' and in text it is present by 'Boeing B.G.'

Is there any way for to get percentage value/probability that it exists in text or not?

Upvotes: 1

Views: 924

Answers (1)

rachid
rachid

Reputation: 2496

A candidate for your search is the fuzzywuzzy library

from fuzzywuzzy import fuzz
fuzz.ratio("this is a test", "this is a test!")

will print 97

Upvotes: 3

Related Questions