Crates.io | contractions |
lib.rs | contractions |
version | 0.5.4 |
source | src |
created_at | 2021-05-24 17:13:24.981034 |
updated_at | 2021-05-25 14:07:51.044878 |
description | Contractions is a rust library to expand contractions in English. |
homepage | https://github.com/TomLouisKeller/contractions |
repository | https://github.com/TomLouisKeller/contractions |
max_upload_size | |
id | 401494 |
size | 123,054 |
Notice: Contractions
’ API is not stabilized yet and still work in progress
contractions
is a rust library to handle contractions in English.
So far only data sets to expand contractions are implemented.
Expands "I’m" to "I am" etc.
The default data set has a replacement for all-lowercase, all-uppercase and first letter uppercase.
let contractions = contractions::Contractions::default();
assert_eq!("I am sure you would have been fine.", contractions.apply("I’m sure you’d’ve been fine."));
assert_eq!("Are you sure?", contractions.apply("R u sure?"));
let mut contractions = Contractions::new();
contractions.add_from_json(contractions::SINGLE_CONTRACTIONS_JSON);
assert_eq!("I am sad you couldn’t’ve come.", contractions.apply("I’m sad you couldn’t’ve come."));