Crate contractions[−][src]
Expand description
contractions
is a library to handle contractions
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.
Example
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."));
Structs
Contractions | Main actor in the |
Constants
CONTRACTIONS_JSON_ORDER | The list of all json strings. |
EXPAND_DOUBLE_CONTRACTIONS_JSON | Contains contractions with two apostroph in json form (eg: Who’ll’ve, Wouldn’t’ve, Mustn’t’ve) |
EXPAND_DOUBLE_NO_APOSTROPHE_CONTRACTIONS_JSON | Contains most of |
EXPAND_PARTIAL_CONTRACTIONS_JSON | Contains partial contractions in json form. (eg: ’m, ’ve, n’t, ’re) |
EXPAND_SINGLE_CONTRACTIONS_JSON | Contains contractions with one apostroph in json form (eg: I’m, I’ve, ’twas) |
EXPAND_SINGLE_NO_APOSTROPHE_CONTRACTIONS_JSON | Contains most of |
EXPAND_SLANG_JSON | Contains slang terms which will be expanded/changed to their full form |
EXPAND_TRIPPLE_CONTRACTIONS_JSON | Contains contractions with three apostroph in json form (Y’all’d’ve, ’twou’dn’t) |