public void Test06CountVowels() { Macroscope ms = new Macroscope(); MacroscopeAnalyzeReadabilityFleschKincaid AnalyzeReadability = new MacroscopeAnalyzeReadabilityFleschKincaid(); Dictionary <string, int> SampleTexts = new Dictionary <string, int> (); SampleTexts.Add("Aaron", 2); SampleTexts.Add("Aardvark", 2); SampleTexts.Add("Oolite", 2); SampleTexts.Add("Aaniipuubeedoo", 5); SampleTexts.Add("Zaaniipuubeedooxx", 5); SampleTexts.Add("Yahoo", 2); SampleTexts.Add("Gym", 1); SampleTexts.Add("Yesterday", 3); foreach (String Word in SampleTexts.Keys) { string Flattened = AnalyzeReadability.FlattenDipthongs(WordText: Word.ToLower()); ms.DebugMsg(string.Format("Flattened: {0}", Flattened)); string Subtracted = AnalyzeReadability.SubtractSilentVowel(WordText: Word.ToLower()); ms.DebugMsg(string.Format("Subtracted: {0}", Subtracted)); double VowelCount = AnalyzeReadability.CountVowels(WordText: Subtracted); ms.DebugMsg(string.Format("VowelCount: {0} => {1}", Word, VowelCount)); Assert.AreEqual(SampleTexts[Word], VowelCount, string.Format("Unexpected vowel count: {0}", Word)); } }
public void Test05FlattenDipthongs() { Macroscope ms = new Macroscope(); MacroscopeAnalyzeReadabilityFleschKincaid AnalyzeReadability = new MacroscopeAnalyzeReadabilityFleschKincaid(); Dictionary <string, string> SampleTexts = new Dictionary <string, string> (); SampleTexts.Add("Aaron", "aron"); SampleTexts.Add("Aardvark", "ardvark"); SampleTexts.Add("Oolite", "olite"); SampleTexts.Add("Aaniipuubeedoo", "anipubedo"); SampleTexts.Add("Zaaniipuubeedooxx", "zanipubedoxx"); SampleTexts.Add("Quick", "quck"); foreach (String Word in SampleTexts.Keys) { string Flattened = AnalyzeReadability.FlattenDipthongs(WordText: Word.ToLower()); ms.DebugMsg(string.Format("Flattened: {0} => {1}", Word, Flattened)); Assert.AreEqual(SampleTexts[Word], Flattened, "Unexpected flattened dipthong"); } }