| 1 | pub struct Moodrust-analyzer cargo imperative 1.0.7 checker/Mood# { |
| 2 | en_stemmerrust-analyzer cargo imperative 1.0.7 checker/Mood#en_stemmer.: rust_stemmersrust-analyzer cargo rust-stemmers 1.2.0 crate/::Stemmerrust-analyzer cargo rust-stemmers 1.2.0 Stemmer#, |
| 3 | } |
| 4 | |
| 5 | impl Moodrust-analyzer cargo imperative 1.0.7 checker/Mood# { |
| 6 | pub fn newrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]new().() -> Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood] { |
| 7 | Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood] { |
| 8 | en_stemmerrust-analyzer cargo imperative 1.0.7 checker/Mood#en_stemmer.: rust_stemmersrust-analyzer cargo rust-stemmers 1.2.0 crate/::Stemmerrust-analyzer cargo rust-stemmers 1.2.0 Stemmer#::createrust-analyzer cargo rust-stemmers 1.2.0 impl#[Stemmer]create().(rust_stemmersrust-analyzer cargo rust-stemmers 1.2.0 crate/::Algorithmrust-analyzer cargo rust-stemmers 1.2.0 Algorithm#::Englishrust-analyzer cargo rust-stemmers 1.2.0 Algorithm#English#), |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | /// **Note:** that the input is expected to be all lowercase (if that is applicable). |
| 13 | pub fn is_imperativerust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]is_imperative().(&self, word: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool> { |
| 14 | if craterust-analyzer cargo imperative 1.0.7 crate/::wordlist_codegenrust-analyzer cargo imperative 1.0.7 wordlist_codegen/::BLACKLISTrust-analyzer cargo imperative 1.0.7 wordlist_codegen/BLACKLIST..containsrust-analyzer cargo phf 0.11.3 set/impl#[`Set<T>`]contains().(word) { |
| 15 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false); |
| 16 | } |
| 17 | |
| 18 | let stem = match word { |
| 19 | "added" => "add".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 20 | _ => self.en_stemmerrust-analyzer cargo imperative 1.0.7 checker/Mood#en_stemmer..stemrust-analyzer cargo rust-stemmers 1.2.0 impl#[Stemmer]stem().(word), |
| 21 | }; |
| 22 | let imperative_forms = craterust-analyzer cargo imperative 1.0.7 crate/::wordlist_codegenrust-analyzer cargo imperative 1.0.7 wordlist_codegen/::IMPERATIVESrust-analyzer cargo imperative 1.0.7 wordlist_codegen/IMPERATIVES..getrust-analyzer cargo phf 0.11.3 map/impl#[`Map<K, V>`]get().(stem.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 23 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(imperative_forms.containsrust-analyzer cargo phf 0.11.3 set/impl#[`Set<T>`]contains().(word)) |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# for Moodrust-analyzer cargo imperative 1.0.7 checker/Mood# { |
| 28 | fn clonerust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Clone]clone().(&self) -> Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Clone] { |
| 29 | Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Clone]::newrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]new().() |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Moodrust-analyzer cargo imperative 1.0.7 checker/Mood# { |
| 34 | fn defaultrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Default]default().() -> Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Default] { |
| 35 | Selfrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood][Default]::newrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]new().() |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | #[cfg(test)] |
| 40 | mod testrust-analyzer cargo imperative 1.0.7 checker/test/ { |
| 41 | use superrust-analyzer cargo imperative 1.0.7 checker/::*; |
| 42 | |
| 43 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 44 | fn is_imperativerust-analyzer cargo imperative 1.0.7 checker/test/is_imperative().() { |
| 45 | let mood = Moodrust-analyzer cargo imperative 1.0.7 checker/Mood#::newrust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]new().(); |
| 46 | let cases = &[ |
| 47 | ("runs", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 48 | ("run", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true)), |
| 49 | ("returns", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 50 | ("return", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true)), |
| 51 | ("constructor", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 52 | ("adds", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 53 | ("add", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true)), |
| 54 | ("added", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 55 | ]; |
| 56 | for (word, expected) in cases.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 57 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Checking {word}"); |
| 58 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mood.is_imperativerust-analyzer cargo imperative 1.0.7 checker/impl#[Mood]is_imperative().(word), expected.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().()); |
| 59 | } |
| 60 | } |
| 61 | } |