#word-count #plural #pluralize #singular #npm-package

pluralizer

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

6 releases (3 breaking)

0.4.0 Mar 9, 2023
0.3.2 Feb 28, 2022
0.2.0 Feb 28, 2022
0.1.0 Feb 25, 2022

#271 in Text processing

Download history 1174/week @ 2024-07-21 1764/week @ 2024-07-28 2039/week @ 2024-08-04 1754/week @ 2024-08-11 1586/week @ 2024-08-18 1449/week @ 2024-08-25 1086/week @ 2024-09-01 1547/week @ 2024-09-08 1548/week @ 2024-09-15 1850/week @ 2024-09-22 1919/week @ 2024-09-29 1790/week @ 2024-10-06 1870/week @ 2024-10-13 2480/week @ 2024-10-20 3328/week @ 2024-10-27 2622/week @ 2024-11-03

10,522 downloads per month
Used in 22 crates (11 directly)

MIT/Apache

41KB
1K SLoC

pluralizer

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

Rust Latest version Documentation License

Getting Started

pluralizer.rs is available on crates.io. It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.

At the point of the last update of this README, the latest published version could be used like this:

Add the following dependency to your Cargo manifest...

[dependencies]
pluralizer = "0.3.1"

...and see the docs for how to use it.

Example

use pluralizer::pluralize;

fn main() {
    pluralizer::initialize();

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

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

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

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

License

Licensed under either of

at your option

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2.3–3MB
~55K SLoC