Deep Learning based high-speed Turkish Lemmatizer
Project description
Lemmaturk: High-Speed Turkish Lemmatizer
Lemmaturk is a deep learning-based lemmatization library designed specifically for the Turkish language. Unlike traditional rule-based systems that rely on static dictionaries and strict morphological rules, Lemmaturk utilizes a Transformer-based Sequence-to-Sequence (Seq2Seq) architecture.
This approach allows the model to "generate" lemmas rather than selecting them from a list, making it highly robust against unknown words, spelling errors, and complex agglutinative structures. It is optimized for GPU inference, offering significant speed advantages for large-scale data processing.
Features
- Transformer Architecture: Uses a custom Encoder-Decoder model to understand morphological context.
- Generative Approach: Capable of predicting roots for words not present in the training set (Out-of-Vocabulary).
- High Performance: Fully compatible with CUDA for GPU acceleration.
- Robustness: Can handle minor OCR errors and non-standard input effectively.
- Easy Integration: Simple Python API designed for seamless integration into NLP pipelines.
Installation
You can install the package directly via pip:
pip install lemmaturk
Usage
The library provides a simple interface through the Lemmatizer class. It automatically detects if a GPU is available and moves the model to the appropriate device.
Basic Usage
from lemmaturk import Lemmatizer
# Initialize the lemmatizer
# This loads the model weights and vocabulary
lem = Lemmatizer()
# Analyze a single word
word = "kitaplaştıramadıklarımızdan"
root = lem.lemmatize(word)
print(f"Word: {word} -> Lemma: {root}")
# Output: Word: kitaplaştıramadıklarımızdan -> Lemma: kitap
Batch Processing Example
from lemmaturk import Lemmatizer
lem = Lemmatizer()
words = [
"gidiyorum",
"kalemlik",
"gözlükçü",
"yapılandırılması",
"bilgisayarlarımız"
]
print("-" * 30)
print(f"{'Word':<20} | {'Lemma'}")
print("-" * 30)
for w in words:
lemma = lem.lemmatize(w)
print(f"{w:<20} | {lemma}")
Technical Details
- Architecture: Transformer (Seq2Seq) with Positional Encoding.
- Embedding Dimension: 256
- Hidden Dimension: 512
- Heads: 8
- Layers: 3 Encoder / 3 Decoder
- Training Data: Trained on a hybrid dataset consisting of academic treebanks, web-scraped literature, and OCR-digitized historical texts (approx. 500k+ samples).
Requirements
- Python >= 3.8
- PyTorch >= 2.0.0
- NumPy
License
This project is licensed under the MIT License.
Citation
If you use this tool in your research, please cite:
Mahmut. (2026). Lemmaturk: Deep Learning based high-speed Turkish Lemmatizer.
GitHub/PyPI Repository.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lemmaturk-0.1.0.tar.gz.
File metadata
- Download URL: lemmaturk-0.1.0.tar.gz
- Upload date:
- Size: 19.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e602cef285440ed9ee669f210db40d0f5b0aab80bb9261b3648646069d756f4
|
|
| MD5 |
eb4ddbb7a46369d025ba4d6a8b3553f2
|
|
| BLAKE2b-256 |
2bf95b7faa0e5738b363493f28e788e2b125d7dbb10f81396934e1ff345f97ec
|
File details
Details for the file lemmaturk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lemmaturk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2f7313950d7d9dff2f12f6eeed8218ee5c6b93e63d5578c7e202e926d2ca546
|
|
| MD5 |
26ebdc54f7abb0ab67d9e941309428e1
|
|
| BLAKE2b-256 |
16235e5b0f54fd67f5311ebcb39732c25d1b51a9b14b125d907dce50554e69e8
|