1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package spell
// contractions is a curated set of common English contractions that the
// frequency wordlist omits (it stores only apostrophe-free base words). Without
// this, everyday forms like "isn't", "won't", and "I'd" would be flagged as
// misspellings — the possessive trim in Known handles only "'s"/"'". Keys are
// lowercase with a straight apostrophe; Known normalizes case and curly
// apostrophes before the lookup, so "Isn't", "ISN'T", and "isn’t" all match.
//
// Curated rather than derived (base + enclitic): a fixed set has zero false
// positives ("qwerty'll" stays flagged) and is trivial to reason about. Add a
// line here when a legitimate contraction turns up missing.
var contractions = map[string]struct{}{
// n't (negations)
"ain't": {}, "aren't": {}, "can't": {}, "couldn't": {}, "daren't": {},
"didn't": {}, "doesn't": {}, "don't": {}, "hadn't": {}, "hasn't": {},
"haven't": {}, "isn't": {}, "mightn't": {}, "mustn't": {}, "needn't": {},
"oughtn't": {}, "shan't": {}, "shouldn't": {}, "wasn't": {}, "weren't": {},
"won't": {}, "wouldn't": {},
// 'd (had / would)
"i'd": {}, "you'd": {}, "he'd": {}, "she'd": {}, "it'd": {}, "we'd": {},
"they'd": {}, "who'd": {}, "that'd": {}, "there'd": {}, "how'd": {},
// 'll (will / shall)
"i'll": {}, "you'll": {}, "he'll": {}, "she'll": {}, "it'll": {}, "we'll": {},
"they'll": {}, "who'll": {}, "that'll": {}, "there'll": {},
// 're (are)
"you're": {}, "we're": {}, "they're": {}, "who're": {}, "there're": {},
"that're": {}, "what're": {},
// 've (have)
"i've": {}, "you've": {}, "we've": {}, "they've": {}, "who've": {},
"would've": {}, "could've": {}, "should've": {}, "might've": {},
"must've": {}, "there've": {},
// 'm (am)
"i'm": {},
// 's (is / has / us) — many already ride the possessive trim, listed here
// so the intent is explicit and case/curly normalization is uniform.
"it's": {}, "he's": {}, "she's": {}, "that's": {}, "there's": {},
"here's": {}, "what's": {}, "who's": {}, "let's": {}, "how's": {},
"where's": {}, "when's": {}, "why's": {}, "one's": {}, "she'd've": {},
// miscellaneous
"y'all": {}, "o'clock": {}, "ma'am": {}, "'tis": {}, "'twas": {},
}
|