Beispiel #1
0
        public void SplitToWord_0word_Test()
        {
            string str = "";
            var parser = new TextParser();
            var words = parser.SplitToWords(str);
            var expected = new string[] { };
            Assert.IsTrue(ArrayEquals(expected, words));


        }
Beispiel #2
0
 public void SplitToWordTest()
 {
     string str = "qwerty 123 asdf";
     var parser = new TextParser();
     var words=parser.SplitToWords(str);
     var expected = new string[] {"qwerty", "123", "asdf"};
     Assert.IsTrue(ArrayEquals(expected, words));
     
    
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            var parser = new TextParser();
            var textLines = File.ReadAllLines(args[0]);
            var textWords = textLines.Select(parser.SplitToWords).Select(dummy =>  dummy.ToList()).ToList();
            var invertIndex = parser.BuildInvertIndex(textWords);

            var queriesLines = File.ReadAllLines(args[1]);
            var queriesWords = queriesLines.Select(line => parser.SplitToWords(line)).ToList();

            var finder = new Finder();
            var replies = queriesWords.Select(querie => finder.Find(invertIndex, querie)).ToList();

            Printer.PrintResult(replies, ",", 20);
        }