aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-01-29 22:03:10 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-01-29 22:03:10 +0100
commit3980cc7c38f043c53c9811078101d7a78de3f8d1 (patch)
tree1521b6bf83d3411e3f725fc8b7b496de94cc061f /lib
parenta9946caa0df69c7799e5909272968337453360e4 (diff)
downloadmihi-3980cc7c38f043c53c9811078101d7a78de3f8d1.tar.gz
mihi-3980cc7c38f043c53c9811078101d7a78de3f8d1.zip
words: allow the creation of irregular words
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/mihi/src/lib.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/mihi/src/lib.rs b/lib/mihi/src/lib.rs
index e965fdf..f944b82 100644
--- a/lib/mihi/src/lib.rs
+++ b/lib/mihi/src/lib.rs
@@ -247,6 +247,12 @@ pub enum Conjugation {
Third,
ThirdIo,
Fourth,
+
+ // The 'Other' conjugation is a container for a bunch of verbs like 'sum',
+ // 'volō', etc. That is, we expect the user to realize this is an irregular
+ // verb, and then we rely on the 'kind' column to determine which kind of
+ // irregular verb that is. This is better than enlarging a list of kinds of
+ // irregular verbs as it was done in the past.
Other,
}
@@ -284,6 +290,33 @@ impl std::fmt::Display for Conjugation {
}
}
+impl Conjugation {
+ /// Returns a String containing how a conjugation would be displayed by also
+ /// considering the given 'kind' identifier. This way we can display 'other'
+ /// conjugations in a more natural way.
+ pub fn display_with_kind(&self, kind: &str) -> String {
+ if !matches!(self, Conjugation::Other) {
+ return format!("{}", self);
+ }
+
+ match kind {
+ "sum" => "irregular; like 'sum, esse, fuī, futūrus'",
+ "possum" => "irregular; like 'possum, posse, potuī'",
+ "eo" => "irregular; like 'eō, īre, iī, itum'",
+ "volo" => "irregular; like 'volō, velle, voluī'",
+ "nolo" => "irregular; like 'nōlō, nōlle, nōluī'",
+ "malo" => "irregular; like 'mālō, mālle, māluī'",
+ "fero" => "irregular; like 'ferō, ferre, tulī, lātum'",
+ "facio" => "3rd (-iō variants) and suppletive; like 'faciō, facere, fēcī, factum'",
+ "do" => "1st; irregular short ă in most forms",
+ "inquam" => "irregular, highly defective",
+ "aio" => "3rd (-iō variants); highly defective",
+ _ => "other",
+ }
+ .to_string()
+ }
+}
+
#[derive(Clone, Debug, Default)]
pub enum Language {
#[default]