Uzbek Dependency Parsing: Model Weights

Stanza taggers and parsers for Uzbek morphosyntactic tagging (UPOS, XPOS, UFeats) and Universal Dependencies (UD) parsing, trained on the two Uzbek UD treebanks with static FastText vectors or contextual BERT encoders, and two spaCy pipelines.

Code, training scripts and analysis results: https://github.com/SanatbekMatlatipov/robust-parsing-uzbek


Model files

Taggers and parsers

Each parser is paired with a tagger trained in the same configuration.

Model Tagger Parser Word vectors Subword aggregation Training data
E1.1 saved_models/pos/uz_uzudt_E1_tagger.pt saved_models/depparse/uz_uzudt_E1.1_parser.pt FastText β€” UzUDT
E2.1 saved_models/pos/uz_uzudt_E2.1_tagger.pt saved_models/depparse/uz_uzudt_E2.1_parser.pt TahrirchiBERT last piece UzUDT
E3.1 saved_models/pos/uz_uzudt_E3.1_tagger.pt saved_models/depparse/uz_uzudt_E3.1_parser.pt TahrirchiBERT mean UzUDT
E5.1 saved_models/pos/uz_uzudt_E5.1_tagger.pt saved_models/depparse/uz_uzudt_E5.1_parser.pt BERTbek mean UzUDT
E1.2 saved_models/pos/uz_combined_E1.2_tagger.pt saved_models/depparse/uz_combined_E1.2_parser.pt FastText β€” UzUDT + UT
E2.2 saved_models/pos/uz_combined_E2.2_tagger.pt saved_models/depparse/uz_combined_E2.2_parser.pt TahrirchiBERT last piece UzUDT + UT
E3.2 saved_models/pos/uz_combined_E3.2_tagger.pt saved_models/depparse/uz_combined_E3.2_parser.pt TahrirchiBERT mean UzUDT + UT

Encoders: TahrirchiBERT = tahrirchi/tahrirchi-bert-base, BERTbek = elmurod1202/bertbek-news-big-cased.

Additional checkpoints

File Description
saved_models/tokenize/uz_uzudt_tokenizer.pt tokenizer trained on UzUDT
saved_models/pos/uz_uzudt-base_tagger.pt tagger with XLM-RoBERTa base, UzUDT
saved_models/pos/uz_uzudt_E5.1.1_tagger.pt tagger with BERTbek (mean), UT
saved_models/depparse/uz_uzudt_nocharlm_parser.pt parser with FastText vectors in the default Stanza configuration, UzUDT
uz_uzudt-base_tagger.pt, uz_uzudt_nocharlm_parser.pt, uz_uzudt_tokenizer.pt copies of the files above at the repository root
uz_uzudt_nocharlm_parser_checkpoint.pt training checkpoint of the FastText parser

spaCy pipelines (saved_models/spacy/)

Directory-format spaCy pipelines with TahrirchiBERT that jointly predict UPOS, morphological features and dependencies.

Directory Training data
saved_models/spacy/transformer_uzudt/model-best/ UzUDT
saved_models/spacy/transformer_combined/model-best/ UzUDT + UT

model-best is the checkpoint with the highest development score during training.


Evaluation results

Test sets: 176 UzUDT sentences (1843 words) without exact or near duplicates in any training or development file, and 137 UT sentences (1421 words). Trees are decoded exactly with a single root; tags are predicted by the paired tagger (pred.) or taken from the gold annotation (gold). Scores in %, computed with the UD shared-task evaluation script.

Model UzUDT UPOS UzUDT UAS UzUDT LAS UzUDT LAS (gold tags) UT UPOS UT UAS UT LAS UT LAS (gold tags)
E1.1 83.99 67.39 49.38 54.91 77.90 59.32 41.17 43.49
E2.1 86.81 71.03 53.07 58.11 82.27 60.52 43.98 46.73
E3.1 85.62 71.68 53.01 57.84 80.72 59.39 42.15 46.09
E5.1 85.35 73.03 54.64 60.28 82.34 63.55 47.71 51.94
E1.2 85.40 69.02 51.38 57.51 85.22 63.76 50.60 57.28
E2.2 87.30 73.09 56.00 60.44 86.91 67.91 53.84 59.32
E3.2 86.65 73.03 54.86 60.07 86.07 65.94 51.23 60.10

E2.2 (TahrirchiBERT, last piece, UzUDT + UT) is the recommended model. Every number is reproduced by the scripts and result files in analysis/ of the code repository.

spaCy pipelines, spacy evaluate on the test file of their training split:

Pipeline UPOS XPOS Morph. features UAS LAS
transformer_uzudt 86.50 86.72 50.55 67.72 45.35
transformer_combined 89.18 88.24 65.48 66.81 47.11

How to use

1. Code and environment

git clone https://github.com/SanatbekMatlatipov/robust-parsing-uzbek.git
cd robust-parsing-uzbek
python -m venv .venv && source .venv/bin/activate     # Windows: .venv\Scripts\activate
pip install -U pip
pip install -r requirements.txt
pip install -e stanza/

2. Download the models

from huggingface_hub import snapshot_download

snapshot_download(repo_id="Sanatbek/uzudt", repo_type="model", local_dir=".",
                  ignore_patterns=["*.md", ".gitattributes"])

A single file:

from huggingface_hub import hf_hub_download

hf_hub_download(repo_id="Sanatbek/uzudt", filename="saved_models/pos/uz_combined_E2.2_tagger.pt", local_dir=".")

3. Tag and parse

python scripts/parse_test_with_depparse.py \
  --tagger_model saved_models/pos/uz_combined_E2.2_tagger.pt \
  --parser_model saved_models/depparse/uz_combined_E2.2_parser.pt \
  --bert_model tahrirchi/tahrirchi-bert-base \
  --input_file data/depparse/uz_uzudt.test.in.conllu \
  --output_file output.conllu

For the FastText models (E1.1, E1.2), replace --bert_model ... by --wordvec_pretrain_file wordvec/uz/pretrain/fasttext_cc_uz_300.pt. Tagging only: python scripts/parse_test_pos_only.py --tagger_model ... --input_file ... --output_file ....

4. Evaluate

python scripts/eval.py data/depparse/uz_uzudt.test.in.conllu output.conllu      # UAS, LAS, CLAS, MLAS, BLEX
python scripts/eval_pos.py --gold data/pos/uz_uzudt.test.in.conllu --system output.conllu

spaCy pipelines

pip install spacy spacy-transformers
pip install -e spacy_uzbek/          # Uzbek language class for spaCy
from huggingface_hub import snapshot_download
snapshot_download(repo_id="Sanatbek/uzudt", repo_type="model", local_dir=".", allow_patterns=["saved_models/spacy/**"])

import spacy
nlp = spacy.load("saved_models/spacy/transformer_combined/model-best")
doc = nlp("Men kitob o'qiyapman.")
for token in doc:
    print(token.text, token.pos_, token.morph, token.dep_, token.head.text)

Dependencies

Package Version Purpose
Python >= 3.9 runtime
PyTorch >= 2.0 inference
transformers >= 4.35 BERT encoders
stanza local (editable) tagger and parser
spacy >= 3.8 spaCy pipelines
spacy-transformers >= 1.2 BERT in spaCy
huggingface_hub >= 0.20 model download

License

CC BY-SA 4.0.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support