Beispiel #1
0
        //todo: convert to string?

        /// <param name="rawName">"Foo" is pluralized as "Foos".  "Pair~ of Foos" becomes "Pair of Foos" and is pluralized as "Pairs of Foos".
        /// "Foo Complex~~" is pluralized as "Foo Complexes". "Berry" is pluralized as "Berries".</param>
        /// <param name="exceptionToAAnRule">Default is to check for [AEIOU]. This bool is for exceptions to that rule.</param>
        /// <param name="uncountable">Marks uncountable nouns like "water", "courage", and "equipment". These names don't receive quantities or "a/an".</param>
        /// <param name="noArticles">Indistinct or unique names might not accept articles, like "something" or "Excalibur".</param>
        /// <param name="secondPerson">Probably used for the name "you", to work correctly with verbs.</param>
        public Name(string rawName, bool exceptionToAAnRule = false, bool uncountable = false, bool noArticles = false, bool secondPerson = false)
        {
            if (rawName.Contains("~"))
            {
                Singular = rawName.Replace("~", "");
                Plural   = rawName.Replace("~~", "es");
                Plural   = Plural.Replace("~", "s");
            }
            else
            {
                Singular = rawName;
                if (rawName.EndsWith("y") && !rawName.EndsWith("ay") && !rawName.EndsWith("ey") && !rawName.EndsWith("oy") && !rawName.EndsWith("uy"))
                {
                    Plural = rawName.Substring(0, rawName.Length - 1) + "ies";
                }
                else
                {
                    if (rawName.EndsWith("sh") || rawName.EndsWith("ch") || rawName.EndsWith("s") || rawName.EndsWith("z") || rawName.EndsWith("x"))
                    {
                        Plural = rawName + "es";
                    }
                    else
                    {
                        Plural = rawName + "s";
                    }
                }
            }
            this.uncountable  = uncountable;
            this.noArticles   = noArticles;
            this.secondPerson = secondPerson;
            SetAAn(Singular, exceptionToAAnRule);
        }