Trait is_vowel::IsRomanceVowel[][src]

pub trait IsRomanceVowel: Sealed {
    fn is_romance_vowel(self) -> bool;
fn is_romance_vowel_including(self, extra_vowels: &HashSet<char>) -> bool; }

Required methods

fn is_romance_vowel(self) -> bool[src]

Return true iff self appears to be a “vowel” in a Romance language.

This function first decomposes its argument according to Unicode Normalization Form KD to remove accents. It then considers the argument to be a vowel if the first codepoint in the decomposition of self is “a”, “e”, “i”, “o”, “u” or their uppercase equivalents.

The author believes that this produces a reasonable approximation of “vowelness” for Romance languages. Counterexamples are welcome.

Examples

for c in "xÆ".chars() {
    assert!(!c.is_romance_vowel());
}
for c in "aAáÁÅ".chars() {
    assert!(c.is_romance_vowel());
}

fn is_romance_vowel_including(self, extra_vowels: &HashSet<char>) -> bool[src]

Behave as [is_romance_vowel][is_romance_vowel], but also include the characters in extra_vowels as vowels.

Examples

let extra_vowels: HashSet<char> = "yYwW".chars().collect();
for c in "yW".chars() {
    assert!(c.is_romance_vowel_including(&extra_vowels));
}
Loading content...

Implementations on Foreign Types

impl IsRomanceVowel for char[src]

Loading content...

Implementors

Loading content...