Verba v0.4.0 Verba.Decline
Link to this section Summary
Functions
Returns whether or not two graphemes form a diphthong in Classical Latin
This function attempts to determine whether a passed in third declension noun or adjective is a pure i-stem. The rules checked against are from Wheelock's Latin and are as follows
This function attempts to determine whether a passed in third declension noun or adjective is a mixed i-stem. The rules checked against are from Wheelock's Latin and are as follows
Normalizes a declension into Unicode composed form
Returns the number of syllables in a Latin word
Returns whether or not a grapheme is a vowel
Link to this section Types
grammatical_case()
grammatical_case() ::
:nominative
| :genitive
| :dative
| :accusative
| :ablative
| :vocative
| :locative
grammatical_case() :: :nominative | :genitive | :dative | :accusative | :ablative | :vocative | :locative
grammatical_gender()
grammatical_gender() :: :masculine | :feminine | :neuter
grammatical_gender() :: :masculine | :feminine | :neuter
grammatical_number()
grammatical_number() :: :singular | :plural
grammatical_number() :: :singular | :plural
Link to this section Functions
diphthong?(first, second)
diphthong?(String.grapheme(), String.grapheme()) :: boolean()
diphthong?(String.grapheme(), String.grapheme()) :: boolean()
Returns whether or not two graphemes form a diphthong in Classical Latin.
Example
iex> import Verba.Decline
iex> diphthong?("a", "e")
true
iex> diphthong?("a", "o")
false
i_stem?(nom, gen, stem, gender)
i_stem?(String.t(), String.t(), String.t(), grammatical_gender()) :: boolean()
i_stem?(String.t(), String.t(), String.t(), grammatical_gender()) :: boolean()
i_stem_parisyllabic?(nom, gen, gender)
i_stem_parisyllabic?(String.t(), String.t(), grammatical_gender()) :: boolean()
i_stem_parisyllabic?(String.t(), String.t(), grammatical_gender()) :: boolean()
This function attempts to determine whether a passed in third declension noun or adjective is a pure i-stem. The rules checked against are from Wheelock's Latin and are as follows:
Masculine and feminine nouns and adjectives that end in -is or -es that have the same number of syllables in both their nominative and genitive forms.
Neuter nouns and adjectives that end in -al, -ar, or -e.
Warning
This function likely won't be 100 percent accurate. Human language is always vague. If this function ends up providing more false positives than I'm comfortable with, I will likely decricate it and instead store whether or not a noun or adjective is an i-stem in the word database. Don't depend on this function too much as it may go away.
i_stem_two_consonant_ending?(nom, stem, gender)
i_stem_two_consonant_ending?(String.t(), String.t(), grammatical_gender()) ::
boolean()
i_stem_two_consonant_ending?(String.t(), String.t(), grammatical_gender()) :: boolean()
This function attempts to determine whether a passed in third declension noun or adjective is a mixed i-stem. The rules checked against are from Wheelock's Latin and are as follows:
- Masculine and feminine nouns and adjectives that end in -s or -x with a stem ending in two consonants.
Warning
This function likely won't be 100 percent accurate. Human language is always vague. If this function ends up providing more false positives than I'm comfortable with, I will likely depricate it and instead store whether or not a noun or adjective is an i-stem in the word database. Don't depend on this function too much as it may go away.
ius_ending?(nominative)
normalize_declension(declension)
Normalizes a declension into Unicode composed form.
Declensions can either refer to a list of strings (for example, the singular
nominative and genitive forms of a noun passed into Verba.Noun.regular
) or
a Map containing either lists of strings or nested Maps that ultimately
contain lists of strings (for example, the Map of irregular declined forms
passed to Verba.Noun.irregular
).
Examples
When called with a list of strings, this function returns a list of Unicode normalized composed form strings.
iex> bellum = Verba.Decline.normalize_declension(["bellum", "bellī"])
["bellum", "bellī"]
iex> Enum.at(bellum, 0) == :unicode.characters_to_nfc_binary("bellum")
true
iex> Enum.at(bellum, 1) == :unicode.characters_to_nfc_binary("bellī")
true
When called with a Map ultimately containing lists of strings, this function returns an equivalent map with all of the strings in Unicode normalization composed form.
iex> porta = %{singular: %{nominative: ["porta"], genitive: ["portae"]}, plural: %{accusative: ["portās"], genitive: ["portārum"]}}
%{
plural: %{accusative: ["portās"], genitive: ["portārum"]},
singular: %{genitive: ["portae"], nominative: ["porta"]}
}
iex> normalized = Verba.Decline.normalize_declension(porta)
%{
plural: %{accusative: ["portās"], genitive: ["portārum"]},
singular: %{genitive: ["portae"], nominative: ["porta"]}
}
iex> Enum.at(Map.get(normalized.singular, :nominative), 0) == :unicode.characters_to_nfc_binary("porta")
true
iex> Enum.at(Map.get(normalized.singular, :genitive), 0) == :unicode.characters_to_nfc_binary("portae")
true
iex> Enum.at(Map.get(normalized.plural, :accusative), 0) == :unicode.characters_to_nfc_binary("portās")
true
iex> Enum.at(Map.get(normalized.plural, :genitive), 0) == :unicode.characters_to_nfc_binary("portārum")
true
r_ending?(nominative)
syllables(word)
Returns the number of syllables in a Latin word.
Example
iex> import Verba.Decline
iex> syllables("animalia")
5
iex> syllables("saepe")
2
vowel?(grapheme)
vowel?(String.grapheme()) :: boolean()
vowel?(String.grapheme()) :: boolean()
Returns whether or not a grapheme is a vowel.
##Example
iex> import Verba.Decline
iex> vowel?("a")
true
iex> vowel?("ō")
true
iex> vowel?("s")
false