protected void BreakWord(string word, string expected) { List <Syllable> syllables = syllableBreaker.BreakWord(word); string result = string.Join("-", syllables); Assert.AreEqual(expected, result); }
static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; if (args.Length < 1) { Console.WriteLine("Usage: SyllableSplitter.exe <ConfigFile> [<TextFile>]"); return; } Configuration conf = Configuration.Read(args[0]); var syllableBreaker = new SyllableBreaker(conf, true); WordReader reader = new WordReader(args.Length >= 2 ? args[1] : null); string word; var processedWords = new HashSet <string>(); while ((word = reader.GetNextWord()) != null) { word = word.ToLower(); if (processedWords.Contains(word)) { continue; } processedWords.Add(word); try { var syllables = syllableBreaker.BreakWord(word); Console.WriteLine($"{word}={SyllableBreaker.ToString(syllables)}"); } catch (ArgumentException e) { Console.WriteLine($"Error: {e.Message}"); } } reader.Close(); syllableBreaker.ProcessClusters(); PrintConsonantClusters(syllableBreaker); }