taleinat / fuzzysearch

Find parts of long text or data, allowing for some changes/typos.
MIT License
301 stars 26 forks source link

Error when running code from example #19

Closed DanielBiskup closed 4 years ago

DanielBiskup commented 4 years ago

I get

TypeError: '<' not supported between instances of 'int' and 'NoneType'`

when running the third example in section "Matching Criteria" of README.rst I.e.:

find_near_matches('PATTERN', '---PATERN---', max_l_dist=1, max_deletions=0)

Full Traceback:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/__init__.py", line 57, in find_near_matches
    return search_class.consolidate_matches(matches)
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/generic_search.py", line 268, in consolidate_matches
    return consolidate_overlapping_matches(matches)
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/common.py", line 162, in consolidate_overlapping_matches
    groups = group_matches(matches)
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/common.py", line 138, in group_matches
    for match in matches:
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/generic_search.py", line 263, in search
    search_params):
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/generic_search.py", line 235, in find_near_matches_generic_ngrams
    search_params,
  File "/home/username/anaconda3/envs/extraction_service/lib/python3.7/site-packages/fuzzysearch/generic_search.py", line 104, in _find_near_matches_generic_linear_programming
    if cand.n_ins < max_insertions:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
taleinat commented 4 years ago

Thanks for reporting this! That's embarrassing... 😳

I've fixed this just now, and will release a new version with this fix soon!

taleinat commented 4 years ago

Fix available in version 0.7.1.