コード例 #1
0
        public override ProbableStrength IsMatch(PhraseAttribute attribute)
        {
            if (attribute is NumberAttribute)
            {
                NumberAttribute numberAttribute = (NumberAttribute)attribute;
                if (numberAttribute.number == number)
                    return ProbableStrength.Full;
                else if (numberAttribute.number == NumberOptions.Zero || number == NumberOptions.Zero)
                    return ProbableStrength.Half;
                else
                    return ProbableStrength.Zero;
            }

            return ProbableStrength.None;
        }
コード例 #2
0
 public override PhraseAttribute Guess(InformedPhrase word)
 {
     ProbableStrength plural = SeemsPlural(word);
     if (plural.strength > .5)
     {
         NumberAttribute result = new NumberAttribute(NumberOptions.Many);
         result.strength.strength = 2.0 * (plural.strength - 0.5);
         result.strength.weight = plural.weight;
         return result;
     }
     else
     {
         NumberAttribute result = new NumberAttribute(NumberOptions.One);
         result.strength.strength = 2.0 * (.5 - plural.strength);
         result.strength.weight = plural.weight;
         return result;
     }
 }
コード例 #3
0
 public override PhraseAttribute Guess(InformedPhrase word)
 {
     ProbableStrength plural = SeemsPlural(word);
     if (plural.strength > .5)
     {
         NumberAttribute result = new NumberAttribute(NumberOptions.Many);
         result.strength.strength = 2.0 * (plural.strength - 0.5);
         result.strength.weight = plural.weight;
         return result;
     }
     else
     {
         NumberAttribute result = new NumberAttribute(NumberOptions.One);
         result.strength.strength = 2.0 * (.5 - plural.strength);
         result.strength.weight = plural.weight;
         return result;
     }
 }