I am trying to use the french tokenizer and lemmatizer (LefffLemmatizer) of Spacy. I am using Python 3.6 in Conda environment.
However when I am trying to install the french version python -m spacy download fr
, I have an error code ModuleNotFoundError: No module named 'cymem'
. So, I did a check via pip list
(to see if I had it) and I do. I did a conda update --all
just to be sure the issue was not comming from my setting.
I was thinking I could bypass this by using the model from spacy. My current code is then trying to bypass it :
import spacy
from spacy import fr
from spacy.fr import French
nlp = French()
tokenizer = nlp.Defaults.create_tokenizer(nlp)
from spacy_lefff import LefffLemmatizer, POSTagger
pos = POSTagger()
french_lemmatizer = LefffLemmatizer(after_melt=True, default=True)
nlp.add_pipe(pos, name='pos', after='parser')
nlp.add_pipe(french_lemmatizer, name='lefff', after='pos')
doc = nlp("Apple cherche a acheter une startup anglaise pour 1 milliard de dollard")
for d in doc:
print(d.text, d.pos_, d._.melt_tagger, d._.lefff_lemma, d.tag_, d.lemma_)
This is not working either. I have the next error happening.
AttributeError Traceback (most recent call last)
<ipython-input-43-6802b928c839> in <module>()
----> 3 pos = POSTagger()
...
--> 109 if not tk.get_extension(self.name):
...
AttributeError: type object 'spacy.tokens.token.Token' has no attribute 'get_extension'
How can I fix this?
Thanks for anyone who could help me.
Bianca