readme
Browse files
README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- bert
|
| 5 |
+
- morphological-analysis
|
| 6 |
+
- kyrgyz
|
| 7 |
+
- nlp
|
| 8 |
+
- pos-tagging
|
| 9 |
+
- low-resource-languages
|
| 10 |
+
- token-classification
|
| 11 |
+
language:
|
| 12 |
+
- ky
|
| 13 |
+
pipeline_tag: token-classification
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Kyrgyz Morphological Analysis β BERT
|
| 17 |
+
|
| 18 |
+
<p align="center">
|
| 19 |
+
<img src="image_2023-05-13_16-58-05.png" alt="Morphological analysis example" width="600"/>
|
| 20 |
+
</p>
|
| 21 |
+
|
| 22 |
+
## Model Description
|
| 23 |
+
|
| 24 |
+
A **BERT-based morphological analyzer** for the **Kyrgyz language** β a low-resource Turkic language spoken by ~5 million people. The model performs morphological tagging, predicting grammatical features (POS tags, case, number, tense, etc.) for each token in a sentence.
|
| 25 |
+
|
| 26 |
+
Kyrgyz is an agglutinative language with rich morphology, making morphological analysis particularly challenging and valuable for downstream NLP tasks.
|
| 27 |
+
|
| 28 |
+
## Performance
|
| 29 |
+
|
| 30 |
+
| Model | Accuracy |
|
| 31 |
+
|-------|----------|
|
| 32 |
+
| **BERT (fine-tuned)** | **~80%** |
|
| 33 |
+
| Logistic Regression (baseline) | β |
|
| 34 |
+
|
| 35 |
+
<!-- π§ TODO: Add baseline accuracy if available -->
|
| 36 |
+
|
| 37 |
+
## Intended Use
|
| 38 |
+
|
| 39 |
+
| Use Case | Description |
|
| 40 |
+
|----------|-------------|
|
| 41 |
+
| **Kyrgyz NLP pipeline** | Morphological preprocessing for machine translation, text analysis |
|
| 42 |
+
| **Linguistic research** | Studying Kyrgyz grammar and morphological patterns |
|
| 43 |
+
| **Education** | Teaching Kyrgyz morphology with automated analysis |
|
| 44 |
+
| **Downstream tasks** | Improving NER, dependency parsing, and sentiment analysis for Kyrgyz |
|
| 45 |
+
|
| 46 |
+
## Training Details
|
| 47 |
+
|
| 48 |
+
### Dataset
|
| 49 |
+
|
| 50 |
+
- **Format:** CSV with morphological annotations
|
| 51 |
+
- **Train set:** `train_fixed.csv`
|
| 52 |
+
- **Test set:** `test_fixed.csv`
|
| 53 |
+
- **Tag set:** Defined in `TAG.docx` (morphological tag inventory)
|
| 54 |
+
|
| 55 |
+
### Architecture
|
| 56 |
+
|
| 57 |
+
- **Base model:** BERT (fine-tuned for token classification)
|
| 58 |
+
- **Custom variant:** `bert_model_variant.py`
|
| 59 |
+
- **Baseline:** Logistic Regression (`logistic_regression.ipynb`)
|
| 60 |
+
|
| 61 |
+
### Framework
|
| 62 |
+
|
| 63 |
+
- Python 3.10+
|
| 64 |
+
- PyTorch / Transformers (HuggingFace)
|
| 65 |
+
|
| 66 |
+
## Repository Structure
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
βββ bert_model_variant.py # Custom BERT model architecture
|
| 70 |
+
βββ train.py # Training script
|
| 71 |
+
βββ dev.py # Evaluation script
|
| 72 |
+
βββ dev.ipynb # Development notebook
|
| 73 |
+
βββ logistic_regression.ipynb # Baseline model
|
| 74 |
+
βββ train_fixed.csv # Training data
|
| 75 |
+
βββ test_fixed.csv # Test data
|
| 76 |
+
βββ TAG.docx # Morphological tag definitions
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## How to Use
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
# Load and run inference
|
| 83 |
+
from bert_model_variant import MorphAnalyzer # adjust import as needed
|
| 84 |
+
|
| 85 |
+
# Example: Analyze Kyrgyz text
|
| 86 |
+
text = "ΠΡΡΠ³ΡΠ·ΡΡΠ°Π½ β ΠΊΠΎΠΎΠ· Σ©Π»ΠΊΣ©"
|
| 87 |
+
# See train.py and dev.py for full inference pipeline
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
<!-- π§ TODO: Add a more complete inference example -->
|
| 91 |
+
|
| 92 |
+
## Why This Matters
|
| 93 |
+
|
| 94 |
+
Kyrgyz is an **underrepresented language** in NLP. Most morphological analyzers exist only for high-resource languages. This model contributes to:
|
| 95 |
+
|
| 96 |
+
- Building foundational NLP tools for the Kyrgyz language
|
| 97 |
+
- Enabling more complex downstream applications (MT, QA, summarization)
|
| 98 |
+
- Preserving and digitizing Kyrgyz linguistic knowledge
|
| 99 |
+
|
| 100 |
+
## Limitations
|
| 101 |
+
|
| 102 |
+
- Accuracy of ~80% means roughly 1 in 5 tokens may be mistagged
|
| 103 |
+
- Performance may vary across different text domains and registers
|
| 104 |
+
- Limited to the morphological tag set defined in `TAG.docx`
|
| 105 |
+
|
| 106 |
+
## Citation
|
| 107 |
+
|
| 108 |
+
```bibtex
|
| 109 |
+
@misc{kyrgyz_morph_2023,
|
| 110 |
+
author = {Zarina},
|
| 111 |
+
title = {BERT-based Morphological Analyzer for Kyrgyz Language},
|
| 112 |
+
year = {2023},
|
| 113 |
+
url = {https://huggingface.co/Zarinaaa/morphological_analysis}
|
| 114 |
+
}
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## Author
|
| 118 |
+
|
| 119 |
+
**Zarina** β ML Engineer specializing in NLP and Speech Technologies for low-resource languages.
|
| 120 |
+
|
| 121 |
+
- π€ [HuggingFace](https://huggingface.co/Zarinaaa)
|
| 122 |
+
- πΌ [LinkedIn](https://linkedin.com/in/YOUR_LINKEDIN)
|