/// <summary> /// Run a vocabulary test against two data files. </summary> public static void AssertVocabulary(Analyzer a, Stream voc, Stream @out) { using TextReader vocReader = new StreamReader(voc, Encoding.UTF8); using TextReader outputReader = new StreamReader(@out, Encoding.UTF8); string inputWord = null; while ((inputWord = vocReader.ReadLine()) != null) { string expectedWord = outputReader.ReadLine(); Assert.IsNotNull(expectedWord); BaseTokenStreamTestCase.CheckOneTerm(a, inputWord, expectedWord); } }
/// <summary> /// Run a vocabulary test against two data files. </summary> public static void AssertVocabulary(Analyzer a, Stream voc, Stream @out) { TextReader vocReader = (TextReader)(new StreamReader(voc, IOUtils.CHARSET_UTF_8)); TextReader outputReader = (TextReader)(new StreamReader(@out, IOUtils.CHARSET_UTF_8)); string inputWord = null; while ((inputWord = vocReader.ReadLine()) != null) { string expectedWord = outputReader.ReadLine(); Assert.IsNotNull(expectedWord); BaseTokenStreamTestCase.CheckOneTerm(a, inputWord, expectedWord); } }
/// <summary> /// Run a vocabulary test against one file: tab separated. </summary> public static void AssertVocabulary(Analyzer a, Stream vocOut) { using TextReader vocReader = new StreamReader(vocOut, Encoding.UTF8); string inputLine = null; while ((inputLine = vocReader.ReadLine()) != null) { if (inputLine.StartsWith("#", System.StringComparison.Ordinal) || inputLine.Trim().Length == 0) { continue; // comment } string[] words = inputLine.Split('\t').TrimEnd(); BaseTokenStreamTestCase.CheckOneTerm(a, words[0], words[1]); } }
/// <summary> /// Run a vocabulary test against one file: tab separated. </summary> public static void AssertVocabulary(Analyzer a, Stream vocOut) { TextReader vocReader = (TextReader)(new StreamReader(vocOut, IOUtils.CHARSET_UTF_8)); string inputLine = null; while ((inputLine = vocReader.ReadLine()) != null) { if (inputLine.StartsWith("#") || inputLine.Trim().Length == 0) { continue; // comment } string[] words = inputLine.Split('\t'); BaseTokenStreamTestCase.CheckOneTerm(a, words[0], words[1]); } }