public ChunkSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { if (end > -1 && index >= end) { // leave return null; } if (start > -1 && index < start) { index++; // skip this one } else { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> target = new ArrayList<>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { index++; return new ChunkSample(sentence, tags, target); } } } return null; }
public ChunkSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { if (end > -1 && index >= end) { // leave return null; } if (start > -1 && index < start) { index++; // skip this one } else { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> target = new ArrayList<>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { index++; return new ChunkSample(sentence, tags, target); } } } return null; }
public ChunkSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { if (end > -1 && index >= end) { // leave return null; } if (start > -1 && index < start) { index++; // skip this one } else { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> target = new ArrayList<>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { index++; return new ChunkSample(sentence, tags, target); } } } return null; }