Instructions to use latincy/la_vectors_floret_lg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use latincy/la_vectors_floret_lg with spaCy:
!pip install https://huggingface.co/latincy/la_vectors_floret_lg/resolve/main/la_vectors_floret_lg-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("la_vectors_floret_lg") # Importing as module. import la_vectors_floret_lg nlp = la_vectors_floret_lg.load() - Notebooks
- Google Colab
- Kaggle
v3.10.0: floret lg vectors retrained on v3.10 corpus; updated model card (model files + README)
347c1d9 verified | language: | |
| - la | |
| license: mit | |
| library_name: spacy | |
| tags: | |
| - spacy | |
| - floret | |
| - word-vectors | |
| - latin | |
| - nlp | |
| # la_vectors_floret_lg | |
| Floret word vectors for Latin (large, 200k hash buckets, 300 dimensions). | |
| Part of the [LatinCy](https://github.com/diyclassics/latincy) project β pretrained NLP pipelines for Latin. | |
| ## Overview | |
| | Feature | Value | | |
| |---------|-------| | |
| | **Type** | Floret (hash-based subword embeddings) | | |
| | **Dimensions** | 300 | | |
| | **Hash buckets** | 200,000 | | |
| | **Algorithm** | CBOW | | |
| | **Language** | Latin (`la`) | | |
| | **spaCy version** | `>=3.8.11,<3.9.0` | | |
| | **License** | MIT | | |
| 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. The large variant uses 200k hash buckets (vs 50k for medium), reducing hash collisions for finer-grained distinctions. | |
| ## Installation | |
| ```bash | |
| pip install https://huggingface.co/latincy/la_vectors_floret_lg/resolve/main/la_vectors_floret_lg-3.10.0-py3-none-any.whl | |
| ``` | |
| ## Usage | |
| ```python | |
| import spacy | |
| nlp = spacy.load("la_vectors_floret_lg") | |
| # 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_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. | |
| | Model | Analogy Rank 1 | Analogy Rank 5 | Odd-One-Out | | |
| |-------|---------------|---------------|-------------| | |
| | FastText CBOW-300-10 | **76.2%** | **91.5%** | 70.3% | | |
| | **Floret (lg)** | 74.3% | 89.7% | 68.5% | | |
| | Floret (md) | 73.4% | 88.2% | 65.7% | | |
| | Word2Vec CBOW-300-10 | 42.3% | 71.0% | **77.3%** | | |
| | GloVe 300 | 16.3% | 34.1% | 66.4% | | |
| Floret is competitive with FastText on analogies while being 6x 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: | |
| | Source | Description | | |
| |--------|-------------| | |
| | CC100-Latin | Web-crawled Latin text (deduplicated and filtered) | | |
| | Latin Wikisource | General Latin texts | | |
| | Latin Wikipedia | Latin Wikipedia articles | | |
| | The Latin Library | General Latin texts | | |
| | Patrologia Latina | Patristic texts | | |
| | CAMENA Neo-Latin | Early modern Latin texts | | |
| | CLTK-Tesserae Latin | Classical texts | | |
| | Perseus Digital Library | Classical texts | | |
| | CSEL | Corpus Scriptorum Ecclesiasticorum Latinorum (patristic) | | |
| | digilibLT | Late-antique Latin texts | | |
| | UD + LASLA treebanks | Annotated treebank sentences | | |
| | Formulae | Early medieval legal formulae | | |
| | EDH | Epigraphic Database Heidelberg (inscriptions) | | |
| | Epistolae | Medieval Latin letters | | |
| | PTA | Patristic Text Archive | | |
| ### Parameters | |
| | Parameter | Value | | |
| |-----------|-------| | |
| | Algorithm | CBOW | | |
| | Dimensions | 300 | | |
| | Subword n-gram range | 3β6 | | |
| | Hash buckets | 200,000 | | |
| | Epochs | 15 | | |
| | Negative sampling | 25 | | |
| | Min count | 50 | | |
| | Learning rate | 0.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 | |
| - [la_vectors_floret_md](https://huggingface.co/latincy/la_vectors_floret_md) β Medium vectors (50k buckets) | |
| - [LatinCy pipelines](https://huggingface.co/latincy) β Latin NLP pipelines for [spaCy](https://spacy.io/) using these vectors | |
| ## 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. | |