From e1e7a94d0c781fa3c8a3c82a74c671ee1e92af92 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 19 Jan 2026 21:48:32 +0100 Subject: run: ask for alternatives as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit also fixes the need to ask for a random gender when asking for adjectives. This is somewhat unrelated to the main subject, but untying this now was a bit too much of a hassle. Signed-off-by: Miquel Sabaté Solà --- lib/mihi/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/mihi/src/lib.rs b/lib/mihi/src/lib.rs index 7555a0f..d75965d 100644 --- a/lib/mihi/src/lib.rs +++ b/lib/mihi/src/lib.rs @@ -300,18 +300,18 @@ impl TryFrom for RelationKind { } /// Join by enunciate the given words. -pub fn joint_related_words(related: &Vec) -> String { - return related +pub fn joint_related_words(related: &[Word]) -> String { + related .iter() .map(|w| w.enunciated.clone()) .collect::>() - .join("; "); + .join("; ") } /// Returns a string with the enunciate of the comparative form of the given /// `word`. This function assumes that it really does, or at least it's /// contained in the `related` vector. -pub fn comparative(word: &Word, related: &Vec) -> String { +pub fn comparative(word: &Word, related: &[Word]) -> String { if !related.is_empty() { return joint_related_words(related); } @@ -326,7 +326,7 @@ pub fn comparative(word: &Word, related: &Vec) -> String { /// Returns a string with the enunciate of the superlative form of the given /// `word`. This function assumes that it really does, or at least it's /// contained in the `related` vector. -pub fn superlative(word: &Word, related: &Vec) -> String { +pub fn superlative(word: &Word, related: &[Word]) -> String { if !related.is_empty() { return joint_related_words(related); } @@ -346,7 +346,7 @@ pub fn superlative(word: &Word, related: &Vec) -> String { /// Returns a string with the enunciate of the adverbial form of the given /// `word`. This function assumes that it really does, or at least it's /// contained in the `related` vector. -pub fn adverb(word: &Word, related: &Vec) -> String { +pub fn adverb(word: &Word, related: &[Word]) -> String { if !related.is_empty() { return joint_related_words(related); } @@ -439,7 +439,7 @@ impl Word { if self.is_flag_set("contracted_root") { return format!( "{}{}", - self.particle[0..(self.particle.len() - 2)].to_string(), + &self.particle[0..(self.particle.len() - 2)], self.particle.chars().last().unwrap_or(' '), ); } -- cgit v1.2.3