-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Open Words TS is a Latin dictionary parser based off of Open Words. It provides a detailed analysis of Latin words, including definitions, parts of speech, and inflectional forms. The dictionary contains over 39000 entries, as would be counted in an ordinary dictionary. This expands to almost twice that number of individual stems and, through additional word construction with hundreds of prefixes and suffixes, may generate more, leading to many hundreds of thousands of ‘words’ that can be formed by declension and conjugation. This version of WORDS provides a tool to help in translations for the Latin student.
Open Words TS is not a standalone application, but rather a library that can be used in other applications. To search for a word, you need to use the parseLine function from the parser class.
import { Parser } from './src/parser';
const parser = new Parser();
let output: any = parser.parseLine("Sunt geminae Somni portae", "lte", true);
let jsonOutput = JSON.stringify(output, null, 2);
console.log(jsonOutput);
Output:
[{'defs': [{'orth': ['sunt'], 'senses': ['to be, exist', 'also used to form verb perfect passive tenses with NOM PERF PPL'], 'infls': [{'form': {'form': 'PRES ACTIVE IND 3 P'}, 'ending': '', 'pos': 'verb'}]}], 'word': 'sunt'}, {'defs': [{'orth': ['gemin', 'gemin'], 'senses': ['twins (pl.)'], 'infls': [{'form': {'number': 'plural', 'declension': 'nominative', 'gender': 'neuter'}, 'ending': 'a', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'vocative', 'gender': 'neuter'}, 'ending': 'a', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'accusative', 'gender': 'neuter'}, 'ending': 'a', 'pos': 'noun'}, {'form': {'voice': 'active', 'person': 2, 'tense': 'present', 'mood': 'imperative', 'number': 'singular'}, 'ending': 'a', 'pos': 'verb'}]}], 'word': 'geminae'}, {'defs': [{'orth': ['somnius', 'somni'], 'senses': ['dream, vision', 'fantasy, day-dream'], 'infls': [{'form': {'number': 'singular', 'declension': 'nominative', 'gender': ''}, 'ending': '', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'vocative', 'gender': ''}, 'ending': '', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'genitive', 'gender': ''}, 'ending': '', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'vocative', 'gender': 'masculine'}, 'ending': '', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'genitive', 'gender': 'masculine'}, 'ending': '', 'pos': 'noun'}]}, {'orth': ['somnos', 'somni'], 'senses': ['sleep'], 'infls': [{'form': {'number': 'singular', 'declension': 'genitive', 'gender': ''}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'locative', 'gender': ''}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'nominative', 'gender': 'C'}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'vocative', 'gender': 'C'}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'genitive', 'gender': 'neuter'}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'genitive', 'gender': 'masculine'}, 'ending': 'i', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'genitive', 'gender': 'C'}, 'ending': 'i', 'pos': 'noun'}]}], 'word': 'somni'}, {'defs': [{'orth': ['porta', 'portae'], 'senses': ['gate, entrance', 'city gates', 'door', 'avenue', 'goal (soccer)'], 'infls': [{'form': {'number': 'singular', 'declension': 'genitive', 'gender': 'C'}, 'ending': 'ae', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'locative', 'gender': 'C'}, 'ending': 'ae', 'pos': 'noun'}, {'form': {'number': 'singular', 'declension': 'dative', 'gender': 'C'}, 'ending': 'ae', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'nominative', 'gender': 'C'}, 'ending': 'ae', 'pos': 'noun'}, {'form': {'number': 'plural', 'declension': 'vocative', 'gender': 'C'}, 'ending': 'ae', 'pos': 'noun'}]}], 'word': 'portae'}]
Additionally a hosted version of Open Words can be found on Learning Latin.
- Filter the results more, to prevent irrelevant results.
- Handel macrons (macrons should be replaced with corresponding normal letter).
- Improve the dictionary loops from O(n).
- Create types / interfaces for everything.