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

Pattern matcher regression #1503

Closed
emste opened this issue Nov 7, 2017 · 4 comments
Closed

Pattern matcher regression #1503

emste opened this issue Nov 7, 2017 · 4 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@emste
Copy link

emste commented Nov 7, 2017

Hey!
I'm working with the Matcher and experienced changed behaviour between v2.0.0a17 and v2.0.0a19. The pattern operator '*' seems to be less greedy than it was in a17:

import spacy

from spacy.matcher import Matcher

nlp = spacy.load('en_core_web_sm')

def on_match(matcher, doc, i, matches):
    match_id, start, end = matches[i]
    match = doc[start : end].text
    print(f"on_match: {match}")

matcher = Matcher(nlp.vocab)
matcher.add('MyMatcher', on_match,  [ {'ORTH': 'Hello'}, {'ORTH': 'World', 'OP': '*'} ])

doc1 = nlp('Hello World')
doc2 = nlp('Hello World World World')
matcher(doc1)
matcher(doc2)
# Output for a17
# on_match: Hello World
# on_match: Hello World World World
# Output for a19
# on_match: Hello World
# on_match: Hello World

Is this an intended change?

Env a17

  • spaCy version: 2.0.0a17
  • Platform: Linux-4.9.49-moby-x86_64-with-debian-8.9
  • Python version: 3.6.3
  • Models: en_core_web_sm, xx_ent_wiki_sm

Env a19

  • spaCy version: 2.0.0a19
  • Platform: Linux-4.9.49-moby-x86_64-with-debian-8.9
  • Python version: 3.6.3
  • Models: en_core_web_sm, xx_ent_wiki_sm, de_core_news_sm
@honnibal honnibal added the bug Bugs and behaviour differing from documentation label Nov 7, 2017
@honnibal
Copy link
Member

honnibal commented Nov 7, 2017

Thanks!

@ines ines added 🌙 nightly Discussion and contributions related to nightly builds and removed 🌙 nightly Discussion and contributions related to nightly builds labels Nov 7, 2017
@wpm
Copy link

wpm commented Jan 8, 2018

Looks like the same thing is happening with the + qualifier.

@ines
Copy link
Member

ines commented Jan 24, 2018

Should be fixed in #1876!

@ines ines closed this as completed Jan 24, 2018
@lock
Copy link

lock bot commented May 8, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation
Projects
None yet
Development

No branches or pull requests

4 participants