Skip to content
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

Не находит фамилии которые записаны в определённом виде #128

Open
woodholly opened this issue Jun 18, 2023 · 0 comments

Comments

@woodholly
Copy link

Никогда не находит фамилию, когда она указана вначале, пример:

from natasha import (
    Segmenter,
    MorphVocab,  
    PER,
    NamesExtractor,
    NewsNERTagger,   
    NewsEmbedding,
    Doc
)
 
emb = NewsEmbedding()
segmenter = Segmenter()
morph_vocab = MorphVocab()
ner_tagger = NewsNERTagger(emb)
names_extractor = NamesExtractor(morph_vocab)

text = "Это проверка Абдурахмановой Натальи Петровны на простом примере."

doc = Doc(text)
doc.segment(segmenter)
doc.tag_ner(ner_tagger)
 
for span in doc.spans:
    span.normalize(morph_vocab)
 
for span in doc.spans:
    if span.type == PER:
        span.extract_fact(names_extractor)
   
print({_.normal: _.fact.as_dict for _ in doc.spans if _.fact})

Результат:

{'Натальи Петровны': {'first': 'Натальи', 'last': 'Петровны'}}

Фамилию не нашла, как Наташу научить ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant