Skip to content

Commit

Permalink
made some small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cqb13 committed Sep 20, 2024
1 parent f52a633 commit 4e8b363
Show file tree
Hide file tree
Showing 4 changed files with 494 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/translators/latin_to_english/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ use crate::translators::latin_to_english::LatinTranslationInfo;
use crate::utils::data::{get_latin_inflections, get_latin_stems, get_unique_latin_words};

pub fn parse(latin_word: &str, reduced: bool) -> Option<Vec<LatinTranslationInfo>> {
match parse_unique_latin_words(latin_word) {
Some(unique_word) => {
let mut translation = LatinTranslationInfo::new();
translation.word = unique_word;
return Some(vec![translation]);
}
None => (),
match find_form(latin_word, reduced) {
Some(form) => return Some(form),
None => match parse_unique_latin_words(latin_word) {
Some(unique_word) => {
let mut translation = LatinTranslationInfo::new();
translation.word = unique_word;
return Some(vec![translation]);
}
None => None,
},
}

find_form(latin_word, reduced)
}

fn parse_unique_latin_words(latin_word: &str) -> Option<LatinWordInfo> {
Expand Down Expand Up @@ -112,7 +113,7 @@ fn check_stems(
}
};

//???: Weird issue here where some words get inflections but should not (cur)
//TODO: Weird issue here where some words get inflections but should not (cur)
if n_from_stem.len() == 1 && n_from_stem[0] != n_from_inflection[0] {
continue;
}
Expand Down
48 changes: 48 additions & 0 deletions wiki/dictionary-data-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Dictionary Data Structure

The dictionary is a collection of JSON files, with json objects in an array.

## English Words

```json
{
"orth": "word",
"wid": 0,
"pos": "part of speech",
"frequency_type": "very frequent",
"true_frequency": 0,
"frequency": 0,
"compound": 0,
"semi": 0
}
```

orth: the word in English
wid: the id of corresponding Latin word
pos: part of speech
frequency_type: frequency of the word
true_frequency: frequency + compound - semi
frequency: frequency of the word (A=>70, B=>60, C=>50, D=>40, E=>30, F=>20)
compound: compound word (('very tall' vs. 'tall')) yes(0)/no(10)
semi: part of a meaning set off by semi-colons

## Latin Dictionary

```json
{
"orth": "latin word",
"parts": ["first part", "second part", "third part", "fourth part"],
"senses": ["meaning 1", "meaning 2", "meaning 3"],
"pos": "part of speech",
"form": "form of the word",
"info": {
"age": "when it was used",
"area": "the field in which it was used",
"geo": "the area in which it was used",
"freq": "frequency of use",
"source": "source for the word in the dictionary"
},
"n": [0, 0],
"id": 0
}
```
247 changes: 247 additions & 0 deletions wiki/dictionary-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
# Key Translations

Without any modifiers, the output will show the raw data from the dictionary. This data is not easy to read, so is translated into a more readable format. The following is a list of the translations that are used.

## Comparisons

| Key | Translation |
| :---- | :---------- |
| POS | Positive |
| COMP | Comparative |
| SUPER | Superlative |
| X | Unknown |

## Declensions

| Key | Translation |
| :-- | :---------- |
| NOM | Nominative |
| GEN | Genitive |
| DAT | Dative |
| ACC | Accusative |
| ABL | Ablative |
| VOC | Vocative |
| LOC | Locative |
| X | Unknown |

## Gender

| Key | Translation |
| :-- | :---------- |
| M | Masculine |
| F | Feminine |
| N | Neuter |
| C | Common |
| X | Unknown |

## Mood

| Key | Translation |
| :-- | :---------- |
| IND | Indicative |
| IMP | Imperative |
| SUB | Subjunctive |
| INF | Infinitive |
| X | Unknown |

## Noun

| Key | Translation |
| :-- | :---------------------- |
| S | Singular |
| P | Plural / Multiple |
| A | Abstract Idea |
| G | Group Name (ex> Romans) |
| N | Proper Name |
| P | Person |
| T | Thing |
| L | Location |
| W | Place (Where) |
| X | Unknown |

## Numeral

| Key | Translation |
| :--- | :----------- |
| CARD | Cardinal |
| ORD | Ordinal |
| Dist | Distributive |
| X | Unknown |

## Number

| Key | Translation |
| :-- | :---------- |
| S | Singular |
| P | Plural |
| X | Unknown |

## Part Of Speech

| Key | Translation |
| :----- | :------------------------ |
| N | Noun |
| V | Verb |
| VPAR | Verb Participle |
| ADJ | Adjective |
| PREP | Preposition |
| PRON | Pronoun |
| INTERJ | Interjection |
| NUM | Numeral |
| CONJ | Conjunction |
| ADV | Adverb |
| INT | Number |
| SUPINE | Supine |
| PACK | Packon (dictionary code ) |
| TACKON | Tackon (dictionary code ) |
| PREFIC | Prefix |
| SUFFIX | Suffix |

## Pronoun

| Key | Translation |
| :----- | :------------ |
| PERS | Personal |
| DEMONS | Demonstrative |
| REL | Relative |
| INTERR | Interrogative |
| INDEF | Indefinite |
| REFLEX | Reflexive |
| ADJECT | Adjective |
| X | Unknown |

## Tense

| Key | Translation |
| :--- | :------------- |
| PRES | Present |
| IMPF | Imperfect |
| FUT | Future |
| PERF | Perfect |
| PLUP | Pluperfect |
| FUTP | Future Perfect |
| INF | Infinitive |
| X | Unknown |

## Verb

| Key | Translation |
| :------- | :----------------------- |
| TO_BE | to be |
| TO_BEING | to being |
| GEN | takes genitive |
| DAT | takes dative |
| ABL | takes ablative |
| TRANS | transitive |
| INTRANS | intransitive |
| IMPERS | impersonal (it/they/god) |
| DEP | deponent |
| SEMIDEP | semi-deponent |
| PERFDEF | perfect definite |
| X | Unknown |

## Voice

| Key | Translation |
| :------ | :---------- |
| ACTIVE | Active |
| PASSIVE | Passive |
| X | Unknown |

## Age

| Key | Translation |
| :-- | :------------------- |
| A | Archaic |
| B | Early |
| C | Classical |
| D | Late |
| E | Later |
| F | Medieval |
| G | Scholar |
| H | Modern |
| X | Used throughout ages |

## Area

| Key | Translation |
| :-- | :----------- |
| A | Agriculture |
| B | Biological |
| D | Art |
| E | Religious |
| G | Grammar |
| L | Legal |
| P | Poetic |
| S | Scientific |
| T | Technical |
| W | Warfare |
| Y | Mythological |
| X | All or None |

## Geography

| Key | Translation |
| :-- | :------------- |
| A | Africa |
| B | Britain |
| C | China |
| D | Scandinavia |
| E | Egypt |
| F | France / Gaul |
| G | Germany |
| H | Greece |
| I | Italy / Rome |
| J | India |
| K | Balkans |
| N | Netherlands |
| P | Persia |
| Q | Near East |
| R | Russia |
| S | Spain / Iberia |
| U | Eastern Europe |
| X | All or None |

## Frequency

| Key | Translation |
| :-- | :------------------------------------ |
| A | Very Frequent |
| B | Frequent |
| C | Common |
| D | Lesser |
| E | Uncommon |
| F | Very Rare |
| I | Inscription |
| M | Graffiti |
| N | Pliny (only in Pliny Natural History) |
| X | All or None |

## Source

| Key | Translation |
| :-- | :------------------------------------------------------------- |
| B | C.H.Beeson, A Primer of Medieval Latin, 1925 (Bee) |
| C | Charles Beard, Cassell's Latin Dictionary 1892 (CAS) |
| D | J.N.Adams, Latin Sexual Vocabulary, 1982 (Sex) |
| E | L.F.Stelten, Dictionary of Eccles. Latin, 1995 (Ecc) |
| F | Roy J. Deferrari, Dictionary of St. Thomas Aquinas, 1960 (DeF) |
| G | Gildersleeve + Lodge, Latin Grammar 1895 (G+L) |
| H | Collatinus Dictionary by Yves Ouvrard |
| I | Leverett, F.P., Lexicon of the Latin Language, Boston 1845 |
| K | Calepinus Novus, modern Latin, by Guy Licoppe (Cal) |
| L | Lewis, C.S., Elementary Latin Dictionary 1891 |
| M | Latham, Revised Medieval Word List, 1980 |
| N | Lynn Nelson, Wordlist |
| O | Oxford Latin Dictionary, 1982 (OLD) |
| P | Souter, A Glossary of Later Latin to 600 A.D., Oxford 1949 |
| Q | Other, cited or unspecified dictionaries |
| R | Plater & White, A Grammar of the Vulgate, Oxford 1926 |
| S | Lewis and Short, A Latin Dictionary, 1879 (L+S) |
| T | Found in a translation -- no dictionary reference |
| U | Du Cange |
| V | Vademecum in opus Saxonis - Franz Blatt (Saxo) |
| W | My personal guess |
| Y | Temp special code |
| Z | Sent by user -- no dictionary reference |
| X | general |
Loading

0 comments on commit 4e8b363

Please sign in to comment.