Zeyrek: Morphological Analyzer and Lemmatizer
Zeyrek is a partial port of the Zemberek library to Python for lemmatizing and analyzing Turkish language words. It is in alpha stage, and the API will probably change.
- Free software: MIT license
- Documentation: https://zeyrek.readthedocs.io.
Basic Usage
Install Zeyrek and the NLTK tokenizer data it uses:
pip install zeyrek
python -m nltk.downloader punkt_tab
To use Zeyrek, first create an instance of MorphAnalyzer class:
>>> import zeyrek
>>> analyzer = zeyrek.MorphAnalyzer()
Then, you can call its analyze method on words or texts to get all possible analyses:
>>> for parse in analyzer.analyze("benim")[0]:
... print(parse)
Parse(word='benim', lemma='ben', pos='Noun', morphemes=['Noun', 'A3sg', 'P1sg'], formatted='[ben:Noun] ben:Noun+A3sg+im:P1sg')
Parse(word='benim', lemma='ben', pos='Pron', morphemes=['Pron', 'A1sg', 'Gen'], formatted='[ben:Pron,Pers] ben:Pron+A1sg+im:Gen')
Parse(word='benim', lemma='ben', pos='Verb', morphemes=['Noun', 'A3sg', 'Zero', 'Verb', 'Pres', 'A1sg'], formatted='[ben:Noun] ben:Noun+A3sg|Zero→Verb+Pres+im:A1sg')
Parse(word='benim', lemma='ben', pos='Verb', morphemes=['Pron', 'A1sg', 'Zero', 'Verb', 'Pres', 'A1sg'], formatted='[ben:Pron,Pers] ben:Pron+A1sg|Zero→Verb+Pres+im:A1sg')
If you only need the base form of words, or lemmas, you can call lemmatize. It returns
the most likely lemma for each word of the text:
>>> analyzer.lemmatize("benim evim")
['ben', 'ev']
To get every possible lemma, create the analyzer with return_all_lemmas=True. lemmatize
then returns a list of tuples, with each word and a list of its possible lemmas:
>>> zeyrek.MorphAnalyzer(return_all_lemmas=True).lemmatize("benim")
[('benim', ['ben'])]
A lemma is the root of the word, and derivational suffixes can change its meaning a lot. derived_lemmas
returns, for each analysis of a word, the lemmas from the root to the stem after the last derivational
suffix. The last one is the word without its inflectional suffixes:
>>> analyzer.derived_lemmas("çekilişle")
[['çekiliş'], ['çekil', 'çekiliş'], ['çek', 'çekil', 'çekiliş']]
Credits
This package is a Python port of part of the Zemberek package by Ahmet A. Akın
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Metadata
Release files for zeyrek 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 |
|---|---|---|---|---|
| zeyrek-0.2.0.tar.gz | 952.9 kB | Without provenance | Details for zeyrek-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zeyrek-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for zeyrek-0.2.0-py3-none-any.whl |
Total release size: 1.9 MB
Release files / zeyrek-0.2.0.tar.gz
| Download URL | zeyrek-0.2.0.tar.gz |
|---|---|
| Size | 952.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e034ffae8f206d1e2922d10db320c02f7c6652518ab76d54e3fbaba1f279e2b
|
|
BLAKE2b-256 checksum How to use checksums |
5facb8f4d69fa23e0f6426cc52d3a15b76a6d2b2c2308d5d604719c6c3dff033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / zeyrek-0.2.0-py3-none-any.whl
| Download URL | zeyrek-0.2.0-py3-none-any.whl |
|---|---|
| Size | 956.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f14accf5c6edc4b5da86fce0e6a701043c858fa7cd84c54a80301d0c0305b6d4
|
|
BLAKE2b-256 checksum How to use checksums |
d9ce193bbbb3fc10c6c87115b409f6803097801f1fd4eecc74aca08b18646100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for zeyrek 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.