MARu: Morphological Analyzer for Russian
MARu is a morphological analyzer for Russian, written in Python, powered by machine learning and neural networks.
Installation
$ pipenv install maru
or
$ pipenv install maru[gpu]
for installation with Tensorflow GPU support.
You can also just use pip (though you should definitely take a look at pipenv).
What’s in the Box?
✨ Morphological analysis with contextual disambiguation using Universal Dependencies tags.
🌈 Trained via various machine learning methods: linear model, CRF, deep neural network.
🔮 Speed/accuracy trade-off between different methods.
🍰 Vocabulary-based lemmatization, built on top of pymorphy2.
Usage
First, create a maru.analyzer.Analyzer object using the factory method:
>> import maru
>> analyzer = maru.get_analyzer(tagger='crf', lemmatizer='pymorphy')
Then, analyze some text:
>> analyzed = analyzer.analyze(['мама', 'мыла', 'раму']) # note that this returns an iterator
>> for morph in analyzed:
... print(morph)
...
Morph(word='мама', lemma='мама', tag=Tag(pos=NOUN,animacy=Anim,case=Nom,gender=Fem,number=Sing))
Morph(word='мыла', lemma='мыть', tag=Tag(pos=VERB,aspect=Imp,gender=Fem,mood=Ind,number=Sing,tense=Past,verbform=Fin,voice=Act))
Morph(word='раму', lemma='рама', tag=Tag(pos=NOUN,animacy=Inan,case=Acc,gender=Fem,number=Sing))
Other available taggers that you can pass to maru.get_analyzer are 'linear', 'rnn', and 'pymorphy'. Another available lemmatizer is 'dummy' (no actual lemmatization, slightly improves inference speed).
You can refer to the following table when choosing an algorithm to use:
Full tag accuracy (per token, per sentence) and inference speed |
|||||||||
|---|---|---|---|---|---|---|---|---|---|
Tagger |
News (Lenta) |
Social (VK) |
Literature (JZ) |
All |
Inference speed |
||||
Pymorphy |
77.24% |
12.85% |
72.71% |
18.84% |
73.16% |
10.91% |
74.43% |
14.85% |
49000 tokens/sec |
Linear |
95.00% |
61.73% |
91.64% |
59.51% |
93.00% |
57.87% |
93.26% |
59.62% |
26500 tokens/sec |
CRF |
95.55% |
64.53% |
91.82% |
61.27% |
93.59% |
63.96% |
93.70% |
62.95% |
5500 tokens/sec |
RNN |
97.65% |
79.33% |
95.43% |
75.88% |
95.84% |
73.60% |
96.34% |
76.14% |
1000 tokens/sec |
Accuracy was measured on the MorphoRuEval-2017 test set. Inference speed was estimated on a system with 32 GB RAM, Intel i7 6700K as CPU and GeForce GTX 1060 as GPU. RNN performance is given for single sentence inference on GPU. An addition of batch inference in the future can greatly improve it.
Metadata
Release files for maru 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maru-0.2.0.tar.gz | 43.4 MB | Without provenance | Details for maru-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maru-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for maru-0.2.0-py3-none-any.whl |
Total release size: 86.9 MB
Release files / maru-0.2.0.tar.gz
| Download URL | maru-0.2.0.tar.gz |
|---|---|
| Size | 43.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49472b5837b97776ca432fcb7a02802d48750de2b7b316f075027467cadb78ba
|
|
BLAKE2b-256 checksum How to use checksums |
edbc64e8fbf0bf545842268f7327bd43768be6cbf13897680c7d05583dfb1396
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Darwin/20.2.0
|
Release files / maru-0.2.0-py3-none-any.whl
| Download URL | maru-0.2.0-py3-none-any.whl |
|---|---|
| Size | 43.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2296433ff95558c40deac1a25305f6c7a7c6a5fffea80684d172448079fecec
|
|
BLAKE2b-256 checksum How to use checksums |
b9686e8f5a0fdf4ef494f115f75762738a8b0c6f62c7dce8d5afd11c4db78756
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Darwin/20.2.0
|
Security for maru 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.