shon-otmazgin / fastcoref

MIT License
149 stars 26 forks source link

Unable to use fastcoref with spacy #46

Open RuiHe1999 opened 1 year ago

RuiHe1999 commented 1 year ago

Hi there,

I met this error when trying to add FCoref to spaCy:

nlp = spacy.load("en_core_web_sm") nlp.add_pipe("fastcoref")

ValueError: [E002] Can't find factory for 'fastcoref' for language English (en). This usually happens when spaCy calls nlp.create_pipe with a custom component name that's not registered on the current language class. If you're using a Transformer, make sure to install 'spacy-transformers'. If you're using a custom component, make sure you've added the decorator @Language.component (for function components) or @Language.factory (for class components).

Available factories: attribute_ruler, tok2vec, merge_noun_chunks, merge_entities, merge_subtokens, token_splitter, doc_cleaner, parser, beam_parser, lemmatizer, trainable_lemmatizer, entity_linker, entity_ruler, tagger, morphologizer, ner, beam_ner, senter, sentencizer, spancat, spancat_singlelabel, span_finder, future_entity_ruler, span_ruler, textcat, textcat_multilabel, en.lemmatizer

Just FYI: I used spaCY 3.7.0

May you let me know how to solve this error?

Many thanks.

ksteimel commented 5 months ago

I believe you need to include the following import, though it may seem to be unused in your ide.

from fastcoref import spacy_component