Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial regex matcher doesn't work if the found token has index 0 #82

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

adinowi
Copy link
Contributor

@adinowi adinowi commented Mar 6, 2024

Hi, here is a small snippet to reproduce the problem

from spaczz.matcher import RegexMatcher
import spacy

nlp = spacy.blank("en")
matcher = RegexMatcher(nlp.vocab)

not_working = "withh something"
working = "something withh"

matcher.add("WITH", ["with"])

print(matcher(nlp(not_working)))
# > before fix []
# > after fix [('WITH', 0, 1, 100, 'with')]

print(matcher(nlp(working)))
# > before fix [('WITH', 1, 2, 100, 'with')]
# > after fix [('WITH', 1, 2, 100, 'with')]

@gandersen101
Copy link
Owner

Hi @adinowi, good catch and thanks for the contribution! Cool to see people are still getting use out of spaczz. Wish I had more time to actively improve it.

@gandersen101 gandersen101 merged commit d0cc551 into gandersen101:main Mar 7, 2024
@gandersen101 gandersen101 added the bug Something isn't working label Mar 11, 2024
@gandersen101
Copy link
Owner

This fix is now available in v0.6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants