spaCy ensemble
Opened this issue · 0 comments
davidberenstein1957 commented
import spacy
nlp_fast = spacy.load("en_core_web_sm") # load the fast pipeline
nlp_medium = spacy.load("en_core_web_md") # load the medium pipeline
nlp_slow = spacy.load("en_core_web_lg") # load the slow pipeline
assert nlp_slow.vocab["cat"].vector == nlp_medium.vocab["cat"].vector
nlp_slow.add_pipe(
"ner",
name="ner_medium",
source=nlp_medium,
after="ner",
)
nlp_slow.add_pipe(
"ner",
name="ner_fast",
source=nlp_fast,
after="ner",
)
nlp_fast_and_slow = nlp_slow
doc = nlp_fast_and_slow(
"My David Berentein and I love NLP.")