@Test public void testReset() throws IOException { try (FileEventStream feStream = new FileEventStream(new StringReader(EVENTS))) { feStream.reset(); Assert.fail("UnsupportedOperationException should be thrown"); } catch (UnsupportedOperationException expected) { } } }
@Test public void testSimpleReading() throws IOException { try (FileEventStream feStream = new FileEventStream(new StringReader(EVENTS))) { Assert.assertEquals("other [wc=ic w&c=he,ic n1wc=lc n1w&c=belongs,lc n2wc=lc]", feStream.read().toString()); Assert.assertEquals("other [wc=lc w&c=belongs,lc p1wc=ic p1w&c=he,ic n1wc=lc]", feStream.read().toString()); Assert.assertEquals("other [wc=lc w&c=to,lc p1wc=lc p1w&c=belongs,lc p2wc=ic]", feStream.read().toString()); Assert.assertEquals("org-start [wc=ic w&c=apache,ic p1wc=lc p1w&c=to,lc]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic w&c=software,ic p1wc=ic p1w&c=apache,ic]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic w&c=foundation,ic p1wc=ic p1w&c=software,ic]", feStream.read().toString()); Assert.assertEquals("other [wc=other w&c=.,other p1wc=ic]", feStream.read().toString()); Assert.assertNull(feStream.read()); } }
try (FileEventStream rvfes2 = new FileEventStream( "src/test/resources/data/opennlp/maxent/repeat-weighting-training-data.txt")) { testDataIndexer.index(rvfes2);
FileEventStream fes = new FileEventStream(tmp); try { eventsToCompare = index(numEvents, fes, predicateIndex); } finally { fes.close();
while ((ev = eventStream.read()) != null) { eventCount++; eventStore.write(FileEventStream.toLine(ev)); String[] ec = ev.getContext(); update(ec, counter);
DataIndexer indexer = new OnePassDataIndexer( new FileEventStream(trainingFileName)); MaxentModel trainedMaxentModel = GIS.trainModel(100, indexer); // 100 iterations
eventStore.write(FileEventStream.toLine(ev));
DataIndexer indexer = new OnePassDataIndexer( new FileEventStream(trainingFileName)); MaxentModel trainedMaxentModel = GIS.trainModel(100, indexer); // 100 iterations
@Test public void testReset() throws IOException { try (FileEventStream feStream = new FileEventStream(new StringReader(EVENTS))) { feStream.reset(); Assert.fail("UnsupportedOperationException should be thrown"); } catch (UnsupportedOperationException expected) { } } }
@Test public void testSimpleReading() throws IOException { try (FileEventStream feStream = new FileEventStream(new StringReader(EVENTS))) { Assert.assertEquals("other [wc=ic=1 w&c=he,ic=2 n1wc=lc=3 n1w&c=belongs,lc=4 n2wc=lc=5]", feStream.read().toString()); Assert.assertEquals("other [wc=lc=1 w&c=belongs,lc=2 p1wc=ic=3 p1w&c=he,ic=4 n1wc=lc=5]", feStream.read().toString()); Assert.assertEquals("other [wc=lc=1 w&c=to,lc=2 p1wc=lc=3 p1w&c=belongs,lc=4 p2wc=ic=5]", feStream.read().toString()); Assert.assertEquals("org-start [wc=ic=1 w&c=apache,ic=2 p1wc=lc=3 p1w&c=to,lc=4]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic=1 w&c=software,ic=2 p1wc=ic=3 p1w&c=apache,ic=4]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic=1 w&c=foundation,ic=2 p1wc=ic=3 p1w&c=software,ic=4]", feStream.read().toString()); Assert.assertEquals("other [wc=other=1 w&c=.,other=2 p1wc=ic=3]", feStream.read().toString()); Assert.assertNull(feStream.read()); } }
try (FileEventStream fes = new FileEventStream(tmp)) { eventsToCompare = index(fes, predicateIndex);