コード例 #1
0
        public static double CountDistance(Reading reading, VowelModel model, bool use4thFormant)
        {
            double d1 = reading.rel_F1 - model.f1;
            double d2 = reading.rel_F2 - model.f2;
            double d3 = reading.rel_F3 - model.f3;
            double d4 = 0;

            if (use4thFormant)
            {
                d4 = reading.rel_F4 - model.f4;
            }

            d1 = Math.Pow(d1, 2);
            d2 = Math.Pow(d2, 2);
            d3 = Math.Pow(d3, 2);
            if (use4thFormant)
            {
                d4 = Math.Pow(d4, 2);
            }

            //dodaję wagi
            d1 = d1 * weights[0];
            d2 = d2 * weights[1];
            d3 = d3 * weights[2];
            if (use4thFormant)
            {
                d4 = d4 * weights[3];
            }


            return(Math.Pow(d1 + d2 + d3 + d4, 0.5));
        }
コード例 #2
0
 public VowelRecognition(OldPolishVowels oldPolishVowel, Frequency conditionalMedian, int counter, List <string> examples, int continuants, int contexts, VowelCode vowelCode, VowelModel recognition, string ipaSymbol)
 {
     this.OldPolishVowel          = oldPolishVowel;
     this.ConditionalMedian       = conditionalMedian;
     this.Counter                 = counter;
     this.Examples                = examples;
     this.PercentageOnContexts    = (double)counter / contexts;
     this.PercentageOnContinuants = (double)counter / continuants;
     this.VowelCode               = vowelCode;
     this.IpaSymbol               = ipaSymbol;
 }