public TermFrequencyTest()
 {
     tf = new TermFrequency();
     testInputs = new[]
     {
         File.OpenText("../../../Input/input.txt").ReadToEnd(),
         File.OpenText("../../../Input/pride-and-prejudice.txt").ReadToEnd(),
         File.OpenText("../../../Input/test.txt").ReadToEnd(),
         "Casing casing CASING",
         "a able about among problem"
     };
     stopWords = new HashSet<string>(File.OpenText("../../../Input/stop_words.txt").ReadToEnd().Split(','));
 }
        static void Main(string[] args)
        {
            string[] inputs =
            {
                File.OpenText("../../../Input/input.txt").ReadToEnd(),
                File.OpenText("../../../Input/pride-and-prejudice.txt").ReadToEnd(),
                File.OpenText("../../../Input/test.txt").ReadToEnd()
            };

            TermFrequency m = new TermFrequency();

            foreach (string input in inputs)
            {
                IEnumerable<KeyValuePair<string, int>> entries = m.CountWordOccurences(input, 25);
                foreach (string entry in entries.Select(kv => kv.Key + " => " + kv.Value))
                {
                    Console.WriteLine(entry);
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            string[] inputs =
            {
                File.OpenText("../../../Input/input.txt").ReadToEnd(),
                File.OpenText("../../../Input/pride-and-prejudice.txt").ReadToEnd(),
                File.OpenText("../../../Input/test.txt").ReadToEnd()
            };

            TermFrequency m = new TermFrequency();

            foreach (string input in inputs)
            {
                IEnumerable <KeyValuePair <string, int> > entries = m.CountWordOccurences(input, 25);
                foreach (string entry in entries.Select(kv => kv.Key + " => " + kv.Value))
                {
                    Console.WriteLine(entry);
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }