The new Python library pyrusmorph integrates the native C++ libmorph/rus engine to accelerate morphological analysis of Russian texts. By utilizing serialized radix trees and avoiding dynamic memory allocation, the library achieves a 25–30x performance increase compared to standard PyMorphy solutions.
The libmorph/rus engine, which has been in development for 30 years, stores its dictionary in a continuous 2 MB block. This design ensures stable memory consumption and allows for efficient cache utilization. In testing, the engine demonstrated processing speeds exceeding 1.3 million words per second in a native C++ environment.
Performance benchmarks were conducted on a dataset of 4 MB of text containing 405,000 words. While the Python wrapper introduces a twofold slowdown compared to the raw C++ implementation, the overall speed remains significantly higher than that of existing Python-based morphological analyzers.
The library supports lemmatization, heuristic analysis, word form generation, and pattern-based dictionary iteration. It is available for installation via pip, with the source code hosted on GitHub under the project name libmorph.






