Downloads · 30 days
0
JesseHuang922/lv_spacy_cnn_5pct
lv_spacy_cnn_5pct is a machine learning model from JesseHuang922. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-sa-4.0.
https://github.com/JesseLau24/FengdiHuangMasterThesisRepo
Downloads · 30 days
0
Access
Public
Updated Dec 9, 2025
Repo size
8.5 MB
Likes
0
Public
Click a slice to open those files.
Other8.6 MB · 92%
From the Hugging Face model README
https://github.com/JesseLau24/Fengdi_Huang_Master_Thesis_Repo
This is a spaCy pipeline for Latvian, built with the spaCy Tok2Vec CNN backbone.
It includes the following components:
Model type: spaCy CNN Pipeline
Language: Latvian (lv)
Recommended hardware: CPU for small-scale use, GPU recommended for faster inference.
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).
Special Thanks to all contributors who participated in the Beta test and espically those who provided valuable feedback
This model is released under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0).
You are free to:
Under the following terms:
You can:
Download the model directly from the Hugging Face Hub
Using huggingface_hub.snapshot_download, the model files will be automatically fetched and cached locally.
```python
import spacy
from huggingface_hub import snapshot_download
# Load the pipeline
model_dir = snapshot_download(repo_id="JesseHuang922/lv_spacy_cnn_5pct", repo_type="model")
nlp = spacy.load(model_dir)
```
The following Python packages are required to run the Latvian spaCy pipeline:
| Package | Minimum Version | Notes |
|---|---|---|
| spaCy | 3.8.7 | Main NLP framework |
| spacy-transformers | 1.3.9 | Integrates spaCy with Hugging Face Transformers |
| transformers | 4.49.0 | Hugging Face Transformers library |
| torch | 2.8.0 | PyTorch backend for transformers |
| tokenizers | 0.21.4 | Fast tokenizer support |
| safetensors | 0.6.2 | Secure tensor storage for transformer weights |
| huggingface-hub | 0.34.4 | Download and manage the model files from the Hugging Face Hub |
| Package | Minimum Version | Notes |
|---|---|---|
| hf-xet | 1.1.10 | if you need to download or upload large files from the Hugging Face Hub and use the Xet storage backend |
pip install \
spacy>=3.8.7 \
spacy-transformers>=1.3.9 \
transformers>=4.49.0 \
torch>=2.8.0 \
tokenizers>=0.21.4 \
safetensors>=0.6.2 \
huggingface-hub>=0.34.4 \
hf-xet>=1.1.10
import spacy
import numpy as np
from huggingface_hub import snapshot_download
# Load the pipeline
model_dir = snapshot_download(repo_id="JesseHuang922/lv_spacy_cnn_5pct", repo_type="model")
nlp = spacy.load(model_dir)
# Example text
text = """Baltijas jūras nosaukums ir devis nosaukumu baltu valodām un Baltijas valstīm.
Terminu "Baltijas jūra" (Mare Balticum) pirmoreiz lietoja vācu hronists Brēmenes Ādams 11. gadsimtā."""
# Process text
doc = nlp(text)
# ------------------------
# Tokenization
# ------------------------
print("Tokens:")
print([token.text for token in doc])
# ------------------------
# Lemmatization
# ------------------------
print("Lemmas:")
print([token.lemma_ for token in doc])
# ------------------------
# Part-of-Speech Tagging
# ------------------------
print("POS tags:")
for token in doc:
print(f"{token.text}: {token.pos_} ({token.tag_})")
# ------------------------
# Morphological Features
# ------------------------
print("Morphological features:")
for token in doc:
print(f"{token.text}: {token.morph}")
# ------------------------
# Dependency Parsing
# ------------------------
print("Dependency parsing:")
for token in doc:
print(f"{token.text} <--{token.dep_}-- {token.head.text}")
# ------------------------
# Sentence Segmentation
# ------------------------
print("Sentences:")
for sent in doc.sents:
print(sent.text)
# ------------------------
# Check Pipeline Components
# ------------------------
print("Pipeline components:")
print(nlp.pipe_names)
# Transformer vectors
vectors = np.vstack([token.vector for token in doc])
print("Token vectors shape:", vectors.shape)