Skip to content

spaCy ensemble #3

@davidberenstein1957

Description

@davidberenstein1957
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.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions