Verba v0.4.0 Verba.Noun
Link to this section Summary
Functions
Declines a regular Latin noun for case and number
Takes a noun
or the singular genitive form of a Latin noun and returns the
declension group. In the cases of indeclinable nouns, which don't belong to a
declension group, and singular genitive forms whose declension group cannot
be determined, nil
is returned
Unlike other Latin nouns, indeclinable nouns only have one form and don't belong to a declension group
Creates an irregular Latin noun
Like irregular
this function creates an irregular Latin noun. However,
third declension nouns created with this function will decline as i-stems
instead of consonant stems
Creates a regular Latin noun
Like regular
this function creates a regular Latin noun. However, third
declension nouns created with this function will decline as i-stems instead
of consonant stems
Takes a noun
or the singular nominative and genitive forms of a Latin noun
and returns the noun's stem. If this function is called with an indeclinable
noun
or a pair of singular nominative and genitive forms whose stem cannot
be determined, nil
is returned
Link to this section Types
group()
group() :: :first | :second | :third | :fourth | :fifth
group() :: :first | :second | :third | :fourth | :fifth
Regular Latin nouns belong to one of five declension groups.
noun()
(opaque)
noun()
noun()
Link to this section Functions
decline(noun, grammatical_num, grammatical_case)
Declines a regular Latin noun for case and number.
Example
iex> {:ok, noun} = Verba.Noun.regular(["bellum"], ["bellī"], :neuter)
{:ok,
%Verba.Noun{
attr: %{},
declension: %{singular: %{genitive: ["bellī"], nominative: ["bellum"]}},
gender: :neuter
}}
iex> Verba.Noun.decline(noun, :plural, :genitive)
["bellōrum"]
group(noun)
Takes a noun
or the singular genitive form of a Latin noun and returns the
declension group. In the cases of indeclinable nouns, which don't belong to a
declension group, and singular genitive forms whose declension group cannot
be determined, nil
is returned.
Example
iex> {:ok, noun} = Verba.Noun.regular(["bellum"], ["bellī"], :neuter)
{:ok,
%Verba.Noun{
attr: %{},
declension: %{singular: %{genitive: ["bellī"], nominative: ["bellum"]}},
gender: :neuter
}}
iex> Verba.Noun.group(noun)
:second
iex> Verba.Noun.group("bellī")
:second
indeclinable(nom, gender)
Unlike other Latin nouns, indeclinable nouns only have one form and don't belong to a declension group.
Example
iex> {:ok, noun} = Verba.Noun.indeclinable(["nīl"], :neuter)
{:ok,
%Verba.Noun{
attr: %{indeclinable: nil},
declension: %{singular: %{nominative: ["nīl"]}},
gender: :neuter
}}
iex> Verba.Noun.decline(noun, :singular, :nominative)
["nīl"]
iex> Verba.Noun.decline(noun, :singular, :genitive)
["nīl"]
iex> Verba.Noun.decline(noun, :singular, :dative)
["nīl"]
iex> Verba.Noun.decline(noun, :singular, :accusative)
["nīl"]
iex> Verba.Noun.decline(noun, :singular, :ablative)
["nīl"]
iex> Verba.Noun.decline(noun, :singular, :vocative)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :nominative)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :genitive)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :dative)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :accusative)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :ablative)
["nīl"]
iex> Verba.Noun.decline(noun, :plural, :vocative)
["nīl"]
irregular(declension, gender, stem, group)
Creates an irregular Latin noun.
Latin nouns can contain declensions that do not follow the rules of any regular declension group. These nouns are, not surprisingly, referred to as irregular.
This function provides a method for creating irregular nouns. Unlike
[regular
], which takes the singular nominative and genitive forms, this
function takes a Map containing all of the irregular declined forms, the
stem, and the declension group. If a declined form isn't present in the Map,
it is assumed to be regular and will be declined according to the regular
Latin rules for the passed in declension group.
For example, if the Map contains values for the singular dative form but not
the singular ablative form, the singular dative form will be declined as it
appears in the Map but the singular ablative form will be declined the same
as a noun created using regular
.
Warning
Third declension nouns can be either consonant-stem or i-stem. Third
declension nouns created with this function will decline as consonant-stem.
When creating a third declension i-stem noun, use irregular_i_stem
instead.
Example
vīs, vīs is an irregular noun with an irregular singular genitive form. The stem is vīr- but none of the singular cases use. Moreover, the plural cases decline like a third declension i-stem. So all six singular forms must be provided as do the plural genitive and accusative forms. The rest of the forms can be determined by combining the provided stem with the regular third declension endings.
This example shows how to create the Map containing the irregular declined forms and demonstrates two declensions. The first declension is regular, the second is irregular.
iex> irregular = %{singular: %{nominative: ["vīs"], genitive: ["vīs"], dative: ["vī"], accusative: ["vim"], ablative: ["vī"], vocative: ["vīs"]}, plural: %{genitive: ["vīrium"], accusative: ["vīrēs", "vīrīs"]}}
%{
plural: %{accusative: ["vīrēs", "vīrīs"], genitive: ["vīrium"]},
singular: %{
ablative: ["vī"],
accusative: ["vim"],
dative: ["vī"],
genitive: ["vīs"],
nominative: ["vīs"],
vocative: ["vīs"]
}
}
iex> {:ok, noun} = Verba.Noun.irregular(irregular, :feminine, "vīr", :third)
{:ok,
%Verba.Noun{
attr: %{group: :third, irregular: nil, stem: "vīr"},
declension: %{
plural: %{accusative: ["vīrēs", "vīrīs"], genitive: ["vīrium"]},
singular: %{
ablative: ["vī"],
accusative: ["vim"],
dative: ["vī"],
genitive: ["vīs"],
nominative: ["vīs"],
vocative: ["vīs"]
}
},
gender: :feminine
}}
iex> Verba.Noun.decline(noun, :singular, :genitive)
["vīs"]
iex> Verba.Noun.decline(noun, :plural, :genitive)
["vīrium"]
iex> Verba.Noun.decline(noun, :plural, :dative)
["vīribus"]
irregular_i_stem(declension, gender, stem, group)
Like irregular
this function creates an irregular Latin noun. However,
third declension nouns created with this function will decline as i-stems
instead of consonant stems.
Example
vīs, vīs, which is also used in the example for [irregular
] is actually an
i-stem. In the example for irregular
the i-stem cases, namely the plural
genitive and plural accusative, were added to the declension Map. In this
example they are omitted since irregular nouns created with this function
decline as i-stems.
iex> irregular = %{singular: %{nominative: ["vīs"], genitive: ["vīs"], dative: ["vī"], accusative: ["vim"], ablative: ["vī"], vocative: ["vīs"]}}
%{
singular: %{
ablative: ["vī"],
accusative: ["vim"],
dative: ["vī"],
genitive: ["vīs"],
nominative: ["vīs"],
vocative: ["vīs"]
}
}
iex> {:ok, noun} = Verba.Noun.irregular_i_stem(irregular, :feminine, "vīr", :third)
{:ok,
%Verba.Noun{
attr: %{group: :third, irregular: nil, stem: "vīr", i_stem: nil},
declension: %{
singular: %{
ablative: ["vī"],
accusative: ["vim"],
dative: ["vī"],
genitive: ["vīs"],
nominative: ["vīs"],
vocative: ["vīs"]
}
},
gender: :feminine
}}
iex> Verba.Noun.decline(noun, :singular, :genitive)
["vīs"]
iex> Verba.Noun.decline(noun, :plural, :genitive)
["vīrium"]
iex> Verba.Noun.decline(noun, :plural, :dative)
["vīribus"]
regular(nom, gen, gender)
Creates a regular Latin noun.
The dictionary form of a regular Latin noun consistes of its singular nominative and genitive forms. For example, for the second declension neuter noun bellum (war) the dictionary form would be bellum, bellī. Latin nouns are also gendered. Latin, like German, has three genders: masculine, feminine, and neuter.
This function takes a list of singular nominative and genitive forms (fourth declension neuter nouns have two genitive forms) and a gender. With this information, the correct declined form for any case can be determined.
Warning
Third declension nouns can be either consonant-stem or i-stem. Third
declension nouns created with this function will decline as consonant-stem.
When creating a third declension i-stem noun, use regular_i_stem
instead.
Example
iex> nom = ["bellum"]
["bellum"]
iex> gen = ["bellī"]
["bellī"]
iex> Verba.Noun.regular(nom, gen, :neuter)
{:ok,
%Verba.Noun{
attr: %{},
declension: %{singular: %{genitive: ["bellī"], nominative: ["bellum"]}},
gender: :neuter
}}
regular_i_stem(nom, gen, gender)
Like regular
this function creates a regular Latin noun. However, third
declension nouns created with this function will decline as i-stems instead
of consonant stems.
Examples
iex> nom = ["animal"]
["animal"]
iex> gen = ["animālis"]
["animālis"]
iex> {_, noun} = Verba.Noun.regular_i_stem(nom, gen, :neuter)
{:ok,
%Verba.Noun{
attr: %{i_stem: nil},
declension: %{singular: %{genitive: ["animālis"], nominative: ["animal"]}},
gender: :neuter
}}
iex> Verba.Noun.decline(noun, :plural, :genitive)
["animālium"]
stem(noun)
Takes a noun
or the singular nominative and genitive forms of a Latin noun
and returns the noun's stem. If this function is called with an indeclinable
noun
or a pair of singular nominative and genitive forms whose stem cannot
be determined, nil
is returned.
Examples
iex> {:ok, noun} = Verba.Noun.regular(["bellum"], ["bellī"], :neuter)
{:ok,
%Verba.Noun{
attr: %{},
declension: %{singular: %{genitive: ["bellī"], nominative: ["bellum"]}},
gender: :neuter
}}
iex> Verba.Noun.stem(noun)
"bell"
iex> Verba.Noun.stem("bellum", "bellī")
"bell"