Esempio n. 1
0
        private int TotalNumberOfLexicalElements()
        {
            int totalLexicalElements = 0;

            while (LexicalIterator.HasNext())
            {
                totalLexicalElements += 1;
                LexicalIterator.MoveNext();
            }
            return(totalLexicalElements);
        }
Esempio n. 2
0
        //REQUIRED METHODS
        public int Size()
        {
            int totalCount = 0;

            while (LexicalIterator.HasNext())
            {
                totalCount += 1;
                LexicalIterator.MoveNext();
            }
            return(totalCount);
        }
Esempio n. 3
0
        public Dictionary <string, int> CountOf(params string[] letterOrWords)
        {
            Dictionary <string, int> countOfLexicalElements = new Dictionary <string, int>();

            foreach (var lexicalElement in letterOrWords)
            {
                int total_occurrences = 0;
                while (LexicalIterator.HasNext())
                {
                    if (LexicalIterator.MoveNext() == lexicalElement)
                    {
                        total_occurrences += 1;
                    }
                }
                countOfLexicalElements.Add(lexicalElement, total_occurrences);
            }
            return(countOfLexicalElements);
        }
Esempio n. 4
0
        //HELPER METHODS FOR OTHER STATISTICS
        private Dictionary <string, int> GetLexicalDictionary()
        {
            Dictionary <string, int> lexicalDictionary = new Dictionary <string, int>();

            while (LexicalIterator.HasNext())
            {
                string newLexicalElement = LexicalIterator.MoveNext();

                if (lexicalDictionary.ContainsKey(newLexicalElement))
                {
                    lexicalDictionary[newLexicalElement] += 1;
                }
                else
                {
                    lexicalDictionary.Add(newLexicalElement, 1);
                }
            }
            return(lexicalDictionary);
        }
Esempio n. 5
0
        public double GetVowelPercentage()
        {
            string[] vowels     = { "a", "e", "i", "o", "u" };
            int      allVowels  = 0;
            int      allLetters = 0;

            while (LexicalIterator.HasNext())
            {
                string investigatedLetter = LexicalIterator.MoveNext();
                if (vowels.Contains(investigatedLetter))
                {
                    allLetters += 1;
                    allVowels  += 1;
                }
                else
                {
                    allLetters += 1;
                }
            }
            return(Math.Round((double)allVowels / allLetters * 100, 2));
        }