Model type: spaCy CNN Pipeline
Language: Latvian (lv) Recommended hardware: CPU for small-scale use, GPU recommended for faster inference.
Training Data
The model was trained on the Latvian UD Treebank v2.16, which is derived from the Latvian Treebank (LVTB) created at the University of Latvia, Institute of Mathematics and Computer Science, Artificial Intelligence Laboratory (AI Lab).
Share — copy and redistribute the material in any medium or format, for any purpose, even commercially.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
References
Pretkalniņa, L., Rituma, L., Saulīte, B., et al. (2016–2025). Universal Dependencies Latvian Treebank (LVTB).
Grūzītis, N., Znotiņš, A., Nešpore-Bērzkalne, G., Paikens, P., et al. (2018). Creation of a Balanced State-of-the-Art Multilayer Corpus for NLU. LREC 2018.
Pretkalniņa, L., Rituma, L., Saulīte, B. (2016). Universal Dependency Treebank for Latvian: A Pilot. Baltic Perspective Workshop.
Usage
You can either:
Download the model directly from the Hugging Face Hub
Using huggingface_hub.snapshot_download, the model files will be automatically fetched and cached locally.
Install from the pre-built wheel package
Download the wheel file (lv_spacy_cnn-1.0.0-py3-none-any.whl) and install it into your virtual environment with:
1import spacy
2import numpy as np
3from huggingface_hub import snapshot_download
45# Load the pipeline6model_dir = snapshot_download(repo_id="JesseHuang922/lv_spaCy_CNN", repo_type="model")7nlp = spacy.load(model_dir)89# Example text10text ="""Baltijas jūras nosaukums ir devis nosaukumu baltu valodām un Baltijas valstīm.
11Terminu "Baltijas jūra" (Mare Balticum) pirmoreiz lietoja vācu hronists Brēmenes Ādams 11. gadsimtā."""1213# Process text14doc = nlp(text)1516# ------------------------17# Tokenization 18# ------------------------19print("Tokens:")20print([token.text for token in doc])2122# ------------------------23# Lemmatization24# ------------------------25print("Lemmas:")26print([token.lemma_ for token in doc])2728# ------------------------29# Part-of-Speech Tagging30# ------------------------31print("POS tags:")32for token in doc:33print(f"{token.text}: {token.pos_} ({token.tag_})")3435# ------------------------36# Morphological Features37# ------------------------38print("Morphological features:")39for token in doc:40print(f"{token.text}: {token.morph}")4142# ------------------------43# Dependency Parsing44# ------------------------45print("Dependency parsing:")46for token in doc:47print(f"{token.text} <--{token.dep_}-- {token.head.text}")4849# ------------------------50# Sentence Segmentation51# ------------------------52print("Sentences:")53for sent in doc.sents:54print(sent.text)5556# ------------------------57# Check Pipeline Components58# ------------------------59print("Pipeline components:")60print(nlp.pipe_names)6162# Transformer vectors63vectors = np.vstack([token.vector for token in doc])64print("Token vectors shape:", vectors.shape)