Fix regex flag matcher example (resolves #1950)

This commit is contained in:
ines 2018-02-09 10:23:33 +01:00
parent fc4ae04c55
commit e9f67be04d
1 changed files with 2 additions and 1 deletions

View File

@ -339,7 +339,8 @@ p
| flag.
+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.add('DEFINITELY', None, [{IS_DEFINITELY: True}])