Skip to main content

Latin vocabulary list builder powered by LatinCy spaCy ecosystem

Project description

LatinCy Vocab

PyPI version Python versions License: MIT Ruff

Latin vocabulary list builder powered by LatinCy models/tools/datasets.

latincy-vocab takes Latin text, runs it through a LatinCy spaCy model, and returns structured vocabulary lists. Citation forms (principal parts, gender, etc.), POS markers, and dictionary glosses are sourced from latincy-lexicon (Whitaker's Words); latincy-vocab is the formatting and aggregation layer over it. Output can be sorted by frequency, reading order, or alphabetically, and exported as JSON or Markdown.

Beta release (v0.1.0). The API is functional but may change.

Installation

pip install latincy-vocab

You also need a LatinCy spaCy model. latincy-vocab defaults to la_core_web_lg (best accuracy for citation forms and lemmatization):

pip install "https://huggingface.co/latincy/la_core_web_lg/resolve/main/la_core_web_lg-3.9.4-py3-none-any.whl"

A lighter la_core_web_sm is also available (swap lgsm in the URL); set PipelineConfig(spacy_model="la_core_web_sm") to use it.

Glosses and citation forms come from latincy-lexicon (Whitaker's Words), which is installed automatically as a dependency — no extra data files, environment variables, or sibling directories required.

Usage

from vocabbuilder import VocabPipeline

pipeline = VocabPipeline()

text = "agricolae in villa laborant et aquam portant"
vocab = pipeline.process(text)

# Reading order (first occurrence)
for entry in vocab.by_first_occurrence():
    print(entry.formatted())

Example output:

agricola, agricolae, m., farmer, cultivator, gardener, agriculturist
in, prep., in, on, at (space)
villa, villae, f., farm/country home/estate
laboro, laborare, laboravi, laboratum, v., work, labor
et, conj., and, and even
aqua, aquae, f., water
porto, portare, portavi, portatum, v., carry, bring

Sorting

vocab.by_frequency()       # most common first
vocab.by_alpha()           # alphabetical by lemma
vocab.by_first_occurrence() # reading order

Filtering

vocab.filter_pos({"NOUN", "VERB"})   # nouns and verbs only
vocab.filter_min_frequency(2)         # words appearing ≥ 2 times

Export

# Markdown glossary
print(vocab.to_markdown())

# JSON (all fields)
print(vocab.to_json())

Entry fields

Each VocabEntry exposes:

Field Description
headword Citation form (principal parts / nom+gen+gender) or display lemma
pos_marker Abbreviated POS tag (v., adj., adv., etc.) — empty for nouns (gender in citation)
short_gloss Trimmed gloss (up to 3 senses)
full_gloss All senses joined
frequency Count across the input text
forms_seen Set of inflected forms observed

Configuration

from vocabbuilder import VocabPipeline, PipelineConfig

config = PipelineConfig(
    spacy_model="la_core_web_lg",  # default; lighter: "la_core_web_sm"
    min_frequency=2,               # drop words seen only once
)
pipeline = VocabPipeline(config)

Related packages

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latincy_vocab-0.1.0.tar.gz (134.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latincy_vocab-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file latincy_vocab-0.1.0.tar.gz.

File metadata

  • Download URL: latincy_vocab-0.1.0.tar.gz
  • Upload date:
  • Size: 134.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for latincy_vocab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 096a57875d487584822628b4a50d76e574e5b9adaa4f2e6214a74a93923937fe
MD5 0a74abf546fd3048f60621d5f3fb1fe8
BLAKE2b-256 89a7d19fa87df2fae1b763d3f0d79308f3fe76313f5edf533776ce2123a19782

See more details on using hashes here.

File details

Details for the file latincy_vocab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: latincy_vocab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for latincy_vocab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 737ee0dd977d5f9951e12347e4c6dc9cb36a6d4a26db8386b8823f486ce4198e
MD5 f70b0810d213d8881c7b2e3e040d96e7
BLAKE2b-256 0aba8b86f4cd23c8011020cdeaaf5ce282ecafdded987ac28d6754bcf9bcafe8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page