[−][src]Crate stringedits
stringedits contains the Edit trait, which provides access to a number of iterators for small edits to strings. Based off the article How to Write A Spelling Corrector by Peter Norvig. Available under the MIT license.
Usage:
assert_eq!(vec!["!foo", "f!oo", "fo!o", "foo!"], "foo".inserts(&['!']).collect::<Vec<String>>());
Structs
CustomInsert | |
CustomReplaces | Iterator over all the words formed from the replacement of a character in a word with each letter in it's custom alphabet see Edit::replaces |
Deletions | Iterator over all the words formed from the delition of a single character from a word. See Edit::deletions |
Dist1Edits | Iterator over all the distance-1 edits of a word; deletion, insertion, or replacement of one character, or transposition of two characters. See Edit::dist1edits |
Dist2Edits | Iterator over all the distance-2 edits of a word. See Edit::dist2edits This stores a fairly large hashset & vector (of distance-1 edits) internally, so it's not nearly as lightweight as the other iterator adaptors. I'd like to come up with a more elegant solution if I can, but I'd have to wrestle with lifetimes a lot. |
Inserts | Iterator over all the words formed from the insertion of a letter in a...z in any position in a word, including before the first character and after the last see Edit::inserts |
Replaces | Iterator over all the words formed from the replacement of a character in a word with a letter in a...z see Edit::replaces |
Splits | Iterator over all the splits at a single position of a word. See Edit::splits |
Transposes | Iterator over all transpositions of a single position of a word. See Edit::transposes |
Constants
ASCII_LOWERCASE | The characters from 'a'..='z'. |
ASCII_UPPERCASE | The characters from 'A'..='Z'. |
Traits
Edit | The Edit trait provides access to a number of iterators for single-and-double character edits of a string.
It is implemented for any type that implements |