Пример #1
0
 private string TryConcatenate(string word, string wordStart, string wordEnd, PhoneticTable phoneticTable)
 {
     if (word == wordStart + wordEnd)
     {
         return phoneticTable.GetPhoneticValueOf(wordStart) + " [dash] " + phoneticTable.GetPhoneticValueOf(wordEnd);
     }
     else
     {
         return null;
     }
 }
Пример #2
0
 private string GetPhoneticValue(string word, PhoneticTable phoneticTable)
 {
     string phoneticValue = phoneticTable.GetPhoneticValueOf(word);
     if (phoneticValue == null)
         phoneticValue = GetPhoneticValueOfWordUsingSimilarWordEnding(word, phoneticTable);
     return phoneticValue;
 }
Пример #3
0
 private string GetWordEndsWith(string englishEnding, PhoneticTable phoneticTable)
 {
     foreach (HomophoneGroup homophoneGroup in phoneticTable)
     {
         foreach (string currentWord in homophoneGroup)
         {
             if (currentWord.EndsWith(englishEnding))
             {
                 return phoneticTable.GetPhoneticValueOf(currentWord);
             }
         }
     }
     return null;
 }
Пример #4
0
        private string GetPhoneticValueOfWordUsingSimilarWordEnding(string word, PhoneticTable phoneticTable)
        {
            string englishEnding;
            if (word.Length >= howManyEnglishLetterForEnding)
                englishEnding = word.Substring(word.Length - howManyEnglishLetterForEnding);
            else
                englishEnding = word;

            string similarWord = GetWordEndsWith(englishEnding, phoneticTable);

            if (similarWord == null)
                return null;

            return phoneticTable.GetPhoneticValueOf(similarWord);
        }