当前位置: 首页>>代码示例>>C#>>正文


C# GrammaticalGender类代码示例

本文整理汇总了C#中GrammaticalGender的典型用法代码示例。如果您正苦于以下问题:C# GrammaticalGender类的具体用法?C# GrammaticalGender怎么用?C# GrammaticalGender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GrammaticalGender类属于命名空间,在下文中一共展示了GrammaticalGender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CollectPartsUnderAHundred

 protected virtual void CollectPartsUnderAHundred(ICollection<string> parts, ref int number, GrammaticalGender gender, bool pluralize)
 {
     if (number < 20)
     {
         parts.Add(GetUnits(number, gender));
     }
     else
     {
         var units = number%10;
         var tens = GetTens(number/10);
         if (units == 0)
         {
             parts.Add(tens);
         }
         else if (units == 1)
         {
             parts.Add(tens);
             parts.Add("et");
             parts.Add(GetUnits(1, gender));
         }
         else
         {
             parts.Add(string.Format("{0}-{1}", tens, GetUnits(units, gender)));
         }
     }
 }
开发者ID:Alexander882,项目名称:Humanizer,代码行数:26,代码来源:FrenchNumberToWordsConverterBase.cs

示例2: AdjectiveWordToken

 public AdjectiveWordToken(string text, InflectionCase inflectionCase,
     GrammaticalGender grammaticalGender, DecliantionNumber decliantionNumber, AdjectiveLevel level)
     : base(text, inflectionCase, decliantionNumber)
 {
     this.level = level;
     this.genre = grammaticalGender;
 }
开发者ID:Sebastian-Gruchacz,项目名称:Flaksator,代码行数:7,代码来源:AdjectiveWordToken.cs

示例3: Convert

        public override string Convert(int number, string numberString, GrammaticalGender gender)
        {
            // No ordinal for 0 (zero) in Romanian.
            if (number == 0)
            {
                return "0";
            }

            // Exception from the rule.
            if (number == 1)
            {
                if (gender == GrammaticalGender.Feminine)
                {
                    return "prima"; // întâia
                }

                return "primul"; // întâiul
            }

            if (gender == GrammaticalGender.Feminine)
            {
                return string.Format("a {0}-a", numberString);
            }

            return string.Format("al {0}-lea", numberString);

        }
开发者ID:ninwnj,项目名称:Humanizer,代码行数:27,代码来源:RomanianOrdinalizer.cs

示例4: CollectPartsUnderOneThousand

        private static void CollectPartsUnderOneThousand(ICollection<string> parts, int number, GrammaticalGender gender)
        {
            if (number >= 100)
            {
                var hundreds = number/100;
                number %= 100;
                parts.Add(HundredsMap[hundreds]);
            }

            if (number >= 20)
            {
                var tens = number/10;
                parts.Add(TensMap[tens]);
                number %= 10;
            }

            if (number > 0)
            {
                if (number == 1 && gender == GrammaticalGender.Feminine)
                    parts.Add("одна");
                else if (number == 1 && gender == GrammaticalGender.Neuter)
                    parts.Add("одне");
                else if (number == 2 && gender == GrammaticalGender.Feminine)
                    parts.Add("дві");
                else if (number < 20)
                    parts.Add(UnitsMap[number]);
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:Humanizer,代码行数:28,代码来源:UkrainianNumberToWordsConverter.cs

示例5: ItalianCardinalNumberCruncher

 public ItalianCardinalNumberCruncher(int number, GrammaticalGender gender)
 {
     _fullNumber = number;
     _threeDigitParts = SplitEveryThreeDigits(number);
     _gender = gender;
     _nextSet = ThreeDigitSets.Units;
 }
开发者ID:transformersprimeabcxyz,项目名称:Humanizer,代码行数:7,代码来源:ItalianCardinalNumberCruncher.cs

示例6: Convert

        public override string Convert(int number, string numberString, GrammaticalGender gender)
        {
            // N/A in Dutch
            if (number == 0)
                return "0";

            return numberString + "e";
        }
开发者ID:transformersprimeabcxyz,项目名称:Humanizer,代码行数:8,代码来源:DutchOrdinalizer.cs

示例7: GetForm

        public string GetForm(GrammaticalGender genre, InflectionCase aCase, DecliantionNumber amount, AdjectiveLevel level)
        {
            AdjectiveWordToken token = new AdjectiveWordToken(null, aCase, genre, amount, level);
            foreach (AdjectiveWordToken tok in Irregulars)
                if (tok.Is(token))
                    return tok.Text;

            return null;
        }
开发者ID:Sebastian-Gruchacz,项目名称:Flaksator,代码行数:9,代码来源:Adjective.cs

示例8: Convert

 public override string Convert(int number, GrammaticalGender gender)
 {
     if (number < 0)
         return "meno " + Convert(Math.Abs(number), gender);
 
     var cruncher = new ItalianCardinalNumberCruncher(number, gender);
     
     return cruncher.Convert();
 }
开发者ID:ninwnj,项目名称:Humanizer,代码行数:9,代码来源:ItalianNumberToWordsConverter.cs

示例9: GetUnits

        protected static string GetUnits(int number, GrammaticalGender gender)
        {
            if (number == 1 && gender == GrammaticalGender.Feminine)
            {
                return "une";
            }

            return UnitsMap[number];
        }
开发者ID:Alexander882,项目名称:Humanizer,代码行数:9,代码来源:FrenchNumberToWordsConverterBase.cs

示例10: CollectPartsUnderAHundred

 protected override void CollectPartsUnderAHundred(ICollection<string> parts, ref int number, GrammaticalGender gender, bool pluralize)
 {
     if (number == 80)
         parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt");
     else if (number == 81)
         parts.Add(gender == GrammaticalGender.Feminine ? "quatre-vingt-une" : "quatre-vingt-un");
     else
         base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize);
 }
开发者ID:Alexander882,项目名称:Humanizer,代码行数:9,代码来源:FrenchBelgianNumberToWordsConverter.cs

示例11: Convert

        public override string Convert(int number, string numberString, GrammaticalGender gender)
        {
            if (gender == GrammaticalGender.Masculine)
                return numberString + "-й";
            
            if (gender == GrammaticalGender.Feminine)
                return numberString + "-я";

            return numberString + "-е";
        }
开发者ID:BrainCrumbz,项目名称:Humanizer,代码行数:10,代码来源:RussianOrdinalizer.cs

示例12: NounPostfixToken

        public NounPostfixToken(GrammaticalGender grammaticalGender, InflectionCase inflectionCase, DecliantionNumber decliantionNumber,
            string wordDeclination, params string[] wordPostfixes)
        {
            this.genre = grammaticalGender;
            this.inflectionCase = inflectionCase;
            this.amount = decliantionNumber;
            this.nounDeclination = wordDeclination;
            this.postfixes = wordPostfixes;

        }
开发者ID:Sebastian-Gruchacz,项目名称:Flaksator,代码行数:10,代码来源:NounPostfixToken.cs

示例13: Convert

        public override string Convert(int number, string numberString, GrammaticalGender gender)
        {
            // N/A in Spanish
            if (number == 0)
                return "0";

            if (gender == GrammaticalGender.Feminine)
                return numberString + ".ª";           
            else
                return numberString + ".º";
        }
开发者ID:hgdiaz,项目名称:Humanizer,代码行数:11,代码来源:SpanishOrdinalizer.cs

示例14: Convert

        public override string Convert(int number, string numberString, GrammaticalGender gender)
        {
            // N/A in Portuguese
            if (number == 0)
                return "0";

            if (gender == GrammaticalGender.Feminine)
                return numberString + "ª";

            return numberString + "º";
        }
开发者ID:transformersprimeabcxyz,项目名称:Humanizer,代码行数:11,代码来源:PortugueseOrdinalizer.cs

示例15: ConvertToOrdinal

        public override string ConvertToOrdinal(int number, GrammaticalGender gender)
        {
            if (number == 0)
                return "null" + GetEndingForGender(gender);

            var parts = new List<string>();
            if (number < 0)
            {
                parts.Add("minus ");
                number = -number;
            }

            var billions = number/1000000000;
            if (billions > 0)
            {
                number %= 1000000000;
                var noRest = NoRestIndex(number);
                parts.Add(Part(BillionOrdinalPlural[noRest], BillionOrdinalSingular[noRest], billions));
            }

            var millions = number/1000000;
            if (millions > 0)
            {
                number %= 1000000;
                var noRest = NoRestIndex(number);
                parts.Add(Part(MillionOrdinalPlural[noRest], MillionOrdinalSingular[noRest], millions));
            }

            var thousands = number/1000;
            if (thousands > 0)
            {
                parts.Add(Part("{0}tausend", "eintausend", thousands));
                number %= 1000;
            }

            var hundreds = number/100;
            if (hundreds > 0)
            {
                parts.Add(Part("{0}hundert", "einhundert", hundreds));
                number %= 100;
            }

            if (number > 0)
                parts.Add(number < 20 ? UnitsOrdinal[number] : Convert(number));

            if (number == 0 || number >= 20)
                parts.Add("s");

            parts.Add(GetEndingForGender(gender));

            return string.Join("", parts);
        }
开发者ID:hgdiaz,项目名称:Humanizer,代码行数:52,代码来源:GermanNumberToWordsConverter.cs


注:本文中的GrammaticalGender类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。