english-tokenizer 0.2.0

Regex-driven tokenizer that splits a sentence and type-tags each token (word, number, emoji, url, email, hashtag, mention, time, currency, and more).
Documentation
//! English contraction split table.
//!
//! Keys are exact contraction strings. Lookup is case sensitive, so the table
//! pre-lists lowercase, uppercase, and capitalized variants. Each value is the
//! sequence of word pieces the contraction splits into. Most split into two
//! pieces. The three apostrophe families split into three pieces.
//!
//! Generated from the source word list. Do not hand edit.

/// Returns the split pieces for a contraction, or `None` if the key is absent.
///
/// The returned slice holds 2 or 3 word values in order. Every piece is tagged
/// `word` by the caller.
pub fn lookup(word: &str) -> Option<&'static [&'static str]> {
    match word {
        "can't" => Some(&["ca", "n't"]),
        "CAN'T" => Some(&["CA", "N'T"]),
        "Can't" => Some(&["Ca", "n't"]),
        "couldn't" => Some(&["could", "n't"]),
        "Couldn't" => Some(&["Could", "n't"]),
        "COULDN'T" => Some(&["COULD", "N'T"]),
        "don't" => Some(&["do", "n't"]),
        "DON'T" => Some(&["DO", "N'T"]),
        "Don't" => Some(&["Do", "n't"]),
        "doesn't" => Some(&["does", "n't"]),
        "DOESN'T" => Some(&["DOES", "N'T"]),
        "Doesn't" => Some(&["Does", "n't"]),
        "didn't" => Some(&["did", "n't"]),
        "DIDN'T" => Some(&["DID", "N'T"]),
        "Didn't" => Some(&["Did", "n't"]),
        "hadn't" => Some(&["had", "n't"]),
        "HADN'T" => Some(&["HAD", "N'T"]),
        "Hadn't" => Some(&["Had", "n't"]),
        "mayn't" => Some(&["may", "n't"]),
        "MAYN'T" => Some(&["MAY", "N'T"]),
        "Mayn't" => Some(&["May", "n't"]),
        "mightn't" => Some(&["might", "n't"]),
        "MIGHTN'T" => Some(&["MIGHT", "N'T"]),
        "Mightn't" => Some(&["Might", "n't"]),
        "mustn't" => Some(&["must", "n't"]),
        "MUSTN'T" => Some(&["MUST", "N'T"]),
        "Mustn't" => Some(&["Must", "n't"]),
        "needn't" => Some(&["need", "n't"]),
        "NEEDN'T" => Some(&["NEED", "N'T"]),
        "Needn't" => Some(&["Need", "n't"]),
        "oughtn't" => Some(&["ought", "n't"]),
        "OUGHTN'T" => Some(&["OUGHT", "N'T"]),
        "Oughtn't" => Some(&["Ought", "n't"]),
        "shan't" => Some(&["sha", "n't"]),
        "SHAN'T" => Some(&["SHA", "N'T"]),
        "Shan't" => Some(&["Sha", "n't"]),
        "shouldn't" => Some(&["should", "n't"]),
        "SHOULDN'T" => Some(&["SHOULD", "N'T"]),
        "Shouldn't" => Some(&["Should", "n't"]),
        "won't" => Some(&["wo", "n't"]),
        "WON'T" => Some(&["WO", "N'T"]),
        "Won't" => Some(&["Wo", "n't"]),
        "wouldn't" => Some(&["would", "n't"]),
        "WOULDN'T" => Some(&["WOULD", "N'T"]),
        "Wouldn't" => Some(&["Would", "n't"]),
        "ain't" => Some(&["ai", "n't"]),
        "AIN'T" => Some(&["AI", "N'T"]),
        "Ain't" => Some(&["Ai", "n't"]),
        "aren't" => Some(&["are", "n't"]),
        "AREN'T" => Some(&["ARE", "N'T"]),
        "Aren't" => Some(&["Are", "n't"]),
        "isn't" => Some(&["is", "n't"]),
        "ISN'T" => Some(&["IS", "N'T"]),
        "Isn't" => Some(&["Is", "n't"]),
        "wasn't" => Some(&["was", "n't"]),
        "WASN'T" => Some(&["WAS", "N'T"]),
        "Wasn't" => Some(&["Was", "n't"]),
        "weren't" => Some(&["were", "n't"]),
        "WEREN'T" => Some(&["WERE", "N'T"]),
        "Weren't" => Some(&["Were", "n't"]),
        "haven't" => Some(&["have", "n't"]),
        "HAVEN'T" => Some(&["HAVE", "N'T"]),
        "Haven't" => Some(&["Have", "n't"]),
        "hasn't" => Some(&["has", "n't"]),
        "HASN'T" => Some(&["HAS", "N'T"]),
        "Hasn't" => Some(&["Has", "n't"]),
        "daren't" => Some(&["dare", "n't"]),
        "DAREN'T" => Some(&["DARE", "N'T"]),
        "Daren't" => Some(&["Dare", "n't"]),
        "i'm" => Some(&["i", "'m"]),
        "I'M" => Some(&["I", "'M"]),
        "I'm" => Some(&["I", "'m"]),
        "i've" => Some(&["i", "'ve"]),
        "I'VE" => Some(&["I", "'VE"]),
        "I've" => Some(&["I", "'ve"]),
        "i'd" => Some(&["i", "'d"]),
        "I'D" => Some(&["I", "'D"]),
        "I'd" => Some(&["I", "'d"]),
        "i'll" => Some(&["i", "'ll"]),
        "I'LL" => Some(&["I", "'LL"]),
        "I'll" => Some(&["I", "'ll"]),
        "you've" => Some(&["you", "'ve"]),
        "YOU'VE" => Some(&["YOU", "'VE"]),
        "You've" => Some(&["You", "'ve"]),
        "you'd" => Some(&["you", "'d"]),
        "YOU'D" => Some(&["YOU", "'D"]),
        "You'd" => Some(&["You", "'d"]),
        "you'll" => Some(&["you", "'ll"]),
        "YOU'LL" => Some(&["YOU", "'LL"]),
        "You'll" => Some(&["You", "'ll"]),
        "they've" => Some(&["they", "'ve"]),
        "THEY'VE" => Some(&["THEY", "'VE"]),
        "They've" => Some(&["They", "'ve"]),
        "they'd" => Some(&["they", "'d"]),
        "THEY'D" => Some(&["THEY", "'D"]),
        "They'd" => Some(&["They", "'d"]),
        "they'll" => Some(&["they", "'ll"]),
        "THEY'LL" => Some(&["THEY", "'LL"]),
        "They'll" => Some(&["They", "'ll"]),
        "they're" => Some(&["they", "'re"]),
        "THEY'RE" => Some(&["THEY", "'RE"]),
        "They're" => Some(&["They", "'re"]),
        "we've" => Some(&["we", "'ve"]),
        "WE'VE" => Some(&["WE", "'VE"]),
        "We've" => Some(&["We", "'ve"]),
        "we'd" => Some(&["we", "'d"]),
        "WE'D" => Some(&["WE", "'D"]),
        "We'd" => Some(&["We", "'d"]),
        "we'll" => Some(&["we", "'ll"]),
        "WE'LL" => Some(&["WE", "'LL"]),
        "We'll" => Some(&["We", "'ll"]),
        "we're" => Some(&["we", "'re"]),
        "WE'RE" => Some(&["WE", "'RE"]),
        "We're" => Some(&["We", "'re"]),
        "she'd" => Some(&["she", "'d"]),
        "SHE'D" => Some(&["SHE", "'D"]),
        "She'd" => Some(&["She", "'d"]),
        "she'll" => Some(&["she", "'ll"]),
        "SHE'LL" => Some(&["SHE", "'LL"]),
        "She'll" => Some(&["She", "'ll"]),
        "she's" => Some(&["she", "'s"]),
        "SHE'S" => Some(&["SHE", "'S"]),
        "She's" => Some(&["She", "'s"]),
        "he'd" => Some(&["he", "'d"]),
        "HE'D" => Some(&["HE", "'D"]),
        "He'd" => Some(&["He", "'d"]),
        "he'll" => Some(&["he", "'ll"]),
        "HE'LL" => Some(&["HE", "'LL"]),
        "He'll" => Some(&["He", "'ll"]),
        "he's" => Some(&["he", "'s"]),
        "HE'S" => Some(&["HE", "'S"]),
        "He's" => Some(&["He", "'s"]),
        "it'd" => Some(&["it", "'d"]),
        "IT'D" => Some(&["IT", "'D"]),
        "It'd" => Some(&["It", "'d"]),
        "it'll" => Some(&["it", "'ll"]),
        "IT'LL" => Some(&["IT", "'LL"]),
        "It'll" => Some(&["It", "'ll"]),
        "it's" => Some(&["it", "'s"]),
        "IT'S" => Some(&["IT", "'S"]),
        "It's" => Some(&["It", "'s"]),
        "what've" => Some(&["what", "'ve"]),
        "WHAT'VE" => Some(&["WHAT", "'VE"]),
        "What've" => Some(&["What", "'ve"]),
        "what'd" => Some(&["what", "'d"]),
        "WHAT'D" => Some(&["WHAT", "'D"]),
        "What'd" => Some(&["What", "'d"]),
        "what'll" => Some(&["what", "'ll"]),
        "WHAT'LL" => Some(&["WHAT", "'LL"]),
        "What'll" => Some(&["What", "'ll"]),
        "what're" => Some(&["what", "'re"]),
        "WHAT'RE" => Some(&["WHAT", "'RE"]),
        "What're" => Some(&["What", "'re"]),
        "who've" => Some(&["who", "'ve"]),
        "WHO'VE" => Some(&["WHO", "'VE"]),
        "Who've" => Some(&["Who", "'ve"]),
        "who'd" => Some(&["who", "'d"]),
        "WHO'D" => Some(&["WHO", "'D"]),
        "Who'd" => Some(&["Who", "'d"]),
        "who'll" => Some(&["who", "'ll"]),
        "WHO'LL" => Some(&["WHO", "'LL"]),
        "Who'll" => Some(&["Who", "'ll"]),
        "who're" => Some(&["who", "'re"]),
        "WHO'RE" => Some(&["WHO", "'RE"]),
        "Who're" => Some(&["Who", "'re"]),
        "when've" => Some(&["when", "'ve"]),
        "WHEN'VE" => Some(&["WHEN", "'VE"]),
        "When've" => Some(&["When", "'ve"]),
        "when'd" => Some(&["when", "'d"]),
        "WHEN'D" => Some(&["WHEN", "'D"]),
        "When'd" => Some(&["When", "'d"]),
        "when'll" => Some(&["when", "'ll"]),
        "WHEN'LL" => Some(&["WHEN", "'LL"]),
        "When'll" => Some(&["When", "'ll"]),
        "when're" => Some(&["when", "'re"]),
        "WHEN'RE" => Some(&["WHEN", "'RE"]),
        "When're" => Some(&["When", "'re"]),
        "where've" => Some(&["where", "'ve"]),
        "WHERE'VE" => Some(&["WHERE", "'VE"]),
        "Where've" => Some(&["Where", "'ve"]),
        "where'd" => Some(&["where", "'d"]),
        "WHERE'D" => Some(&["WHERE", "'D"]),
        "Where'd" => Some(&["Where", "'d"]),
        "where'll" => Some(&["where", "'ll"]),
        "WHERE'LL" => Some(&["WHERE", "'LL"]),
        "Where'll" => Some(&["Where", "'ll"]),
        "where're" => Some(&["where", "'re"]),
        "WHERE'RE" => Some(&["WHERE", "'RE"]),
        "Where're" => Some(&["Where", "'re"]),
        "why've" => Some(&["why", "'ve"]),
        "WHY'VE" => Some(&["WHY", "'VE"]),
        "Why've" => Some(&["Why", "'ve"]),
        "why'd" => Some(&["why", "'d"]),
        "WHY'D" => Some(&["WHY", "'D"]),
        "Why'd" => Some(&["Why", "'d"]),
        "why'll" => Some(&["why", "'ll"]),
        "WHY'LL" => Some(&["WHY", "'LL"]),
        "Why'll" => Some(&["Why", "'ll"]),
        "why're" => Some(&["why", "'re"]),
        "WHY'RE" => Some(&["WHY", "'RE"]),
        "Why're" => Some(&["Why", "'re"]),
        "how've" => Some(&["how", "'ve"]),
        "HOW'VE" => Some(&["HOW", "'VE"]),
        "How've" => Some(&["How", "'ve"]),
        "how'd" => Some(&["how", "'d"]),
        "HOW'D" => Some(&["HOW", "'D"]),
        "How'd" => Some(&["How", "'d"]),
        "how'll" => Some(&["how", "'ll"]),
        "HOW'LL" => Some(&["HOW", "'LL"]),
        "How'll" => Some(&["How", "'ll"]),
        "how're" => Some(&["how", "'re"]),
        "HOW'RE" => Some(&["HOW", "'RE"]),
        "How're" => Some(&["How", "'re"]),
        "there've" => Some(&["there", "'ve"]),
        "THERE'VE" => Some(&["THERE", "'VE"]),
        "There've" => Some(&["There", "'ve"]),
        "there'd" => Some(&["there", "'d"]),
        "THERE'D" => Some(&["THERE", "'D"]),
        "There'd" => Some(&["There", "'d"]),
        "there'll" => Some(&["there", "'ll"]),
        "THERE'LL" => Some(&["THERE", "'LL"]),
        "There'll" => Some(&["There", "'ll"]),
        "there're" => Some(&["there", "'re"]),
        "THERE'RE" => Some(&["THERE", "'RE"]),
        "There're" => Some(&["There", "'re"]),
        "that've" => Some(&["that", "'ve"]),
        "THAT'VE" => Some(&["THAT", "'VE"]),
        "That've" => Some(&["That", "'ve"]),
        "that'd" => Some(&["that", "'d"]),
        "THAT'D" => Some(&["THAT", "'D"]),
        "That'd" => Some(&["That", "'d"]),
        "that'll" => Some(&["that", "'ll"]),
        "THAT'LL" => Some(&["THAT", "'LL"]),
        "That'll" => Some(&["That", "'ll"]),
        "that're" => Some(&["that", "'re"]),
        "THAT'RE" => Some(&["THAT", "'RE"]),
        "That're" => Some(&["That", "'re"]),
        "let's" => Some(&["let", "'s"]),
        "LET'S" => Some(&["LET", "'S"]),
        "Let's" => Some(&["Let", "'s"]),
        "could've" => Some(&["could", "'ve"]),
        "COULD'VE" => Some(&["COULD", "'VE"]),
        "Could've" => Some(&["Could", "'ve"]),
        "should've" => Some(&["should", "'ve"]),
        "SHOULD'VE" => Some(&["SHOULD", "'VE"]),
        "Should've" => Some(&["Should", "'ve"]),
        "would've" => Some(&["would", "'ve"]),
        "WOULD'VE" => Some(&["WOULD", "'VE"]),
        "Would've" => Some(&["Would", "'ve"]),
        "i'll've" => Some(&["i", "'ll", "'ve"]),
        "I'LL'VE" => Some(&["I", "'LL", "'VE"]),
        "I'll've" => Some(&["I", "'ll", "'ve"]),
        "you'll've" => Some(&["you", "'ll", "'ve"]),
        "YOU'LL'VE" => Some(&["YOU", "'LL", "'VE"]),
        "You'll've" => Some(&["You", "'ll", "'ve"]),
        "they'll've" => Some(&["they", "'ll", "'ve"]),
        "THEY'LL'VE" => Some(&["THEY", "'LL", "'VE"]),
        "They'll've" => Some(&["They", "'ll", "'ve"]),
        "it'll've" => Some(&["it", "'ll", "'ve"]),
        "IT'LL'VE" => Some(&["IT", "'LL", "'VE"]),
        "It'll've" => Some(&["It", "'ll", "'ve"]),
        "he'll've" => Some(&["he", "'ll", "'ve"]),
        "HE'LL'VE" => Some(&["HE", "'LL", "'VE"]),
        "He'll've" => Some(&["He", "'ll", "'ve"]),
        "she'll've" => Some(&["she", "'ll", "'ve"]),
        "SHE'LL'VE" => Some(&["SHE", "'LL", "'VE"]),
        "She'll've" => Some(&["She", "'ll", "'ve"]),
        "shouldn't've" => Some(&["should", "n't", "'ve"]),
        "SHOULDN'T'VE" => Some(&["SHOULD", "N'T", "'VE"]),
        "Shouldn't've" => Some(&["Should", "n't", "'ve"]),
        "couldn't've" => Some(&["could", "n't", "'ve"]),
        "COULDN'T'VE" => Some(&["COULD", "N'T", "'VE"]),
        "Couldn't've" => Some(&["Could", "n't", "'ve"]),
        "wouldn't've" => Some(&["would", "n't", "'ve"]),
        "WOULDN'T'VE" => Some(&["WOULD", "N'T", "'VE"]),
        "Wouldn't've" => Some(&["Would", "n't", "'ve"]),
        "i'd've" => Some(&["i", "'d", "'ve"]),
        "I'D'VE" => Some(&["I", "'D", "'VE"]),
        "I'd've" => Some(&["I", "'d", "'ve"]),
        "you'd've" => Some(&["you", "'d", "'ve"]),
        "YOU'D'VE" => Some(&["YOU", "'D", "'VE"]),
        "You'd've" => Some(&["You", "'d", "'ve"]),
        "he'd've" => Some(&["he", "'d", "'ve"]),
        "HE'D'VE" => Some(&["HE", "'D", "'VE"]),
        "He'd've" => Some(&["He", "'d", "'ve"]),
        "she'd've" => Some(&["she", "'d", "'ve"]),
        "SHE'D'VE" => Some(&["SHE", "'D", "'VE"]),
        "She'd've" => Some(&["She", "'d", "'ve"]),
        "they'd've" => Some(&["they", "'d", "'ve"]),
        "THEY'D'VE" => Some(&["THEY", "'D", "'VE"]),
        "They'd've" => Some(&["They", "'d", "'ve"]),
        "there'd've" => Some(&["there", "'d", "'ve"]),
        "THERE'D'VE" => Some(&["THERE", "'D", "'VE"]),
        "There'd've" => Some(&["There", "'d", "'ve"]),
        "it'd've" => Some(&["it", "'d", "'ve"]),
        "IT'D'VE" => Some(&["IT", "'D", "'VE"]),
        "It'd've" => Some(&["It", "'d", "'ve"]),
        _ => None,
    }
}

/// Number of distinct contraction keys in the table.
pub const COUNT: usize = 297;