private bool IsUninflective(string word)
 {
     if (!PluralizationServiceUtil.DoesWordContainSuffix(word, this._uninflectiveSuffixes, base.Culture) && (word.ToLower().Equals(word) || !word.EndsWith("ese")) && !this._uninflectiveWords.Contains <string>(word.ToLowerInvariant()))
     {
         return(false);
     }
     return(true);
 }
        internal static bool TryInflectOnSuffixInWord(string word, IEnumerable <string> suffixes, Func <string, string> operationOnWord, CultureInfo culture, out string newWord)
        {
            string str;

            newWord = null;
            if (!PluralizationServiceUtil.TryGetMatchedSuffixForWord(word, suffixes, culture, out str))
            {
                return(false);
            }
            newWord = operationOnWord(word);
            return(true);
        }
Esempio n. 3
0
 private bool IsUninflective(string word)
 {
     if (PluralizationServiceUtil.DoesWordContainSuffix(word, _uninflectiveSuffixList, this.Culture) ||
         (!word.ToLower(this.Culture).Equals(word) && word.EndsWith("ese", false, this.Culture)) ||
         this._uninflectiveWordList.Contains(word.ToLowerInvariant()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        internal static bool TryInflectOnSuffixInWord(string word, IEnumerable <string> suffixes, Func <string, string> operationOnWord, CultureInfo culture, out string newWord)
        {
            newWord = null;

            if (PluralizationServiceUtil.DoesWordContainSuffix(word, suffixes, culture))
            {
                newWord = operationOnWord(word);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        internal static bool TryGetMatchedSuffixForWord(string word, IEnumerable <string> suffixes, CultureInfo culture, out string matchedSuffix)
        {
            Func <string, bool> func = null;

            matchedSuffix = null;
            if (!PluralizationServiceUtil.DoesWordContainSuffix(word, suffixes, culture))
            {
                return(false);
            }
            if (func == null)
            {
                func = (string x) => word.EndsWith(x);
            }
            matchedSuffix = suffixes.First <string>(func);
            return(true);
        }
Esempio n. 6
0
        private string InternalSingularize(string word)
        {
            // words that we know of
            if (this._userDictionary.ExistsInSecond(word))
            {
                return(this._userDictionary.GetFirstValue(word));
            }

            if (IsNoOpWord(word))
            {
                return(word);
            }

            string prefixWord;
            string suffixWord = GetSuffixWord(word, out prefixWord);

            if (IsNoOpWord(suffixWord))
            {
                return(prefixWord + suffixWord);
            }

            // handle the word that is the same as the plural form
            if (this.IsUninflective(suffixWord))
            {
                return(prefixWord + suffixWord);
            }

            // if word is one of the known singular words, then just return

            if (this._knownSingluarWords.Contains(suffixWord.ToLowerInvariant()))
            {
                return(prefixWord + suffixWord);
            }

            // handle simple irregular verbs, e.g. was -> were
            if (this._irregularVerbPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._irregularVerbPluralizationService.GetFirstValue(suffixWord));
            }

            // handle irregular plurals, e.g. "ox" -> "oxen"
            if (this._irregularPluralsPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._irregularPluralsPluralizationService.GetFirstValue(suffixWord));
            }

            // handle singluarization for words ending with sis and pluralized to ses,
            // e.g. "ses" -> "sis"
            if (this._wordsEndingWithSisPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._wordsEndingWithSisPluralizationService.GetFirstValue(suffixWord));
            }

            // handle words ending with se, e.g. "ses" -> "se"
            if (this._wordsEndingWithSePluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._wordsEndingWithSePluralizationService.GetFirstValue(suffixWord));
            }

            // handle words ending with sus, e.g. "suses" -> "sus"
            if (this._wordsEndingWithSusPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._wordsEndingWithSusPluralizationService.GetFirstValue(suffixWord));
            }

            string newSuffixWord;

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "men"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2) + "an", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // handle irregular inflections for common suffixes, e.g. "mouse" -> "mice"
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "lice", "mice"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "ouse", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "teeth"
            },
                                                                  (s) => s.Remove(s.Length - 4, 4) + "ooth", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "geese"
            },
                                                                  (s) => s.Remove(s.Length - 4, 4) + "oose", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "feet"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "oot", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "zoa"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2) + "oon", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // [cs]h and ss that take es as plural form, this is being moved up since the sses will be override by the ses
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ches", "shes", "sses"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }


            // handle assimilated classical inflections, e.g. vertebra -> vertebrae
            if (this._assimilatedClassicalInflectionPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._assimilatedClassicalInflectionPluralizationService.GetFirstValue(suffixWord));
            }

            // Handle the classical variants of modern inflections
            //
            if (this._classicalInflectionPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._classicalInflectionPluralizationService.GetFirstValue(suffixWord));
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "trices"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "x", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "eaux", "ieux"
            },
                                                                  (s) => s.Remove(s.Length - 1, 1), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (this._wordsEndingWithInxAnxYnxPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._wordsEndingWithInxAnxYnxPluralizationService.GetFirstValue(suffixWord));
            }

            // f, fe that take ves as plural form
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "alves", "elves", "olves", "eaves", "arves"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "f", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "nives", "lives", "wives"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "fe", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // y takes ys as plural form if preceded by a vowel, but ies if preceded by a consonant, e.g. stays, skies
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ays", "eys", "iys", "oys", "uys"
            },
                                                                  (s) => s.Remove(s.Length - 1, 1), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            //

            if (suffixWord.EndsWith("ies", true, this.Culture))
            {
                return(prefixWord + suffixWord.Remove(suffixWord.Length - 3, 3) + "y");
            }

            // handle some of the words o -> os, and [vowel]o -> os, and the rest are o->oes
            if (this._oSuffixPluralizationService.ExistsInSecond(suffixWord))
            {
                return(prefixWord + this._oSuffixPluralizationService.GetFirstValue(suffixWord));
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "aos", "eos", "ios", "oos", "uos"
            },
                                                                  (s) => suffixWord.Remove(suffixWord.Length - 1, 1), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            //



            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ces"
            },
                                                                  (s) => s.Remove(s.Length - 1, 1), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ces", "ses", "xes"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2), this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (suffixWord.EndsWith("oes", true, this.Culture))
            {
                return(prefixWord + suffixWord.Remove(suffixWord.Length - 2, 2));
            }

            if (suffixWord.EndsWith("ss", true, this.Culture))
            {
                return(prefixWord + suffixWord);
            }

            if (suffixWord.EndsWith("s", true, this.Culture))
            {
                return(prefixWord + suffixWord.Remove(suffixWord.Length - 1, 1));
            }

            // word is a singlar
            return(prefixWord + suffixWord);
        }
Esempio n. 7
0
        private string InternalPluralize(string word)
        {
            // words that we know of
            if (this._userDictionary.ExistsInFirst(word))
            {
                return(this._userDictionary.GetSecondValue(word));
            }

            if (IsNoOpWord(word))
            {
                return(word);
            }

            string prefixWord;
            string suffixWord = GetSuffixWord(word, out prefixWord);

            // by me -> by me
            if (IsNoOpWord(suffixWord))
            {
                return(prefixWord + suffixWord);
            }

            // handle the word that do not inflect in the plural form
            if (this.IsUninflective(suffixWord))
            {
                return(prefixWord + suffixWord);
            }

            // if word is one of the known plural forms, then just return
            if (this._knownPluralWords.Contains(suffixWord.ToLowerInvariant()) || this.IsPlural(suffixWord))
            {
                return(prefixWord + suffixWord);
            }

            // handle irregular plurals, e.g. "ox" -> "oxen"
            if (this._irregularPluralsPluralizationService.ExistsInFirst(suffixWord))
            {
                return(prefixWord + this._irregularPluralsPluralizationService.GetSecondValue(suffixWord));
            }

            string newSuffixWord;

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "man"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2) + "en", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // handle irregular inflections for common suffixes, e.g. "mouse" -> "mice"
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "louse", "mouse"
            },
                                                                  (s) => s.Remove(s.Length - 4, 4) + "ice", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "tooth"
            },
                                                                  (s) => s.Remove(s.Length - 4, 4) + "eeth", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "goose"
            },
                                                                  (s) => s.Remove(s.Length - 4, 4) + "eese", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "foot"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "eet", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "zoon"
            },
                                                                  (s) => s.Remove(s.Length - 3, 3) + "oa", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "cis", "sis", "xis"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2) + "es", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // handle assimilated classical inflections, e.g. vertebra -> vertebrae
            if (this._assimilatedClassicalInflectionPluralizationService.ExistsInFirst(suffixWord))
            {
                return(prefixWord + this._assimilatedClassicalInflectionPluralizationService.GetSecondValue(suffixWord));
            }

            // Handle the classical variants of modern inflections
            //
            if (this._classicalInflectionPluralizationService.ExistsInFirst(suffixWord))
            {
                return(prefixWord + this._classicalInflectionPluralizationService.GetSecondValue(suffixWord));
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "trix"
            },
                                                                  (s) => s.Remove(s.Length - 1, 1) + "ces", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "eau", "ieu"
            },
                                                                  (s) => s + "x", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (this._wordsEndingWithInxAnxYnxPluralizationService.ExistsInFirst(suffixWord))
            {
                return(prefixWord + this._wordsEndingWithInxAnxYnxPluralizationService.GetSecondValue(suffixWord));
            }

            // [cs]h and ss that take es as plural form
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, new List <string>()
            {
                "ch", "sh", "ss"
            }, (s) => s + "es", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // f, fe that take ves as plural form
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "alf", "elf", "olf", "eaf", "arf"
            },
                                                                  (s) => s.EndsWith("deaf", true, this.Culture) ? s : s.Remove(s.Length - 1, 1) + "ves", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "nife", "life", "wife"
            },
                                                                  (s) => s.Remove(s.Length - 2, 2) + "ves", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            // y takes ys as plural form if preceded by a vowel, but ies if preceded by a consonant, e.g. stays, skies
            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ay", "ey", "iy", "oy", "uy"
            },
                                                                  (s) => s + "s", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            //

            if (suffixWord.EndsWith("y", true, this.Culture))
            {
                return(prefixWord + suffixWord.Remove(suffixWord.Length - 1, 1) + "ies");
            }

            // handle some of the words o -> os, and [vowel]o -> os, and the rest are o->oes
            if (this._oSuffixPluralizationService.ExistsInFirst(suffixWord))
            {
                return(prefixWord + this._oSuffixPluralizationService.GetSecondValue(suffixWord));
            }

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord,
                                                                  new List <string>()
            {
                "ao", "eo", "io", "oo", "uo"
            },
                                                                  (s) => s + "s", this.Culture, out newSuffixWord))
            {
                return(prefixWord + newSuffixWord);
            }

            if (suffixWord.EndsWith("o", true, this.Culture) || suffixWord.EndsWith("s", true, this.Culture))
            {
                return(prefixWord + suffixWord + "es");
            }

            if (suffixWord.EndsWith("x", true, this.Culture))
            {
                return(prefixWord + suffixWord + "es");
            }

            // cats, bags, hats, speakers
            return(prefixWord + suffixWord + "s");
        }
        private string InternalSingularize(string word)
        {
            string str;
            string str1;

            if (this._userDictionary.ExistsInSecond(word))
            {
                return(this._userDictionary.GetFirstValue(word));
            }
            if (this.IsNoOpWord(word))
            {
                return(word);
            }
            string suffixWord = this.GetSuffixWord(word, out str);

            if (!this.IsNoOpWord(suffixWord))
            {
                if (this.IsUninflective(suffixWord))
                {
                    return(string.Concat(str, suffixWord));
                }
                if (this._knownSingluarWords.Contains(suffixWord.ToLowerInvariant()))
                {
                    return(string.Concat(str, suffixWord));
                }
                if (this._irregularVerbPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._irregularVerbPluralizationService.GetFirstValue(suffixWord)));
                }
                if (this._irregularPluralsPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._irregularPluralsPluralizationService.GetFirstValue(suffixWord)));
                }
                if (this._wordsEndingWithSisPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._wordsEndingWithSisPluralizationService.GetFirstValue(suffixWord)));
                }
                if (this._wordsEndingWithSePluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._wordsEndingWithSePluralizationService.GetFirstValue(suffixWord)));
                }
                List <string> strs = new List <string>()
                {
                    "men"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs, (string s) => string.Concat(s.Remove(s.Length - 2, 2), "an"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs1 = new List <string>()
                {
                    "lice",
                    "mice"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs1, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "ouse"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs2 = new List <string>()
                {
                    "teeth"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs2, (string s) => string.Concat(s.Remove(s.Length - 4, 4), "ooth"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs3 = new List <string>()
                {
                    "geese"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs3, (string s) => string.Concat(s.Remove(s.Length - 4, 4), "oose"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs4 = new List <string>()
                {
                    "feet"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs4, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "oot"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs5 = new List <string>()
                {
                    "zoa"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs5, (string s) => string.Concat(s.Remove(s.Length - 2, 2), "oon"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs6 = new List <string>()
                {
                    "ches",
                    "shes",
                    "sses"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs6, (string s) => s.Remove(s.Length - 2, 2), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                if (this._assimilatedClassicalInflectionPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._assimilatedClassicalInflectionPluralizationService.GetFirstValue(suffixWord)));
                }
                if (this._classicalInflectionPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._classicalInflectionPluralizationService.GetFirstValue(suffixWord)));
                }
                List <string> strs7 = new List <string>()
                {
                    "trices"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs7, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "x"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs8 = new List <string>()
                {
                    "eaux",
                    "ieux"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs8, (string s) => s.Remove(s.Length - 1, 1), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs9 = new List <string>()
                {
                    "inges",
                    "anges",
                    "ynges"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs9, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "x"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs10 = new List <string>()
                {
                    "alves",
                    "elves",
                    "olves",
                    "eaves",
                    "arves"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs10, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "f"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs11 = new List <string>()
                {
                    "nives",
                    "lives",
                    "wives"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs11, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "fe"), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs12 = new List <string>()
                {
                    "ays",
                    "eys",
                    "iys",
                    "oys",
                    "uys"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs12, (string s) => s.Remove(s.Length - 1, 1), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                if (suffixWord.EndsWith("ies"))
                {
                    return(string.Concat(str, suffixWord.Remove(suffixWord.Length - 3, 3), "y"));
                }
                if (this._oSuffixPluralizationService.ExistsInSecond(suffixWord))
                {
                    return(string.Concat(str, this._oSuffixPluralizationService.GetFirstValue(suffixWord)));
                }
                List <string> strs13 = new List <string>()
                {
                    "aos",
                    "eos",
                    "ios",
                    "oos",
                    "uos"
                };
                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs13, (string x) => x.Remove(x.Length - 1, 1), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs14 = new List <string>()
                {
                    "ces"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs14, (string s) => s.Remove(s.Length - 1, 1), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                List <string> strs15 = new List <string>()
                {
                    "ces",
                    "ses",
                    "xes"
                };

                if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs15, (string s) => s.Remove(s.Length - 2, 2), base.Culture, out str1))
                {
                    return(string.Concat(str, str1));
                }
                if (suffixWord.EndsWith("oes"))
                {
                    return(string.Concat(str, suffixWord.Remove(suffixWord.Length - 2, 2)));
                }
                if (suffixWord.EndsWith("ss"))
                {
                    return(string.Concat(str, suffixWord));
                }
                if (suffixWord.EndsWith("s"))
                {
                    return(string.Concat(str, suffixWord.Remove(suffixWord.Length - 1, 1)));
                }
            }
            return(string.Concat(str, suffixWord));
        }
        private string InternalPluralize(string word)
        {
            string str;
            string str1;

            if (this._userDictionary.ExistsInFirst(word))
            {
                return(this._userDictionary.GetSecondValue(word));
            }
            if (this.IsNoOpWord(word))
            {
                return(word);
            }
            string suffixWord = this.GetSuffixWord(word, out str);

            if (this.IsNoOpWord(suffixWord))
            {
                return(string.Concat(str, suffixWord));
            }
            if (this.IsUninflective(suffixWord))
            {
                return(string.Concat(str, suffixWord));
            }
            if (this._knownPluralWords.Contains(suffixWord.ToLowerInvariant()) || this.IsPlural(suffixWord))
            {
                return(string.Concat(str, suffixWord));
            }
            if (this._irregularPluralsPluralizationService.ExistsInFirst(suffixWord))
            {
                return(string.Concat(str, this._irregularPluralsPluralizationService.GetSecondValue(suffixWord)));
            }
            List <string> strs = new List <string>()
            {
                "man"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs, (string s) => string.Concat(s.Remove(s.Length - 2, 2), "en"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs1 = new List <string>()
            {
                "louse",
                "mouse"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs1, (string s) => string.Concat(s.Remove(s.Length - 4, 4), "ice"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs2 = new List <string>()
            {
                "tooth"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs2, (string s) => string.Concat(s.Remove(s.Length - 4, 4), "eeth"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs3 = new List <string>()
            {
                "goose"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs3, (string s) => string.Concat(s.Remove(s.Length - 4, 4), "eese"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs4 = new List <string>()
            {
                "foot"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs4, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "eet"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs5 = new List <string>()
            {
                "zoon"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs5, (string s) => string.Concat(s.Remove(s.Length - 3, 3), "oa"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs6 = new List <string>()
            {
                "cis",
                "sis",
                "xis"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs6, (string s) => string.Concat(s.Remove(s.Length - 2, 2), "es"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            if (this._assimilatedClassicalInflectionPluralizationService.ExistsInFirst(suffixWord))
            {
                return(string.Concat(str, this._assimilatedClassicalInflectionPluralizationService.GetSecondValue(suffixWord)));
            }
            if (this._classicalInflectionPluralizationService.ExistsInFirst(suffixWord))
            {
                return(string.Concat(str, this._classicalInflectionPluralizationService.GetSecondValue(suffixWord)));
            }
            List <string> strs7 = new List <string>()
            {
                "trix"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs7, (string s) => string.Concat(s.Remove(s.Length - 1, 1), "ces"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs8 = new List <string>()
            {
                "eau",
                "ieu"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs8, (string s) => string.Concat(s, "x"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs9 = new List <string>()
            {
                "inx",
                "anx",
                "ynx"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs9, (string s) => string.Concat(s.Remove(s.Length - 1, 1), "ges"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs10 = new List <string>()
            {
                "ch",
                "sh",
                "ss"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs10, (string s) => string.Concat(s, "es"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs11 = new List <string>()
            {
                "alf",
                "elf",
                "olf",
                "eaf",
                "arf"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs11, (string s) => {
                if (s.EndsWith("deaf", StringComparison.CurrentCultureIgnoreCase))
                {
                    return(s);
                }
                return(string.Concat(s.Remove(s.Length - 4, 4), "ice"));
            }, base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs12 = new List <string>()
            {
                "nife",
                "life",
                "wife"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs12, (string s) => string.Concat(s.Remove(s.Length - 2, 2), "ves"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            List <string> strs13 = new List <string>()
            {
                "ay",
                "ey",
                "iy",
                "oy",
                "uy"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs13, (string s) => string.Concat(s, "s"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            if (suffixWord.EndsWith("y"))
            {
                return(string.Concat(str, suffixWord.Remove(suffixWord.Length - 1, 1), "ies"));
            }
            if (this._oSuffixPluralizationService.ExistsInFirst(suffixWord))
            {
                return(string.Concat(str, this._oSuffixPluralizationService.GetSecondValue(suffixWord)));
            }
            List <string> strs14 = new List <string>()
            {
                "ao",
                "eo",
                "io",
                "oo",
                "uo"
            };

            if (PluralizationServiceUtil.TryInflectOnSuffixInWord(suffixWord, strs14, (string s) => string.Concat(s, "s"), base.Culture, out str1))
            {
                return(string.Concat(str, str1));
            }
            if (suffixWord.EndsWith("o"))
            {
                return(string.Concat(str, suffixWord, "es"));
            }
            if (suffixWord.EndsWith("x"))
            {
                return(string.Concat(str, suffixWord, "es"));
            }
            return(string.Concat(str, suffixWord, "s"));
        }