CoolFace
Modelpublic

latincy/la_vectors_floret_md

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes68downloads
Model Card

lavectorsfloret_md

Floret word vectors for Latin (medium, 50k hash buckets, 300 dimensions).

Part of the LatinCy project — pretrained NLP pipelines for Latin.

Overview

FeatureValue
TypeFloret (hash-based subword embeddings)
Dimensions300
Hash buckets50,000
AlgorithmCBOW
LanguageLatin (la)
spaCy version>=3.8.11,<3.9.0
LicenseMIT

Floret vectors use hash-based subword embeddings, meaning every word gets a vector — there are no out-of-vocabulary words. This is especially important for morphologically rich languages like Latin.

Installation

bash
pip install https://huggingface.co/latincy/la_vectors_floret_md/resolve/main/la_vectors_floret_md-3.10.0-py3-none-any.whl

Usage

python
import spacy

nlp = spacy.load("la_vectors_floret_md")

# Get word vectors
doc = nlp("rex populum regit")
for token in doc:
    print(token.text, token.vector[:5])

# Compute similarity
doc1 = nlp("bellum")
doc2 = nlp("pugna")
print(doc1.similarity(doc2))

These vectors are primarily intended as a component in LatinCy pipelines (la_core_web_md, la_core_web_lg), but can also be used standalone.

Evaluation

All methods were trained on the same v3.10 corpus and scored on the same benchmark (v0.2: 1,545 analogy items, 1,285 odd-one-out items).

Note: v0.2 is a development benchmark, not a finalized release benchmark — these numbers are for cross-method comparison and may change.
ModelAnalogy Rank 1Analogy Rank 5Odd-One-Out
FastText CBOW-300-1076.2%91.5%70.3%
Floret (lg)74.3%89.7%68.5%
Floret (md)73.4%88.2%65.7%
Word2Vec CBOW-300-1042.3%71.0%77.3%
GloVe 30016.3%34.1%66.4%

The md vectors (50k buckets) trade a small amount of accuracy for ~4x smaller size versus lg (200k buckets). Floret is competitive with FastText on analogies while being much smaller and supporting arbitrary vocabulary, which is why we have chosen to use the Floret vectors for pipeline training.

Training

Corpus

Trained on 14.3M sentences (278M tokens) from 15 sources:

SourceDescription
CC100-LatinWeb-crawled Latin text (deduplicated and filtered)
Latin WikisourceGeneral Latin texts
Latin WikipediaLatin Wikipedia articles
The Latin LibraryGeneral Latin texts
Patrologia LatinaPatristic texts
CAMENA Neo-LatinEarly modern Latin texts
CLTK-Tesserae LatinClassical texts
Perseus Digital LibraryClassical texts
CSELCorpus Scriptorum Ecclesiasticorum Latinorum (patristic)
digilibLTLate-antique Latin texts
UD + LASLA treebanksAnnotated treebank sentences
FormulaeEarly medieval legal formulae
EDHEpigraphic Database Heidelberg (inscriptions)
EpistolaeMedieval Latin letters
PTAPatristic Text Archive

Parameters

ParameterValue
AlgorithmCBOW
Dimensions300
Subword n-gram range3–6
Hash buckets50,000
Epochs15
Negative sampling25
Min count50
Learning rate0.05

Training followed Sprugnoli et al. 2019 for epoch count and negative sampling parameters.

Citation

If you use these vectors, please cite this preprint:

bibtex
@misc{burns2023latincy,
    title = "{LatinCy}: Synthetic Trained Pipelines for {L}atin {NLP}",
    author = "Burns, Patrick J.",
    year = "2023",
    eprint = "2305.04365",
    archivePrefix = "arXiv",
    primaryClass = "cs.CL",
    url = "https://arxiv.org/abs/2305.04365"
}

See also

References

  • —Sprugnoli, R., Passarotti, M., and Moretti, G. 2019. “Vir Is to Moderatus as Mulier Is to Intemperans Lemma Embeddings for Latin.” In Proceedings of the Sixth Italian Conference on Computational Linguistics. Bari, Italy. 1–7. http://ceur-ws.org/Vol-2481/paper69.pdf.