From e9f67be04d39366697845e3670e92c9e5430380e Mon Sep 17 00:00:00 2001 From: ines Date: Fri, 9 Feb 2018 10:23:33 +0100 Subject: [PATCH] Fix regex flag matcher example (resolves #1950) --- website/usage/_linguistic-features/_rule-based-matching.jade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/usage/_linguistic-features/_rule-based-matching.jade b/website/usage/_linguistic-features/_rule-based-matching.jade index bb75e7ad2..39062493a 100644 --- a/website/usage/_linguistic-features/_rule-based-matching.jade +++ b/website/usage/_linguistic-features/_rule-based-matching.jade @@ -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}])