Spacy: feature request: zero-width lookahead/-behind expression in the Matcher

Created on 26 Apr 2018  路  4Comments  路  Source: explosion/spaCy

The new Matcher in #1971 looks really neat! Maybe I haven't looked closely enough, but it seems that the idea in the title isn't part of the feature set. Say you want to find all loops in a text, but want to ignore fruit loops. You could do something like: [{'LOWER': 'fruit', 'op': '!'}, {'LEMMA': 'loop'}] (even with the old matcher), but that returns matches including whatever word is in front of loop.

I don't know how hard it would be to implement, but adding an extra flag, include (possibly with a better name) could make it possible to return the match as just 'loop':[{'LOWER': 'fruit', 'op': '!', 'include' : False}, {'LEMMA': 'loop'}]

enhancement feat / matcher help wanted

Most helpful comment

I've wanted this as well --- I definitely think it's a good idea, that shouldn't add significant implementation complexity.

All 4 comments

I've wanted this as well --- I definitely think it's a good idea, that shouldn't add significant implementation complexity.

Any news for this

I also find it useful, maybe related to #3275

Would also appreciate this feature in case it's in the pipeline

Was this page helpful?
0 / 5 - 0 ratings