Struct jp_inflections::Word[][src]

pub struct Word {
    pub kana: String,
    pub kanji: Option<String>,
    pub inflections: Vec<Inflection>,
}
Expand description

Represents a japanese word

Fields

kana: Stringkanji: Option<String>inflections: Vec<Inflection>

Implementations

Creates a new Word value of a kana and optionally kanji word. Requires both words to be in the dictionary form

Returns true if the Word is a verb

Example

use jp_inflections::Word;

assert!(Word::new("ならう", Some("習う")).is_verb());
assert!(!Word::new("えいご", Some("英語")).is_verb());

Returns a verb from the word. Requires the word to be a verb in the dictionary form

Example

use jp_inflections::{Word, VerbType};

assert!(Word::new("ならう", Some("習う")).into_verb(VerbType::Godan).is_ok());

Returns true if self has the passed readings. If kanji is none, but the word has a kanji reading the output represents only a kana match

Returns true if the words readings end with the passed strings. If the kanji is none, but the word has a kanji reading the output represents only a kana match

Returns the kanji reading if possible, otherwise the kana reading gets returned

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.