Exemplo n.º 1
0
        /// <summary>
        /// Zwraca liczbę całkowitą oznaczającą nasycenie próbki gwaryzmami fonetycznymi
        /// </summary>
        /// <param name="readings">Lista odczytów.</param>
        /// <param name="condition">Warunek.</param>
        /// <returns>LIczba gwaryzmów.</returns>
        public static int N(List <Reading> readings, Condition condition)
        {
            int res = 0;

            foreach (var i in readings)
            {
                if (i.PhoneStringG.Count == i.PhoneStringS.Count
                    &&
                    i.PhoneStringG.Count == i.PhoneStringO.Count
                    &&
                    ApsManager.ConditionChecker(i, condition)
                    )
                {
                    for (int j = 0; j < i.PhoneStringG.Count; j++)
                    {
                        if (!i.PhoneStringG[j].Equals(i.PhoneStringS[j])
                            ||
                            !i.PhoneStringG[j].Equals(i.PhoneStringO[j])
                            )
                        {
                            res++;
                        }
                    }
                }
            }

            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Zwraca liczbę wyrazów tekstowych, zliczając liczbę symboli końca wyrazu.
        /// </summary>
        /// <param name="readings">Lista odczytów.</param>
        /// <param name="condition">Warunek.</param>
        /// <returns>Liczba wyrazów tekstowych.</returns>
        public static int W(List <Reading> readings, Condition condition)
        {
            int res = 0;

            foreach (var i in readings)
            {
                if (ApsManager.ConditionChecker(i, condition))
                {
                    res += i.PhoneStringA.Count(x => x.Symbol.IPA.Contains('#'));
                }
            }

            return(res);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Zwraca sumę różnic artykulacyjnych między dwiema próbkami
        /// </summary>
        /// <param name="readings"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static int R(List <Reading> readings, Condition conditionA, Condition conditionB, bool use4thFormant = false)
        {
            var resA = new List <VowelRecognition>();
            var resB = new List <VowelRecognition>();

            int contextsA = ApsManager.ConditionalCount(readings, conditionA);
            int contextsB = ApsManager.ConditionalCount(readings, conditionB);

            foreach (var i in ApsInterface.oldPolishVowels)
            {
                int continuantsA = ApsManager.ConditionalCount(readings, new Condition(i));
                int continuantsB = ApsManager.ConditionalCount(readings, new Condition(i));

                var medianA = ApsManager.ConditionalMedian(readings, conditionA);
                var medianB = ApsManager.ConditionalMedian(readings, conditionB);


                var counterA = ApsManager.ConditionalCount(readings, conditionA);
                var counterB = ApsManager.ConditionalCount(readings, conditionB);

                var examplesA = ApsManager.GetExamples(readings, conditionA);
                var examplesB = ApsManager.GetExamples(readings, conditionB);

                var recognitionA = ApsManager.FindModel(new Reading(medianA), Program.Models, use4thFormant);
                var recognitionB = ApsManager.FindModel(new Reading(medianB), Program.Models, use4thFormant);

                var vowelCodeA = VowelCode.CodeFromString(recognitionA.Code);
                var vowelCodeB = VowelCode.CodeFromString(recognitionB.Code);

                var ipaSymbolA = recognitionA.Symbol;
                var ipaSymbolB = recognitionB.Symbol;


                resA.Add(new VowelRecognition(i, medianA, counterA, examplesA, continuantsA, contextsA, vowelCodeA, recognitionA, ipaSymbolA));
                resB.Add(new VowelRecognition(i, medianB, counterB, examplesB, continuantsB, contextsB, vowelCodeB, recognitionB, ipaSymbolB));
            }


            return(R(resA, resB));
        }