@Test public void testParseSpanishS300() throws IOException { InputStreamFactory streamFactory = new ResourceAsStreamFactory(ConlluStreamTest.class, "es-ud-sample.conllu"); try (ObjectStream<POSSample> stream = new ConlluPOSSampleStream(new ConlluStream(streamFactory), ConlluTagset.U)) { POSSample expected1 = POSSample.parse( "Digámoslo_VERB+PRON+PRON claramente_ADV ,_PUNCT la_DET insurgencia_NOUN se_PRON " + "ha_AUX pronunciado_VERB mucho_PRON más_ADV claramente_ADV respecto_NOUN " + "al_ADP+DET tema_NOUN de_ADP la_DET paz_NOUN que_CCONJ el_DET Estado_NOUN ,_PUNCT " + "como_SCONJ lo_PRON demuestra_VERB el_DET fragmento_NOUN que_SCONJ Bermúdez_PROPN " + "cita_VERB de_ADP la_DET respuesta_NOUN de_ADP \"_PUNCT Gabino_PROPN \"_PUNCT " + "a_ADP Piedad_PROPN Córdoba_PROPN ,_PUNCT en_ADP la_DET cual_PRON no_ADV se_PRON " + "plantea_VERB ni_CCONJ siquiera_ADV \"_PUNCT esperar_VERB un_DET mejor_ADJ " + "gobierno_NOUN \"_PUNCT ._PUNCT"); POSSample predicted = stream.read(); Assert.assertEquals(expected1, predicted); } }
@Override public POSSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); } return new POSSample(tokens, tags); } return null; }
ConlluPOSSampleStream extends FilterObjectStream<ConlluSentence, POSSample> { @Override public POSSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); } return new POSSample(tokens, tags); } return null; } }
ConlluPOSSampleStream extends FilterObjectStream<ConlluSentence, POSSample> { @Override public POSSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); } return new POSSample(tokens, tags); } return null; } ConlluPOSSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); }
ConlluPOSSampleStream extends FilterObjectStream<ConlluSentence, POSSample> { @Override public POSSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); } return new POSSample(tokens, tags); } return null; } ConlluPOSSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); @Override POSSample read(); }
ConlluPOSSampleStream extends FilterObjectStream<ConlluSentence, POSSample> { @Override public POSSample read() throws IOException { ConlluSentence sentence = samples.read(); if (sentence != null) { List<String> tokens = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (ConlluWordLine line : sentence.getWordLines()) { tokens.add(line.getForm()); tags.add(line.getPosTag(tagset)); } return new POSSample(tokens, tags); } return null; } ConlluPOSSampleStream(ObjectStream<ConlluSentence> samples, ConlluTagset tagset); @Override POSSample read();  }