facet-singularize
facet-singularize
Fast, no-regex English singularization for the facet ecosystem.
Features
- No regex - Uses simple string operations for performance in hot paths
- No allocations with
is_singular_of()- Perfect for deserialization matching - Handles common cases:
- Irregular plurals (children → child, people → person)
-ies→-y(dependencies → dependency)-ves→-f/-fe(wolves → wolf, knives → knife)-esfor sibilants (boxes → box, matches → match)- Simple
-sremoval (items → item)
- no_std compatible
Usage
use ;
// Convert plural to singular
assert_eq!;
assert_eq!;
assert_eq!;
// Check if a word is the singular of another (allocation-free)
assert!;
assert!;
Use Case
This crate is primarily used by facet-kdl for matching KDL node names to Rust field names:
License
MIT OR Apache-2.0, at your option.
Sponsors
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
Special thanks
The facet logo was drawn by Misiasart.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.