private void Phonetic_SelectedIndexChanged(object sender, EventArgs e) { switch (phoneticComboBox.SelectedIndex) { case 0: phonetic = new Soundex(); inputTextBox_TextChanged(sender, e); break; case 1: phonetic = new DaitchMokotoff(); inputTextBox_TextChanged(sender, e); break; case 2: phonetic = new Metaphone(); inputTextBox_TextChanged(sender, e); break; case 3: phonetic = new DoubleMetaphone(); inputTextBox_TextChanged(sender, e); break; } }
private long Measure(IPhonetic phontic) { TextReader reader = new StringReader(wordListTextBox.Text); long begin,end; string word = ""; begin = System.DateTime.Now.Ticks; while((word = reader.ReadLine()) != null) { phontic.GenerateKey(word); } end = System.DateTime.Now.Ticks; return (end - begin); }
public static string ToPhonetic( this string str, IPhonetic phonetic) { return(phonetic.Translate(str)); }