PyMorphy2 (version 0.9.1) is a morphological analyzer and inflection engine for the Russian and Ukrainian languages. It provides functionalities for POS tagging, word inflection, and normalization using OpenCorpora.org dictionaries and heuristic algorithms for unknown words. The project's release cadence is infrequent, with the last significant update in September 2020.
pip install pymorphy2Verified import paths — ran on the pinned version, not inferred.
Initializes the MorphAnalyzer and demonstrates basic usage: parsing a word to find its normal form and part of speech, and inflecting it to a different grammatical form. The `pymorphy2-dicts` package must be installed for dictionaries to be found.
Ensure your project uses Python 3.5 or newer. For Python 3.11/3.12+, be aware of potential compatibility issues or consider community forks.
For active development, consider monitoring or contributing to community forks (e.g., 'pymorphy2-fork' on GitHub) or exploring alternative NLP libraries if long-term maintenance is critical.
Always check against valid grammeme sets or use the provided API correctly. For example, to check for plural, use `tag.number == 'plur'` or `('plur' in tag)`.Ensure `pymorphy2` (and `pymorphy2-dicts`) is installed before the main Python process starts, or restart the kernel/runtime after installation. Upgrade to `0.9.1` or later.
Install the dictionary package: `pip install pymorphy2-dicts`.
Verify installation with `pip show pymorphy2`. If installed, check for conflicting local files or environment path issues. A common mistake is `import pymorphy2.MorphAnalyzer` instead of `from pymorphy2 import MorphAnalyzer`.
Try `pip install pymorphy2` without the `[fast]` extra. Ensure all dependencies are up-to-date. If issues persist, consider using a Python version that is known to be stable with `pymorphy2` (e.g., Python 3.8/3.9) or consult the project's GitHub issues for workarounds.