/// <summary>
        ///
        /// </summary>
        /// <param name="reader">Входной поток</param>
        /// <returns>Объект WordFrequencyStatistic</returns>
        public override BaseStatistic Process(StreamReader reader)
        {
            var result = new Dictionary <string, int>();

            // Двигаемся в начало файла
            reader.BaseStream.Position = 0;

            // Чтение
            string currentString = null;

            while ((currentString = reader.ReadLine()) != null)
            {
                string[] arr = currentString.Split(this.SplitArray, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < arr.Length; i++)
                {
                    if (WordChecker.IsWord(arr[i]))
                    {
                        result[arr[i]] = result.ContainsKey(arr[i]) ? result[arr[i]] + 1 : 1;
                    }
                }
            }

            return(new WordFrequencyStatistic(result));
        }
示例#2
0
文件: Game.cs 项目: sphogan/Scrabble
 internal bool CheckWord(string word)
 {
     return(WordChecker.IsWord(word));
 }