mirror of https://github.com/explosion/spaCy.git
Fix regex flag matcher example (resolves #1950)
This commit is contained in:
parent
fc4ae04c55
commit
e9f67be04d
|
@ -339,7 +339,8 @@ p
|
||||||
| flag.
|
| flag.
|
||||||
|
|
||||||
+code.
|
+code.
|
||||||
IS_DEFINITELY = nlp.vocab.add_flag(re.compile(r'deff?in[ia]tely').match)
|
definitely_flag = lambda text: bool(re.compile(r'deff?in[ia]tely').match(text))
|
||||||
|
IS_DEFINITELY = nlp.vocab.add_flag(definitely_flag)
|
||||||
|
|
||||||
matcher = Matcher(nlp.vocab)
|
matcher = Matcher(nlp.vocab)
|
||||||
matcher.add('DEFINITELY', None, [{IS_DEFINITELY: True}])
|
matcher.add('DEFINITELY', None, [{IS_DEFINITELY: True}])
|
||||||
|
|
Loading…
Reference in New Issue