@Test public void testSimple() throws IOException { try (ADPOSSampleStream stream = new ADPOSSampleStream( new PlainTextByLineStream(new ResourceAsStreamFactory( ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample"), StandardCharsets.UTF_8), false, false)) { POSSample sample = stream.read(); Assert.assertEquals(23, sample.getSentence().length); Assert.assertEquals("Inicia", sample.getSentence()[0]); Assert.assertEquals("v-fin", sample.getTags()[0]); Assert.assertEquals("em", sample.getSentence()[1]); Assert.assertEquals("prp", sample.getTags()[1]); Assert.assertEquals("o", sample.getSentence()[2]); Assert.assertEquals("art", sample.getTags()[2]); Assert.assertEquals("Porto_Poesia", sample.getSentence()[9]); Assert.assertEquals("prop", sample.getTags()[9]); } }
public POSSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); process(root, sentence, tags); return new POSSample(sentence, tags); } return null; }
ADPOSSampleStream implements ObjectStream<POSSample> { public POSSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); process(root, sentence, tags); return new POSSample(sentence, tags); } return null; } }
ADPOSSampleStream implements ObjectStream<POSSample> { public POSSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); process(root, sentence, tags); return new POSSample(sentence, tags); } return null; } ADPOSSampleStream(ObjectStream<String> lineStream, boolean expandME,
      boolean includeFeatures);  ADPOSSampleStream(InputStreamFactory in, String charsetName,
      boolean expandME, boolean includeFeatures); }
ADPOSSampleStream implements ObjectStream<POSSample> { public POSSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); process(root, sentence, tags); return new POSSample(sentence, tags); } return null; } ADPOSSampleStream(ObjectStream<String> lineStream, boolean expandME,
      boolean includeFeatures);  ADPOSSampleStream(InputStreamFactory in, String charsetName,
      boolean expandME, boolean includeFeatures); POSSample read(); void reset(); void close(); }
ADPOSSampleStream implements ObjectStream<POSSample> { public POSSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); process(root, sentence, tags); return new POSSample(sentence, tags); } return null; } ADPOSSampleStream(ObjectStream<String> lineStream, boolean expandME,
      boolean includeFeatures);  ADPOSSampleStream(InputStreamFactory in, String charsetName,
      boolean expandME, boolean includeFeatures); POSSample read(); void reset(); void close();  }