Repository navigation
Russian lemmatizer: add a rumorph mode #14057
SergeyShk
started this conversation in
New Features & Project Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi! I'm the author of ruMorph, a Russian morphological analyzer with a Rust core and a Python API. It uses the same OpenCorpora dictionary as pymorphy3 (code under MIT, dictionary under CC BY-SA). The difference is that it returns Universal Dependencies parts of speech, features and lemmas directly: it follows the UD guidelines and, where they are silent, the SynTagRus conventions
I'd like to propose a
rumorphmode forRussianLemmatizer, next topymorphy3. The mode would pick the lemma of the ruMorph analysis that best matches the token'spos_andmorph, the same idea as_pymorphy_lemmatize. Since the analyses are already in UD, the OpenCorpora → UD conversion (oc2ud) isn't needed:I measured a prototype with
ru_core_news_sm3.8.0 providing the tags. The data is the gold tokens of the UD 2.18 test sets, punctuation excluded, lemmas compared case-insensitively:pymorphy3moderumorphmodepymorphy3→rumorphThe change would be about 40 lines in
spacy/lang/ru/lemmatizer.py: the mode, an import check with an install hint like the one for pymorphy3, and tests.pymorphy3would stay the default, so existing pipelines don't change. Whether to switch the default in the nextru_core_news_*release would be up to you. Would you accept a PR like this? I'm happy to write itSeparately, since 0.4.0 ruMorph ships its own spaCy component (
pip install "rumorph[spacy]", thennlp.add_pipe("rumorph")). It replaces the morphologizer and the lemmatizer with ruMorph's context model. Withru_core_news_sm, the share of words where POS, lemma and features are all correct on SynTagRus test goes from 82.0 % to 93.7 %, and the pipeline also gets faster (5.6k → 8.8k tokens/s). I've submitted it to the spaCy Universe in #14056. Docs: https://sergeyshk.github.io/ruMorph/en/spacy/All reactions