3 # Constants for the Porter 2 stemmer
12 # A non-vowel other than w, x, or Y
15 # Doubles created when adding a suffix: these are undoubled when stemmed
16 Double
= "(bb|dd|ff|gg|mm|nn|pp|rr|tt)"
18 # A valid letter that can come before 'li' (or 'ly')
19 Valid_LI
= "[cdeghkmnrt]"
21 # A specification for a short syllable.
23 # A short syllable in a word is either:
24 # 1. a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel, or
25 # 2. a vowel at the beginning of the word followed by a non-vowel.
27 # (The original document is silent on whether sequences of two or more non-vowels make a
28 # syllable long. But as this specification is only used to find sequences of non-vowel -
29 # vowel - non-vowel - end-of-word, this ambiguity does not have an effect.)
30 SHORT_SYLLABLE
= "((#{C}#{V}#{CW})|(^#{V}#{C}))"
32 # Suffix transformations used in porter2_step2.
33 # (ogi, li endings dealt with in procedure)
34 STEP_2_MAPS
= {"tional" => "tion",
57 # Suffix transformations used in porter2_step3.
58 # (ative ending dealt with in procedure)
59 STEP_3_MAPS
= {"tional" => "tion",
68 # Suffix transformations used in porter2_step4.
69 # (ion ending dealt with in procedure)
70 STEP_4_MAPS
= {"al" => "",
88 # Special-case stemmings
89 SPECIAL_CASES
= {"skis" => "ski",
106 "cosmos" => "cosmos",
110 # Special case words to stop processing after step 1a.
111 STEP_1A_SPECIAL_CASES
= %w
[ inning outing canning herring earring proceed exceed succeed
]