예제 #1
0
        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));
            }
        }
예제 #2
0
        public void Test04SubtractSilentVowel()
        {
            Macroscope ms = new Macroscope();
            MacroscopeAnalyzeReadabilityFleschKincaid AnalyzeReadability = new MacroscopeAnalyzeReadabilityFleschKincaid();

            Dictionary <string, string> SampleTexts = new Dictionary <string, string> ();

            SampleTexts.Add("Ride", "rid");
            SampleTexts.Add("Abide", "abid");
            SampleTexts.Add("Hello", "hello");
            SampleTexts.Add("Release", "releas");
            SampleTexts.Add("Gonzo", "gonzo");

            foreach (String Word in SampleTexts.Keys)
            {
                string Subtracted = AnalyzeReadability.SubtractSilentVowel(WordText: Word.ToLower());

                ms.DebugMsg(string.Format("Subtracted: {0} => {1}", Word, Subtracted));

                Assert.AreEqual(SampleTexts[Word], Subtracted, string.Format("Unexpected subtracted vowel: {0}", Subtracted));
            }
        }