public ModifiedMatched Combine(Matched Matched) { if (_Vowel == Matched.Vowel || _Consonant == Matched.Consonant) { ModifiedMatched New = new ModifiedMatched(this, Matched); New.Name = _Name + Matched.Name; New.Vowel = _Vowel && Matched.Vowel; New.Consonant = _Consonant && Matched.Consonant; if (New.Consonant) { New.ConsonantX = Matched.ConsonantX == null ? _ConsonantX : Matched.ConsonantX; New.ConsonantY = Matched.ConsonantY == null ? _ConsonantY : Matched.ConsonantY; } if (New.Vowel) { New.VowelX = Matched.VowelX == null ? _VowelX : Matched.VowelX; New.VowelY = Matched.VowelY == null ? _VowelY : Matched.VowelY; } if (Matched._SetAlternate) { New.Alternate = Matched.Alternate; } return(New); } else { return(null); } }
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); }
public override double GetPreference(Matched Matched) { return((base.GetPreference(Matched) + _Base.GetPreference(Matched)) / 2 - .1); }
public ModifiedMatched(Matched Base, Matched Modifier) { _Base = Base; _Modifier = Modifier; }