@Override public void close() throws IOException { for (ObjectStream<T> stream : streams) { stream.close(); } }
@Override public void close() throws IOException { samples.close(); } }
@Override public void close() throws IOException { psi.close(); } }
@Override public void close() throws IOException { samples.close(); } }
@Override public void close() throws IOException { psi.close(); } }
public void close() throws IOException { for (ObjectStream<T> stream : streams) { stream.close(); } } };
@Override public void close() throws IOException { samples.close(); } }
@Override public void close() throws IOException { stream.close(); } }
@Override public void close() throws IOException { ds.close(); }
public void close() throws IOException { sampleStream.close(); } };
public void close() throws IOException { sampleStream.close(); } };
public void close() throws IOException { adSentenceStream.close(); } }
public void close() throws IOException { sampleStream.close(); } };
public void close() throws IOException { lineStream.close(); } }
@Override public void close() throws IOException { samples.close(); }
public void close() throws IOException { sampleStream.close(); } };
public void close() throws IOException { sampleStream.close(); poison(); }
public static void verifyTrainingData(ObjectStream<?> samples, BigInteger checksum) throws Exception { MessageDigest digest = MessageDigest.getInstance(HASH_ALGORITHM); Object sample; while ((sample = samples.read()) != null) { digest.update(sample.toString().getBytes(StandardCharsets.UTF_8)); } samples.close(); Assert.assertEquals(checksum, new BigInteger(1, digest.digest())); }
@Test public void testEvaluator() throws IOException, URISyntaxException { DictionaryNameFinder nameFinder = new DictionaryNameFinder( createDictionary()); TokenNameFinderEvaluator evaluator = new TokenNameFinderEvaluator( nameFinder, new NameEvaluationErrorListener()); ObjectStream<NameSample> sample = createSample(); evaluator.evaluate(sample); sample.close(); FMeasure fmeasure = evaluator.getFMeasure(); Assert.assertTrue(fmeasure.getFMeasure() == 1); Assert.assertTrue(fmeasure.getRecallScore() == 1); }
@Test public void testLineSegmentation() throws IOException { ObjectStream<String> stream = new PlainTextByLineStream(new MockInputStreamFactory(testString), StandardCharsets.UTF_8); Assert.assertEquals("line1", stream.read()); Assert.assertEquals("line2", stream.read()); Assert.assertEquals("line3", stream.read()); Assert.assertEquals("line4", stream.read()); Assert.assertNull(stream.read()); stream.close(); }