From 4b97729533f744b92b3aa6ea85468a4c6fffd8f6 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 28 Jan 2026 22:07:36 +0100 Subject: Ensure that the locative is singular-only unless defective MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only case in which the locative form makes sense to be given is for words which are actually defective and only have a plural form (e.g. Athēnae). Other than that, it makes no sense to provide solutions like 'domibus', which have never been attested and are weird to think about. As a corollary, the inflection tests have been expanded with the examples on 'Athēnae' and 'domus', so we ensure the locative behaves as expected. Signed-off-by: Miquel Sabaté Solà --- crates/cli/src/inflection.rs | 9 ++++++++- lib/mihi/src/lib.rs | 14 +++++++++++--- testdata/test.sqlite3 | Bin 2916352 -> 2916352 bytes 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/cli/src/inflection.rs b/crates/cli/src/inflection.rs index b08942f..8799e9b 100644 --- a/crates/cli/src/inflection.rs +++ b/crates/cli/src/inflection.rs @@ -190,6 +190,10 @@ mod tests { "Rōma, Rōmae", "Rōma | Rōma | Rōmam | Rōmae | Rōmae | Rōmā | Rōmae", ); + assert_noun_table( + "Athēnae, Athēnārum", + "Athēnae | Athēnae | Athēnās | Athēnārum | Athēnīs | Athēnīs | Athēnīs", + ); assert_noun_table( "lupus, lupī", "lupus, lupī | lupe, lupī | lupum, lupōs | lupī, lupōrum | lupō, lupīs | lupō, lupīs", @@ -238,7 +242,10 @@ mod tests { "cornū, cornūs", "cornū, cornua | cornū, cornua | cornū, cornua | cornūs, cornuum | cornuī, cornibus | cornū, cornibus", ); - // TODO: domus + assert_noun_table( + "domus, domūs/domī", + "domus, domūs | domus, domūs | domum, domūs/domōs | domūs/domī, domuum/domōrum | domuī/domō/domū, domibus | domū/domō, domibus | domī, ", + ); assert_noun_table( "diēs, diēī", "diēs, diēs | diēs, diēs | diem, diēs | diēī, diērum | diēī, diēbus | diē, diēbus", diff --git a/lib/mihi/src/lib.rs b/lib/mihi/src/lib.rs index 11d269a..b6abf2f 100644 --- a/lib/mihi/src/lib.rs +++ b/lib/mihi/src/lib.rs @@ -1779,18 +1779,26 @@ pub fn group_declension_inflections( let mut table = DeclensionTable::default(); while let Some(row) = it.next().unwrap() { + let onlyplural = word.is_flag_set("onlyplural"); + // Fetch the number and account for defectives on number. let number_i: isize = row.get(1).unwrap(); let number: usize = usize::try_from(number_i).expect("not expecting a negative number"); - if (number == 0 && word.is_flag_set("onlyplural")) - || (number == 1 && word.is_flag_set("onlysingular")) - { + if (number == 0 && onlyplural) || (number == 1 && word.is_flag_set("onlysingular")) { continue; } let case_i: isize = row.get(3).unwrap(); let term: String = row.get(4).unwrap(); + // If this is the locative, on the plural, and 'onlyplural' was not + // specified, then chances are that the locative in the plural doesn't + // exist. That is because it only existed for defective nouns such as + // 'Athēnīs'. + if case_i == 6 && number == 1 && !onlyplural { + continue; + } + table.add( word, usize::try_from(case_i).expect("not expecting a negative number"), diff --git a/testdata/test.sqlite3 b/testdata/test.sqlite3 index e7733f9..b728b03 100644 Binary files a/testdata/test.sqlite3 and b/testdata/test.sqlite3 differ -- cgit v1.2.3