Python wrapper for the Yandex MyStem 3.0 morpholocial analyzer of the Russian language.
Project description
Introduction
This module contains a wrapper for an excellent morphological analyzer for Russian language Yandex Mystem 3.0 released in June 2014. A morphological analyzer can perform lemmatization of text and derive a set of morphological attributes for each token. For more details about the algorithm see I. Segalovich «A fast morphological algorithm with unknown word guessing induced by a dictionary for a web search engine», MLMTA-2003, Las Vegas, Nevada, USA.
Python is the language of choice for many computational linguists, including those working with Russian language. The main motivation for this development was absence of any Python wrapper for the Mystem, a one of the most popular morphological analyzers for Russian language along with the PyMorphy2, the TreeTagger and AOT.
The third version of Mystem introduces several importaint improvements, most importaintly part-of-speech disambiguation. Our wrapper runs the Mystem in the mode which performs POS disambiguation.
This wrapper is open sources under MIT license. However, please consider that the Yandex Mystem is not open source and licensed under conditions of the Yandex License.
System Requrements
The wrapper works with CPython 2.6+/3.3+ and PyPy 1.9+.
The wrapper was tested on Ubuntu Linux 12.04+, Mac OSX 10.9+ and Windows 7+.
Installation
Stable version: https://pypi.python.org/pypi/pymystem3. You can install it using pip:
pip install pymystem3
Latest version (recommended): https://github.com/nlpub/pymystem3:
pip install git+https://github.com/nlpub/pymystem3
A Quick Example
Lemmatization
>>> from pymystem3 import Mystem >>> text = "Красивая мама красиво мыла раму" >>> m = Mystem() >>> lemmas = m.lemmatize(text) >>> print(''.join(lemmas)) красивый мама красиво мыть рама
Getting grammatical information and lemmas.
>>> import json >>> from pymystem3 import Mystem >>> text = "Красивая мама красиво мыла раму" >>> m = Mystem() >>> lemmas = m.lemmatize(text) >>> print "lemmas:", ''.join(lemmas) >>> print "full info:", json.dumps(m.analyze(text), ensure_ascii=False, encoding='utf8') lemmas: красивый мама красиво мыть рама full info: [{"text": "Красивая", "analysis": [{"lex": "красивый", "gr": "A=им,ед,полн,жен"}]}, {"text": " "}, {"text": "мама", "analysis": [{"lex": "мама", "gr": "S,жен,од=им,ед"}]}, {"text": " "}, {"text": "красиво", "analysis": [{"lex": "красиво", "gr": "ADV="}]}, {"text": " "}, {"text": "мыла", "analysis": [{"lex": "мыть", "gr": "V,несов,пе=прош,ед,изъяв,жен"}]}, {"text": " "}, {"text": "раму", "analysis": [{"lex": "рама", "gr": "S,жен,неод=вин,ед"}]}, {"text": "\n"}]
Issues
Please report any bugs or requests that you have using the GitHub issue tracker (https://github.com/nlpub/pymystem3/issues)! We have only very limited amount of resources to maintain this project: please propose a pull request directly if you see an obvious way of fixing the issue. We are very open to accepting bug fixes and your help is greatly appreciated.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymystem3-0.1.9.tar.gz
.
File metadata
- Download URL: pymystem3-0.1.9.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0d62effd93fc7abcd595243df064ea7104dc53ea7addd0453ad5186b6a6adbe |
|
MD5 | 2fcca33e6146bd3e368c921e2a169813 |
|
BLAKE2b-256 | 89df830317a0fc4baefd18bdb8294cb2e3eb1729afeeb983c90413019bbcc797 |
File details
Details for the file pymystem3-0.1.9-py2-none-any.whl
.
File metadata
- Download URL: pymystem3-0.1.9-py2-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b42b6100e186cbc3e41aeecedfd46b89a5abf8a73aa65336a92675ae9318d399 |
|
MD5 | 3bccf95dafb8b5a8cfc2931790bd29a0 |
|
BLAKE2b-256 | 7fbfe6b0babfee98ac0a7c9986bc732f83e156231d5696f3ed83fb63ae4296eb |