/// <summary> /// Search for the longest among the following suffixes, and perform the action indicated. /// eed eedly+ /// replace by ee if in R1 /// ed edly+ ing ingly+ /// delete if the preceding word part contains a vowel, and then /// if the word ends at, bl or iz add e (so luxuriat -> luxuriate), or /// if the word ends with a double remove the last letter (so hopp -> hop), or /// if the word is short, add e (so hop -> hope) /// </summary> internal void StripSuffixStep1b() { // eed eedly+ - replace by ee if in R1 if (Stem.EndsWith("eed") || Stem.EndsWith("eedly")) { if (EndsWithAndInR1("eed") || EndsWithAndInR1("eedly")) { if (_r1.Contains(Stem.Length)) { Stem = Stem.Substring(0, Stem.LastIndexOf("eed")) + "ee"; } } return; } // ed edly+ ing ingly+ - delete if the preceding word part contains a vowel, and then if ((Stem.EndsWith("ed") && Stem.IndexOfAny(Vowels, 0, Stem.Length - 2) != -1) || (Stem.EndsWith("edly") && Stem.IndexOfAny(Vowels, 0, Stem.Length - 4) != -1) || (Stem.EndsWith("ing") && Stem.IndexOfAny(Vowels, 0, Stem.Length - 3) != -1) || (Stem.EndsWith("ingly") && Stem.IndexOfAny(Vowels, 0, Stem.Length - 5) != -1)) { StripEnding(new string[4] { "ed", "edly", "ing", "ingly" }); // if the word ends at, bl or iz add e (so luxuriat -> luxuriate), or if (Stem.EndsWith("at") || Stem.EndsWith("bl") || Stem.EndsWith("iz")) { Stem += "e"; return; } // if the word ends with a double remove the last letter (so hopp -> hop), or string end2chars; if (Stem.Length >= 2) { end2chars = Stem.Substring(Stem.Length - 2, 2); } else { return; } var doubleEndings = new List <string>(DoubleChars); if (doubleEndings.Contains(end2chars)) { Stem = Stem.Remove(Stem.Length - 1); return; } // if the word is short, add e (so hop -> hope) if (IsShortWord()) { Stem += "e"; return; } } }