@Test public void testParseSpanishS300() throws IOException { InputStreamFactory streamFactory = new ResourceAsStreamFactory(ConlluStreamTest.class, "es-ud-sample.conllu"); try (ObjectStream<LemmaSample> stream = new ConlluLemmaSampleStream( new ConlluStream(streamFactory), ConlluTagset.U)) { LemmaSample predicted = stream.read(); System.out.println(predicted); Assert.assertEquals("digám+tú+él", predicted.getLemmas()[0]); Assert.assertEquals("la", predicted.getTokens()[3]); Assert.assertEquals("el", predicted.getLemmas()[3]); } }
@Override public LemmaSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> lemmas = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); lemmas.add(line.getLemma()); } return new LemmaSample(tokens, tags, lemmas); } return null; }
ConlluLemmaSampleStream extends FilterObjectStream<ConlluSentence, LemmaSample> { @Override public LemmaSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> lemmas = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); lemmas.add(line.getLemma()); } return new LemmaSample(tokens, tags, lemmas); } return null; } }
ConlluLemmaSampleStream extends FilterObjectStream<ConlluSentence, LemmaSample> { @Override public LemmaSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> lemmas = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); lemmas.add(line.getLemma()); } return new LemmaSample(tokens, tags, lemmas); } return null; } ConlluLemmaSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); }
ConlluLemmaSampleStream extends FilterObjectStream<ConlluSentence, LemmaSample> { @Override public LemmaSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> lemmas = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); lemmas.add(line.getLemma()); } return new LemmaSample(tokens, tags, lemmas); } return null; } ConlluLemmaSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); @Override LemmaSample read(); }
ConlluLemmaSampleStream extends FilterObjectStream<ConlluSentence, LemmaSample> { @Override public LemmaSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); List<String> lemmas = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); lemmas.add(line.getLemma()); } return new LemmaSample(tokens, tags, lemmas); } return null; } ConlluLemmaSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); @Override LemmaSample read();  }