-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lemmatization issue #114
Comments
it works fine in Colab though, something wrong with my machine probably |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Добрый день,
при попытке просто повторить код лемматизации из примера с израильским послом:
for token in doc.tokens:
token.lemmatize(morph_vocab)
print(doc.tokens[:5])
{_.text: _.lemma for _ in doc.tokens}
выскакивает диагностика:
AttributeError Traceback (most recent call last)
Cell In [7], line 2
1 for token in doc.tokens:
----> 2 token.lemmatize(morph_vocab)
4 print(doc.tokens[:5])
5 {_.text: _.lemma for _ in doc.tokens}
File C:\miniconda3\envs\Python\lib\site-packages\natasha\doc.py:38, in DocToken.lemmatize(self, vocab)
37 def lemmatize(self, vocab):
---> 38 self.lemma = vocab.lemmatize(self.text, self.pos, self.feats)
File C:\miniconda3\envs\Python\lib\site-packages\natasha\morph\vocab.py:173, in MorphVocab.lemmatize(self, word, pos, feats)
170 def lemmatize(self, word, pos, feats):
171 from .lemma import lemmatize
--> 173 return lemmatize(self, word, pos, feats)
File C:\miniconda3\envs\Python\lib\site-packages\natasha\morph\lemma.py:58, in lemmatize(vocab, word, pos, feats)
56 word = normal_word(word)
57 forms = vocab(word)
---> 58 form = best_form(forms, pos, feats)
59 if form:
60 return normal_word(form.normal)
File C:\miniconda3\envs\Python\lib\site-packages\natasha\morph\lemma.py:48, in best_form(forms, pos, feats)
45 if form.pos == pos and form.feats == feats:
46 return form
---> 48 sim = grams_sim(form.pos, form.feats, pos, feats)
49 if sim > max:
50 best = form
File C:\miniconda3\envs\Python\lib\site-packages\natasha\morph\lemma.py:39, in grams_sim(a_pos, a_feats, b_pos, b_feats)
38 def grams_sim(a_pos, a_feats, b_pos, b_feats):
---> 39 return pos_sim(a_pos, b_pos) + feats_sim(a_feats, b_feats)
File C:\miniconda3\envs\Python\lib\site-packages\natasha\morph\lemma.py:33, in feats_sim(a, b)
30 def feats_sim(a, b):
31 return sum(
32 a[] == b[]
---> 33 for _ in a.keys() & b.keys()
34 if _ in FEATS
35 )
AttributeError: 'NoneType' object has no attribute 'keys'
(jupyter выделяет b.keys() как проблему)
В чем может быть причина?
The text was updated successfully, but these errors were encountered: