QazNLTK
A Python library for Kazakh language text processing.
pip install qaznltk
Features
| # | Feature | Method |
|---|---|---|
| 1 | Tokenization by frequency | tokenize(text) |
| 2 | Sentence segmentation | sent_tokenize(text) |
| 3 | Text similarity score | calc_similarity(a, b) |
| 4 | Cyrillic → Latin (ISO-9) | convert2latin_iso9(text) |
| 5 | Latin → Cyrillic (ISO-9) | convert2cyrillic_iso9(text) |
| 6 | Sentiment analysis | sentimize(text) → -1 / 0 / 1 |
| 7 | Number to words | num2word(n) |
| 8 | IIN parser | get_info_from_iin(iin) |
| 9 | Stop words list | get_stop_words() |
| 10 | Kazakh alphabet | get_kaz_alphabet() |
| 11 | TF-IDF + KNN search | QazNLTKVectorizer + KNN |
| 12 | Kazakh LLM (QazPerry) | via HuggingFace |
Usage
from qaznltk import QazNLTK
qn = QazNLTK()
Tokenize
qn.tokenize("Біздің өміріміз үлкен өзен іспетті.")
# [('өміріміз', 1), ('үлкен', 1), ('өзен', 1), ('іспетті', 1)]
Sentence split
qn.sent_tokenize("Сәлем. Қалайсың?")
# ['Сәлем.', 'Қалайсың?']
Similarity
qn.calc_similarity("Еңбегіне қарай — құрмет.", "Еңбегіне қарай табысы.")
# 0.368
Transliteration
qn.convert2latin_iso9("Бүгін керемет күн!") # Bùgìn keremet kùn!
qn.convert2cyrillic_iso9("Bùgìn keremet kùn!") # Бүгін керемет күн!
Sentiment (-1 negative, 0 neutral, 1 positive)
qn.sentimize("Бұл мақала өте нашар жазылған.") # -1.0
Number to words
qn.num2word(1465) # 'бір мың төрт жүз алпыс бес'
IIN parser
qn.get_info_from_iin("990408482390")
# {'status': 'success', 'date_of_birth': '08.04.1999', 'gender': 'female', ...}
Stop words
qn.get_stop_words()
# ['біздің', 'бұл', 'және', 'мен', 'не', ...]
Kazakh alphabet
qn.get_kaz_alphabet()
# ['а', 'ә', 'б', 'в', 'г', 'ғ', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й',
# 'к', 'қ', 'л', 'м', 'н', 'ң', 'о', 'ө', 'п', 'р', 'с', 'т', 'у',
# 'ү', 'ұ', 'ф', 'х', 'һ', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'і', 'ь', 'э', 'ю', 'я']
TF-IDF + KNN
from qaznltk import QazNLTKVectorizer
vectorizer = QazNLTKVectorizer()
matrix = vectorizer.fit_transform(documents)
knn = vectorizer.KNN(matrix)
query_vector = vectorizer.transform(["Еліміздің алтын күні жарық күн."])[0]
results = knn.search(query_vector, k=3)
# [(idx, distance), ...]
QazPerry (Kazakh LLM)
pip install keras-nlp huggingface_hub
from huggingface_hub import hf_hub_download
import keras, keras_nlp
model_path = hf_hub_download("silvermete0r/Gemma2_2B_QazPerry", "Gemma2_2B_QazPerry.keras")
model = keras.models.load_model(model_path, custom_objects={"GemmaCausalLM": keras_nlp.models.GemmaCausalLM})
print(model.generate("Instruction:\nҚазақша бірдеңе айтшы?\n\nResponse:\n"))
HuggingFace: silvermete0r/Gemma2_2B_QazPerry
License
- MIT
- Built at Skillset School
Metadata
Release files for qaznltk 1.3.0.3
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 |
|---|---|---|---|---|
| qaznltk-1.3.0.3.tar.gz | 17.8 kB | Without provenance | Details for qaznltk-1.3.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qaznltk-1.3.0.3-py3-none-any.whl | Python 3 | none | any | Details for qaznltk-1.3.0.3-py3-none-any.whl |
Total release size: 35.6 kB
Release files / qaznltk-1.3.0.3.tar.gz
| Download URL | qaznltk-1.3.0.3.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a61e11fcdff262c27cb4e0ac72773986b4dbc568befd4707f5b9ea347206234d
|
|
BLAKE2b-256 checksum How to use checksums |
5aea2154162198da8a1feca2d2818262fd86a004132202ad02a9de13a000b8cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Release files / qaznltk-1.3.0.3-py3-none-any.whl
| Download URL | qaznltk-1.3.0.3-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0af43a68abc7e14d0610356adf8286a095c10a670c20ebdc2c4dcdbc3a105f3a
|
|
BLAKE2b-256 checksum How to use checksums |
0d25b47be310cba494c2152a5dc0d95f65581f79ad047e8bd5265bb2402b9b65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Security for qaznltk 1.3.0.3
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.