natasha/natasha
Solves basic Russian NLP tasks, API for lower level Natasha projects
What is Natasha?
Natasha is a Python library that bundles a set of tools for processing Russian text. It covers the whole NLP pipeline:
- Tokenisation & sentence splitting – via the Razdel library.
- Word embeddings – compact pre‑trained Russian vectors (Navec).
- Morphology tagging – part‑of‑speech and grammatical features (Slovnet).
- Lemmatisation – turning words into their dictionary form (using pymorphy2).
- Syntax parsing – dependency trees for each sentence (Slovnet).
- Named‑entity recognition – detecting persons, locations and organisations (Slovnet).
- Entity normalisation & parsing – turning entity mentions into a canonical form and extracting name parts.
- Rule‑based fact extraction – via Yargy (e.g., dates, money, addresses).
All models are lightweight, run on CPU and are built for production use (small size, low RAM, fast inference).
How to get started
pip install natasha # Python 3.7+ or PyPy3
A typical workflow looks like this (simplified):
from natasha import (
Segmenter, MorphVocab, NewsEmbedding,
NewsMorphTagger, NewsSyntaxParser, NewsNERTagger,
NamesExtractor, Doc
)
text = "…your Russian text…"
doc = Doc(text)
# 1️⃣ Split into tokens & sentences
segmenter = Segmenter()
doc.segment(segmenter)
# 2️⃣ Morphology
morph_tagger = NewsMorphTagger(NewsEmbedding())
doc.tag_morph(morph_tagger)
# 3️⃣ Lemma
morph_vocab = MorphVocab()
for token in doc.tokens:
token.lemmatize(morph_vocab)
# 4️⃣ Syntax tree
syntax_parser = NewsSyntaxParser(NewsEmbedding())
doc.parse_syntax(syntax_parser)
# 5️⃣ NER
ner_tagger = NewsNERTagger(NewsEmbedding())
doc.tag_ner(ner_tagger)
# 6️⃣ Normalise & parse entities
for span in doc.spans:
span.normalize(morph_vocab)
if span.type == 'PER':
span.extract_fact(NamesExtractor(morph_vocab))
Each step enriches the Doc object with properties (tokens, sents, spans, etc.) that you can inspect or visualise (Ipymarkup provides nice Jupyter renderings).
When to use Natasha
- Russian‑only projects – it is specialised for Russian news text and other domains.
- CPU‑only environments – models are small and don’t need a GPU.
- Production pipelines – emphasis on speed, low memory footprint and stable APIs.
- When you need a full‑stack solution – you can pick individual sub‑libraries (Razdel, Navec, Slovnet, Yargy) if you only need part of the functionality.
Limitations
- The models are trained on news data; performance may drop on very different domains.
- The high‑level API may change; for long‑term stability you might want to import the lower‑level libraries directly.
- Only Russian is supported – no multilingual capabilities.
Where to learn more
- Docs & examples – Jupyter notebook at
docs.ipynb. - Evaluation details – linked sections for each component (Razdel, Navec, Slovnet).
- Community – Telegram chat, GitHub issues, and commercial support via the author’s lab.
TL;DR
Natasha is a production‑ready, CPU‑friendly Python toolkit that bundles tokenisation, embeddings, morphology, lemmatisation, syntactic parsing, NER and rule‑based fact extraction for Russian text. Install with pip install natasha and follow the step‑by‑step example to turn raw Russian sentences into richly annotated linguistic structures.
Related
- Project
- Project
- Project
- Project