Skip to content

Commit

Permalink
Merge pull request #82 from adinowi/regex-fix
Browse files Browse the repository at this point in the history
Partial regex matcher doesn't work if the found token has index 0
  • Loading branch information
gandersen101 committed Mar 7, 2024
2 parents 454a4b5 + fc058ae commit d0cc551
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/spaczz/_search/regexsearcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _spans_from_regex(
if partial:
start_token = char_to_token_map.get(start)
end_token = char_to_token_map.get(end - 1)
if start_token and end_token:
if start_token is not None and end_token is not None:
span = Span(doc, start_token, end_token + 1)
return (span, counts)
return None

0 comments on commit d0cc551

Please sign in to comment.