亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pluralizer.cs

?? 英文名詞複數還原
?? CS
字號:
/* **********************************************************************************
 *
 * Copyright (c) Microsoft Corporation. All rights reserved.
 *
 * This source code is subject to terms and conditions of the Microsoft Permissive
 * License (MS-PL). A copy of the license can be found in the license.htm file
 * included in this distribution.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * **********************************************************************************/

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

public static class Test {
    public static void Main() {
        for (; ; ) {
            Console.Write("> ");
            string s = Console.ReadLine();

            if (string.IsNullOrEmpty(s)) {
                break;
            }

            Console.WriteLine(Pluralizer.ToPlural(s));
        }
    }
}

public static class Pluralizer {
    #region public APIs

    public static string ToPlural(string noun) {
        return AdjustCase(ToPluralInternal(noun), noun);
    }

    public static string ToSingular(string noun) {
        return AdjustCase(ToSingularInternal(noun), noun);
    }

    public static bool IsNounPluralOfNoun(string plural, string singular) {
        return String.Compare(ToSingularInternal(plural), singular, StringComparison.OrdinalIgnoreCase) == 0;
    }

    #endregion

    #region Special Words Table

    static string[] _specialWordsStringTable = new string[] {
        "agendum",          "agenda",           "",
        "albino",           "albinos",          "",
        "alga",             "algae",            "",
        "alumna",           "alumnae",          "",
        "apex",             "apices",           "apexes",
        "archipelago",      "archipelagos",     "",
        "bacterium",        "bacteria",         "",
        "beef",             "beefs",            "beeves",
        "bison",            "",                 "",
        "brother",          "brothers",         "brethren",
        "candelabrum",      "candelabra",       "",
        "carp",             "",                 "",
        "casino",           "casinos",          "",
        "child",            "children",         "",
        "chassis",          "",                 "",
        "chinese",          "",                 "",
        "clippers",         "",                 "",
        "cod",              "",                 "",
        "codex",            "codices",          "",
        "commando",         "commandos",        "",
        "corps",            "",                 "",
        "cortex",           "cortices",         "cortexes",
        "cow",              "cows",             "kine",
        "criterion",        "criteria",         "",
        "datum",            "data",             "",
        "debris",           "",                 "",
        "diabetes",         "",                 "",
        "ditto",            "dittos",           "",
        "djinn",            "",                 "",
        "dynamo",           "",                 "",
        "elk",              "",                 "",
        "embryo",           "embryos",          "",
        "ephemeris",        "ephemeris",        "ephemerides",
        "erratum",          "errata",           "",
        "extremum",         "extrema",          "",
        "fiasco",           "fiascos",          "",
        "fish",             "fishes",           "fish",
        "flounder",         "",                 "",
        "focus",            "focuses",          "foci",
        "fungus",           "fungi",            "funguses",
        "gallows",          "",                 "",
        "genie",            "genies",           "genii",
        "ghetto",           "ghettos",           "",
        "graffiti",         "",                 "",
        "headquarters",     "",                 "",
        "herpes",           "",                 "",
        "homework",         "",                 "",
        "index",            "indices",          "indexes",
        "inferno",          "infernos",         "",
        "japanese",         "",                 "",
        "jumbo",            "jumbos",            "",
        "latex",            "latices",          "latexes",
        "lingo",            "lingos",           "",
        "mackerel",         "",                 "",
        "macro",            "macros",           "",
        "manifesto",        "manifestos",       "",
        "measles",          "",                 "",
        "money",            "moneys",           "monies",
        "mongoose",         "mongooses",        "mongoose",
        "mumps",            "",                 "",
        "murex",            "murecis",          "",
        "mythos",           "mythos",           "mythoi",
        "news",             "",                 "",
        "octopus",          "octopuses",        "octopodes",
        "ovum",             "ova",              "",
        "ox",               "ox",               "oxen",
        "photo",            "photos",           "",
        "pincers",          "",                 "",
        "pliers",           "",                 "",
        "pro",              "pros",             "",
        "rabies",           "",                 "",
        "radius",           "radiuses",         "radii",
        "rhino",            "rhinos",           "",
        "salmon",           "",                 "",
        "scissors",         "",                 "",
        "series",           "",                 "",
        "shears",           "",                 "",
        "silex",            "silices",          "",
        "simplex",          "simplices",        "simplexes",
        "soliloquy",        "soliloquies",      "soliloquy",
        "species",          "",                 "",
        "stratum",          "strata",           "",
        "swine",            "",                 "",
        "trout",            "",                 "",
        "tuna",             "",                 "",
        "vertebra",         "vertebrae",        "",
        "vertex",           "vertices",         "vertexes",
        "vortex",           "vortices",         "vortexes",
    };

    #endregion

    #region Suffix Rules Table

    static string[] _suffixRulesStringTable = new string[] {
        "ch",       "ches",
        "sh",       "shes",
        "ss",       "sses",

        "ay",       "ays",
        "ey",       "eys",
        "iy",       "iys",
        "oy",       "oys",
        "uy",       "uys",
        "y",        "ies",

        "ao",       "aos",
        "eo",       "eos",
        "io",       "ios",
        "oo",       "oos",
        "uo",       "uos",
        "o",        "oes",

        "cis",      "ces",
        "sis",      "ses",
        "xis",      "xes",

        "louse",    "lice",
        "mouse",    "mice",

        "zoon",     "zoa",

        "man",      "men",

        "deer",     "deer",
        "fish",     "fish",
        "sheep",    "sheep",
        "itis",     "itis",
        "ois",      "ois",
        "pox",      "pox",
        "ox",       "oxes",

        "foot",     "feet",
        "goose",    "geese",
        "tooth",    "teeth",

        "alf",      "alves",
        "elf",      "elves",
        "olf",      "olves",
        "arf",      "arves",
        "leaf",     "leaves",
        "nife",     "nives",
        "life",     "lives",
        "wife",     "wives",
    };

    #endregion

    #region Implementation Details

    class Word {
        public readonly string Singular;
        public readonly string Plural;
        public readonly string Plural2;

        public Word(string singular, string plural, string plural2) {
            Singular = singular;
            Plural = plural;
            Plural2 = plural2;
        }
    }

    class SuffixRule {
        string _singularSuffix;
        string _pluralSuffix;

        public SuffixRule(string singular, string plural) {
            _singularSuffix = singular;
            _pluralSuffix = plural;
        }

        public bool TryToPlural(string word, out string plural) {
            if (word.EndsWith(_singularSuffix, StringComparison.OrdinalIgnoreCase)) {
                plural = word.Substring(0, word.Length - _singularSuffix.Length) + _pluralSuffix;
                return true;
            }
            else {
                plural = null;
                return false;
            }
        }

        public bool TryToSingular(string word, out string singular) {
            if (word.EndsWith(_pluralSuffix, StringComparison.OrdinalIgnoreCase)) {
                singular = word.Substring(0, word.Length - _pluralSuffix.Length) + _singularSuffix;
                return true;
            }
            else {
                singular = null;
                return false;
            }
        }
    }

    static Dictionary<string, Word> _specialSingulars;
    static Dictionary<string, Word> _specialPlurals;
    static List<SuffixRule> _suffixRules;

    static Pluralizer() {
        // populate lookup tables for special words
        _specialSingulars = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);
        _specialPlurals = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);

        for (int i = 0; i < _specialWordsStringTable.Length; i += 3) {
            string s = _specialWordsStringTable[i];
            string p = _specialWordsStringTable[i + 1];
            string p2 = _specialWordsStringTable[i + 2];

            if (string.IsNullOrEmpty(p)) {
                p = s;
            }

            Word w = new Word(s, p, p2);

            _specialSingulars.Add(s, w);
            _specialPlurals.Add(p, w);

            if (!string.IsNullOrEmpty(p2)) {
                _specialPlurals.Add(p2, w);
            }
        }

        // populate suffix rules list
        _suffixRules = new List<SuffixRule>();

        for (int i = 0; i < _suffixRulesStringTable.Length; i += 2) {
            string singular = _suffixRulesStringTable[i];
            string plural = _suffixRulesStringTable[i + 1];
            _suffixRules.Add(new SuffixRule(singular, plural));
        }
    }

    static string ToPluralInternal(string s) {
        if (string.IsNullOrEmpty(s)) {
            return s;
        }

        // lookup special words
        Word word;

        if (_specialSingulars.TryGetValue(s, out word)) {
            return word.Plural;
        }

        // apply suffix rules
        string plural;

        foreach (SuffixRule rule in _suffixRules) {
            if (rule.TryToPlural(s, out plural)) {
                return plural;
            }
        }

        // apply the default rule
        return s + "s";
    }

    static string ToSingularInternal(string s) {
        if (string.IsNullOrEmpty(s)) {
            return s;
        }

        // lookup special words
        Word word;

        if (_specialPlurals.TryGetValue(s, out word)) {
            return word.Singular;
        }

        // apply suffix rules
        string singular;

        foreach (SuffixRule rule in _suffixRules) {
            if (rule.TryToSingular(s, out singular)) {
                return singular;
            }
        }

        // apply the default rule
        if (s.EndsWith("s", StringComparison.OrdinalIgnoreCase)) {
            return s.Substring(0, s.Length-1);
        }

        return s;
    }

    static string AdjustCase(string s, string template) {
        if (string.IsNullOrEmpty(s)) {
            return s;
        }

        // determine the type of casing of the template string
        bool foundUpperOrLower = false;
        bool allLower = true;
        bool allUpper = true;
        bool firstUpper = false;

        for (int i = 0; i < template.Length; i++) {
            if (Char.IsUpper(template[i])) {
                if (i == 0) firstUpper = true;
                allLower = false;
                foundUpperOrLower = true;
            }
            else if (Char.IsLower(template[i])) {
                allUpper = false;
                foundUpperOrLower = true;
            }
        }

        // change the case according to template
        if (foundUpperOrLower) {
            if (allLower) {
                s = s.ToLowerInvariant();
            }
            else if (allUpper) {
                s = s.ToUpperInvariant();
            }
            else if (firstUpper) {
                if (!Char.IsUpper(s[0])) {
                    s = s.Substring(0, 1).ToUpperInvariant() + s.Substring(1);
                }
            }
        }

        return s;
    }

    #endregion
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级日韩免费不卡| 日韩一区二区三区在线| 日本中文一区二区三区| 国产拍揄自揄精品视频麻豆| 91成人在线观看喷潮| 国产成人激情av| 日本麻豆一区二区三区视频| 日韩伦理免费电影| 国产亚洲综合色| 欧美一级理论片| 欧美在线观看一二区| 成人手机在线视频| 精品在线亚洲视频| 亚洲va韩国va欧美va精品 | 欧美日韩国产中文| 成人网在线免费视频| 宅男在线国产精品| 99精品视频一区| 懂色av一区二区夜夜嗨| 久久国产尿小便嘘嘘| 天天综合网 天天综合色| 亚洲伦理在线精品| 成人免费小视频| 亚洲国产经典视频| 久久久99精品久久| 精品久久久久久综合日本欧美| 欧美日韩综合在线免费观看| 91丨九色丨蝌蚪富婆spa| 成人黄色大片在线观看| 国产精品一区久久久久| 久久 天天综合| 美女mm1313爽爽久久久蜜臀| 日韩精品视频网站| 天天做天天摸天天爽国产一区| 亚洲与欧洲av电影| 亚洲欧美国产77777| 亚洲人成精品久久久久| 成人欧美一区二区三区视频网页| 国产精品美女久久久久久| 国产亚洲欧洲一区高清在线观看| 精品av久久707| 精品欧美一区二区三区精品久久| 精品人在线二区三区| 日韩精品一区二区三区在线 | 高清视频一区二区| 日韩一级二级三级精品视频| 3d成人动漫网站| 日韩午夜精品视频| 日韩欧美国产成人一区二区| 日韩欧美一级精品久久| 久久日一线二线三线suv| 久久久美女艺术照精彩视频福利播放| xnxx国产精品| 国产精品伦理一区二区| 亚洲免费视频中文字幕| 亚洲永久精品国产| 免费亚洲电影在线| 国产露脸91国语对白| 成人国产一区二区三区精品| 91在线视频观看| 欧美日韩二区三区| 日韩精品一区二区三区在线播放 | 日韩免费高清视频| 久久久一区二区三区捆绑**| 中文字幕免费不卡在线| 亚洲精品videosex极品| 日韩二区三区四区| 国产91丝袜在线播放| 色88888久久久久久影院野外| 欧美久久高跟鞋激| 国产亚洲一区二区三区| 亚洲欧洲av另类| 日本色综合中文字幕| 国产麻豆精品久久一二三| 91免费视频观看| 91精品国产综合久久精品| 久久久久久久久久看片| 一区二区三区在线视频免费| 免费成人在线观看视频| 不卡的电影网站| 亚洲午夜久久久久久久久久久| 日本aⅴ免费视频一区二区三区 | 免费观看日韩电影| 粉嫩av亚洲一区二区图片| 在线观看网站黄不卡| 精品日韩99亚洲| 亚洲人成7777| 国产精品综合二区| 欧美日韩久久久一区| 欧美激情综合五月色丁香小说| 夜夜嗨av一区二区三区中文字幕| 久久99精品久久久久婷婷| 一本一道综合狠狠老| 精品国产乱码久久久久久影片| 亚洲精品日韩专区silk| 国产中文一区二区三区| 欧美丝袜丝交足nylons| 亚洲国产激情av| 蜜臂av日日欢夜夜爽一区| 色天使色偷偷av一区二区| 久久伊人蜜桃av一区二区| 午夜精品久久一牛影视| 91香蕉视频mp4| 国产日产精品1区| 日本麻豆一区二区三区视频| 色偷偷久久一区二区三区| 国产日韩精品久久久| 六月婷婷色综合| 欧美男女性生活在线直播观看| 亚洲三级久久久| 成人听书哪个软件好| 日韩成人免费电影| 欧美综合欧美视频| 椎名由奈av一区二区三区| 国产在线播放一区二区三区| 8x8x8国产精品| 亚洲一卡二卡三卡四卡五卡| 97se亚洲国产综合自在线| 国产精品污网站| 国产精品88888| 亚洲精品在线观看网站| 美女网站色91| 日韩一级片在线播放| 天天综合网天天综合色| 欧美色窝79yyyycom| 一区二区三区波多野结衣在线观看 | 国产一区二区三区免费看| 欧美一区二区网站| 日韩精品视频网| 91精品欧美一区二区三区综合在 | 成人h动漫精品一区二区| 久久嫩草精品久久久精品| 久久99国产精品麻豆| 欧美裸体bbwbbwbbw| 视频一区中文字幕| 555夜色666亚洲国产免| 日韩中文字幕区一区有砖一区| 欧美精品日韩一区| 日韩精品电影一区亚洲| 制服视频三区第一页精品| 日韩va亚洲va欧美va久久| 欧美肥妇free| 欧美视频在线一区二区三区| 亚洲狠狠丁香婷婷综合久久久| 92国产精品观看| 亚洲综合色视频| 制服丝袜亚洲播放| 国产自产高清不卡| 日本一区二区久久| 91丨porny丨国产| 亚洲国产cao| 欧美一激情一区二区三区| 黄页网站大全一区二区| 日本一区二区成人在线| 91在线观看美女| 婷婷成人激情在线网| 久久综合精品国产一区二区三区| 国产+成+人+亚洲欧洲自线| 亚洲欧美日韩综合aⅴ视频| 欧美性大战久久久久久久蜜臀| 日韩在线观看一区二区| 精品欧美一区二区三区精品久久 | 成人爱爱电影网址| 一二三四社区欧美黄| 欧美一区二区三级| 国产高清不卡一区二区| 亚洲人精品午夜| 91精品国产乱| 国产91色综合久久免费分享| 亚洲免费资源在线播放| 91精品国产综合久久久久| 国产资源在线一区| 一区二区三区.www| 精品粉嫩aⅴ一区二区三区四区| www.成人网.com| 日韩国产在线一| 国产精品国产自产拍高清av| 欧美吞精做爰啪啪高潮| 欧美一级高清片| 丰满少妇在线播放bd日韩电影| 亚洲精品国久久99热| 精品久久久久99| 色av综合在线| 国产一区二三区好的| 亚洲精品乱码久久久久久黑人| 欧美成人精品1314www| 一本大道久久精品懂色aⅴ| 日本一道高清亚洲日美韩| 日韩一区中文字幕| 欧美变态凌虐bdsm| 日本精品视频一区二区| 国产精品99久久久| 日韩精品乱码免费| 亚洲男人电影天堂| 国产色婷婷亚洲99精品小说| 欧美乱熟臀69xxxxxx| 91在线视频播放地址| 国产不卡视频一区二区三区| 日韩精品福利网| 亚洲无人区一区|