Пример #1
0
        public void Expand(PhoneticTable phoneticTable, WordListFile frequentWordListFile)
        {
            string phoneticValue;

            int countBefore;

            do
            {
                countBefore = phoneticTable.Count;
                foreach (string word in frequentWordListFile)
                {
                    if (!phoneticTable.Contains(word))
                    {
                        phoneticValue = null;

                        if (phoneticValue == null)
                            phoneticValue = phoneticConcatenator.TryConcatenate(word, phoneticTable);

                        if (phoneticValue == null)
                            phoneticValue = phoneticSplitter.TrySplit(word, phoneticTable);

                        if (phoneticValue != null)
                            phoneticTable.Add(word, phoneticValue);
                    }
                }
            } while (countBefore != phoneticTable.Count);
        }
Пример #2
0
        public void Build(PhoneticTable phoneticTable, WordListFile frequentWordListFile, string rhymeChartFile)
        {
            string phoneticValue;

            using (StreamWriter streamWriter = new StreamWriter(rhymeChartFile))
            {
                foreach (string word in frequentWordListFile)
                {
                    phoneticValue = GetPhoneticValue(word,phoneticTable);
                    if (phoneticValue != null)
                    {
                        streamWriter.WriteLine(word + " : " + GetPhoneticEnding(phoneticValue));
                    }
                }
            }
        }
Пример #3
0
        public static void Build(WordListFile frequentWordListFile, string phoneticTableFile)
        {
            HashSet<string> wordCache = BuildWordCache(phoneticTableFile);
            string fromWord;
            string toWord;

            while (true)
            {
                fromWord = frequentWordListFile.GetNextWordNotIn(wordCache);
                wordCache.Add(fromWord);
                toWord = PhoneticBot.Translate(fromWord);
                if (toWord != null)
                    AppendTableElement(fromWord, toWord, phoneticTableFile);

                Console.WriteLine(toWord);

                Thread.Sleep(random.Next(1000, 6000));
            }
        }