Asteroid098
Asteroid098

Reputation: 2825

Extracting matched using fuzzysearch

I am trying to extract the parameters in fuzzysearch

https://github.com/taleinat/fuzzysearch

The result I get looks like this:

>>> from fuzzysearch import find_near_matches
# search for 'PATTERN' with a maximum Levenshtein Distance of 1
>>> find_near_matches('PATTERN', '---PATERN---', max_l_dist=1)
[Match(start=3, end=9, dist=1, matched="PATERN")]

How do I extract 'matched' and 'dist' from the resulting list? I can't seem to index the output

Upvotes: 1

Views: 313

Answers (1)

Eugenos_Programos
Eugenos_Programos

Reputation: 15

To extract distance - near_matches[0].dist. To extract pattern - near_matches[0].matched

Upvotes: 0

Related Questions