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)); }
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)); }
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); }