Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // words to be tested
            List<int> wordsToBeTested = new List<int>();
            for(int i = 1; i <= 100; i++)
               wordsToBeTested.Add(i);
            //wordsToBeTested.Add(1);

            // samples to be tested
            List<int> samplesToBeTested = new List<int>();
            samplesToBeTested.Add(1);
            samplesToBeTested.Add(2);
            samplesToBeTested.Add(3);
            samplesToBeTested.Add(4);
            samplesToBeTested.Add(5);

            // audio directory
            List<string> audioDirectory = new List<string>();
            audioDirectory.Add("C:\\Users\\Administrator\\Documents\\Visual Studio 2008\\Projects\\cmuspeechrecognition_cmuspeechmain\\test_data\\audio\\092910_123758_Hebrew");
            audioDirectory.Add("C:\\Users\\Administrator\\Documents\\Visual Studio 2008\\Projects\\cmuspeechrecognition_cmuspeechmain\\test_data\\audio\\101410_140344_Hebrew");
            audioDirectory.Add("C:\\Users\\Administrator\\Documents\\Visual Studio 2008\\Projects\\cmuspeechrecognition_cmuspeechmain\\test_data\\audio\\101510_111237_Hebrew");
            // audio file names
            List<string> audioFileNames = new List<string>();
            audioFileNames.Add("[Wed_(Sep_29_2010)_12-37-58]_4124143701_");
            audioFileNames.Add("[Thu_(Oct_14_2010)_14-03-44]_4122688595_");
            audioFileNames.Add("[Fri_(Oct_15_2010)_11-12-37]_4126203298_");

            for (int i = 0; i < 3; i++)
            {
                List<int> speakersToBeTested = new List<int>();
                speakersToBeTested.Add(i);
                // set up data
                data = new Data(audioDirectory, audioFileNames, 5, speakersToBeTested, wordsToBeTested, samplesToBeTested,
                    "C:\\Users\\Administrator\\Documents\\Visual Studio 2008\\Projects\\cmuspeechrecognition_cmuspeechmain\\test_data\\config_files\\config.txt.100.english");

                // setup grammar
                GrammarCreator gc = new GrammarCreator("C:\\Users\\Administrator\\Documents\\Visual Studio 2008\\Projects\\cmuspeechrecognition_cmuspeechmain\\test_data", "Hebrew", "allcombinations");

                // setup training
                TrainingAlgorithm ta = new TrainingAlgorithm(gc, data, 10, 15);

                ta.LearnAllWords();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Given a list of speakers and the samples per speakers to train on, training is carried out to produce a List of pronunciations
        /// </summary>
        /// <param name="speakerList">list of speakers for training</param>
        /// <param name="sampleList">list of samples for training</param>
        /// <returns>List of pronunciations</returns>
        private Dictionary<string, List<string>> trainAllWords(List<int> speakerList, List<int> sampleList)
        {
            string speaker = "speaker-";
            for (int i = 0; i < speakerList.Count; i++)
            {
                speaker += speakerList[i].ToString()+"_";
            }
            string sample = "sample-";

            List<int> trueSampleList = new List<int>();
            trueSampleList.AddRange(sampleList);
            for (int i = 0; i < trueSampleList.Count; i++)
            {
                trueSampleList[i]++;
                sample += trueSampleList[i].ToString() + "_";
            }
            System.Diagnostics.Debug.WriteLine("training " + speaker +  sample);

            // words to be tested
            List<int> wordsToBeTested = new List<int>();
             for (int i = 1; i <= MWordTypes; i++)
                 wordsToBeTested.Add(i);

             // set up data
             Data tempData = new Data(data.audioDirectory, data.audioFileName, data.numberOfSamplesPerWord, speakerList, wordsToBeTested, trueSampleList,
                 data.wordListPath);

             // setup grammar
             GrammarCreator gc = new GrammarCreator(grammarDirectory, data.language + speaker + sample, "allcombinations");

             // setup training
             TrainingAlgorithm ta = new TrainingAlgorithm(gc, tempData, numberOfAlternates, 15);

             return ta.LearnAllWords();
        }