Crate pluralizer

Source
Expand description

Rust package to pluralize or singularize any word based on a count inspired on pluralize NPM package.

It will keep plurals are plurals if the count given is not 1, either way, it is going to keep the singular form if the count given is 1

§Example

use pluralizer::pluralize;

fn main() {
    // It can convert to plural
    println!("{}", pluralize("House", 2, true)); // 2 Houses

    // But also can convert to singular
    println!("{}", pluralize("Houses", 1, true)); // 1 House

    // And keep singularization if needed
    println!("{}", pluralize("House", 1, false)); // House

    // Or keep pluralization
    println!("{}", pluralize("Houses", 2, false)); // Houses
}

Enums§

UncountableRule
Uncountable rule struct

Functions§

add_irregular_rule
Add an irregular word definition.
add_plural_rule
Add a pluralization rule to the collection.
add_singular_rule
Add a singularization rule to the collection.
add_uncountable_rule
Add an uncountable word rule.
pluralize
Pluralize or singularize a word based on the passed in count.