Example #1
0
        public virtual double GetPreference(Matched Matched)
        {
            if (Matched is ModifiedMatched)
            {
                return(Matched.GetPreference(this));
            }

            double P = 0;

            if (_Vowel == Matched.Vowel && _Vowel)
            {
                Pair <double, double> CX = ClosestPair(_VowelX, Matched.VowelX);
                Pair <double, double> CY = ClosestPair(_VowelY, Matched.VowelY);
                P += (1 - (Math.Abs(CX.First - CX.Second) + Math.Abs(CY.First - CY.Second)));
            }
            if (_Consonant == Matched.Consonant && _Consonant)
            {
                Pair <double, double> CX = ClosestPair(_ConsonantX, Matched.ConsonantX);
                Pair <double, double> CY = ClosestPair(_ConsonantY, Matched.ConsonantY);
                P += (1 - (Math.Abs(CX.First - CX.Second) + Math.Abs(CY.First - CY.Second)));
            }
            if (_Alternate == Matched.Alternate)
            {
                P += .1;
            }
            if (_Sibilant == Matched._Sibilant)
            {
                P += .4;
            }
            if (_Liquid == Matched.Liquid)
            {
                P += .4;
            }
            return(P - Matched.Drop);
        }
Example #2
0
 public override double GetPreference(Matched Matched)
 {
     return((base.GetPreference(Matched) + _Base.GetPreference(Matched)) / 2 - .1);
 }