public NameSample read() throws IOException { Sentence paragraph; // we should look for text here. while ((paragraph = this.adSentenceStream.read()) != null) { int currentTextID = getTextID(paragraph); boolean clearData = false; if (currentTextID != textID) { clearData = true; textID = currentTextID; } Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<Span> names = new ArrayList<>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), clearData); } 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 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; }
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<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); 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<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { index++; return new ChunkSample(sentence, tags, target); } } } return null; }
public FeatureSample read() throws IOException { callsCount++; 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<String>(); List<String> lemma = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); processRoot(root, sentence, lemma, tags, target); if (sentence.size() > 0) { index++; return new FeatureSample(sentence, lemma, tags, target); } } } return null; }
public FeatureSample read() throws IOException { callsCount++; 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<String>(); List<String> lemma = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); processRoot(root, sentence, lemma, tags, target); if (sentence.size() > 0) { index++; return new FeatureSample(sentence, lemma, tags, target); } } } return null; }
public NameSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { boolean clearData = false; if (useAdaptativeFeatures) { int currentTextID = getTextID(paragraph); if (currentTextID != textID) { clearData = true; textID = currentTextID; } } else { clearData = true; } Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<Span> names = new ArrayList<Span>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), clearData); } return null; }
public NameSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { boolean clearData = false; if (useAdaptativeFeatures) { int currentTextID = getTextID(paragraph); if (currentTextID != textID) { clearData = true; textID = currentTextID; } } else { clearData = true; } Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<Span> names = new ArrayList<Span>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), clearData); } 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; }
public NameSample read() throws IOException { Sentence paragraph; // we should look for text here. while ((paragraph = this.adSentenceStream.read()) != null) { int currentTextID = getTextID(paragraph); boolean clearData = false; if (currentTextID != textID) { clearData = true; textID = currentTextID; } Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<Span> names = new ArrayList<>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), clearData); } return null; }
public ChunkSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); newTags = new ArrayList<String>(); headTags = new ArrayList<String>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { return new ChunkSample(sentence, newTags, headTags); } } return null; }
public NameSample read() throws IOException { Sentence paragraph; // we should look for text here. while ((paragraph = this.adSentenceStream.read()) != null) { int currentTextID = getTextID(paragraph); boolean clearData = false; if (currentTextID != textID) { clearData = true; textID = currentTextID; } Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<>(); List<Span> names = new ArrayList<>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), clearData); } return null; }
public ChunkSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> target = new ArrayList<String>(); newTags = new ArrayList<String>(); headTags = new ArrayList<String>(); processRoot(root, sentence, tags, target); if (sentence.size() > 0) { return new ChunkSample(sentence, newTags, headTags); } } return null; }
public NameSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<Span> names = new ArrayList<Span>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), true); } return null; }
public NameSample read() throws IOException { Sentence paragraph; while ((paragraph = this.adSentenceStream.read()) != null) { Node root = paragraph.getRoot(); List<String> sentence = new ArrayList<String>(); List<Span> names = new ArrayList<Span>(); process(root, sentence, names); return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), true); } return null; }
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; }
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; }
@Test public void testSimpleReading() throws IOException { int count = 0; ADSentenceStream stream = openData(); ADSentenceStream.Sentence paragraph = stream.read(); paragraph.getRoot(); while (paragraph != null) { count++; paragraph = stream.read(); // paragraph.getRoot(); } Assert.assertEquals(ADParagraphStreamTest.NUM_SENTENCES, count); }