diff --git a/website/usage/_linguistic-features/_rule-based-matching.jade b/website/usage/_linguistic-features/_rule-based-matching.jade index 7984b100e..f7c800c45 100644 --- a/website/usage/_linguistic-features/_rule-based-matching.jade +++ b/website/usage/_linguistic-features/_rule-based-matching.jade @@ -206,7 +206,8 @@ p nlp = spacy.load('en_core_web_sm') matcher = PhraseMatcher(nlp.vocab) terminology_list = ['Barack Obama', 'Angela Merkel', 'Washington, D.C.'] - patterns = [nlp(text) for text in terminology_list] + # Only run nlp.make_doc to speed things up + patterns = [nlp.make_doc(text) for text in terminology_list] matcher.add('TerminologyList', None, *patterns) doc = nlp(u"German Chancellor Angela Merkel and US President Barack Obama " diff --git a/website/usage/_processing-pipelines/_custom-components.jade b/website/usage/_processing-pipelines/_custom-components.jade index f3f2cc417..674722eba 100644 --- a/website/usage/_processing-pipelines/_custom-components.jade +++ b/website/usage/_processing-pipelines/_custom-components.jade @@ -72,7 +72,7 @@ p name = 'entity_matcher' def __init__(self, nlp, terms, label): - patterns = [nlp(text) for text in terms] + patterns = [nlp.make_doc(text) for text in terms] self.matcher = PhraseMatcher(nlp.vocab) self.matcher.add(label, None, *patterns) diff --git a/website/usage/_v2/_migrating.jade b/website/usage/_v2/_migrating.jade index f313d1ce3..f54ceb9cf 100644 --- a/website/usage/_v2/_migrating.jade +++ b/website/usage/_v2/_migrating.jade @@ -240,7 +240,7 @@ p +code-new. from spacy.matcher import PhraseMatcher matcher = PhraseMatcher(nlp.vocab) - patterns = [nlp(text) for text in large_terminology_list] + patterns = [nlp.make_doc(text) for text in large_terminology_list] matcher.add('PRODUCT', None, *patterns) +code-old.