本文整理汇总了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)));
}
}
}
示例2: AdjectiveWordToken
public AdjectiveWordToken(string text, InflectionCase inflectionCase,
GrammaticalGender grammaticalGender, DecliantionNumber decliantionNumber, AdjectiveLevel level)
: base(text, inflectionCase, decliantionNumber)
{
this.level = level;
this.genre = grammaticalGender;
}
示例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);
}
示例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]);
}
}
示例5: ItalianCardinalNumberCruncher
public ItalianCardinalNumberCruncher(int number, GrammaticalGender gender)
{
_fullNumber = number;
_threeDigitParts = SplitEveryThreeDigits(number);
_gender = gender;
_nextSet = ThreeDigitSets.Units;
}
示例6: Convert
public override string Convert(int number, string numberString, GrammaticalGender gender)
{
// N/A in Dutch
if (number == 0)
return "0";
return numberString + "e";
}
示例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;
}
示例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();
}
示例9: GetUnits
protected static string GetUnits(int number, GrammaticalGender gender)
{
if (number == 1 && gender == GrammaticalGender.Feminine)
{
return "une";
}
return UnitsMap[number];
}
示例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);
}
示例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 + "-е";
}
示例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;
}
示例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 + ".º";
}
示例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 + "º";
}
示例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);
}