@Test public void testParseContraction() throws IOException { InputStreamFactory streamFactory = new ResourceAsStreamFactory(ConlluStreamTest.class, "pt_br-ud-sample.conllu"); try (ObjectStream<POSSample> stream = new ConlluPOSSampleStream( new ConlluStream(streamFactory), ConlluTagset.U)) { POSSample expected = POSSample.parse("Numa_ADP+DET reunião_NOUN entre_ADP " + "representantes_NOUN da_ADP+DET Secretaria_PROPN da_ADP+DET Criança_PROPN do_ADP+DET " + "DF_PROPN ea_CCONJ juíza_NOUN da_ADP+DET Vara_PROPN de_ADP Execuções_PROPN de_ADP " + "Medidas_PROPN Socioeducativas_PROPN ,_PUNCT Lavínia_PROPN Tupi_PROPN Vieira_PROPN " + "Fonseca_PROPN ,_PUNCT ficou_VERB acordado_ADJ que_CCONJ dos_ADP+DET 25_NUM " + "internos_NOUN ,_PUNCT 12_NUM serão_AUX internados_VERB na_ADP+DET Unidade_PROPN " + "de_ADP Planaltina_PROPN e_CCONJ os_DET outros_DET 13_NUM devem_AUX retornar_VERB " + "para_ADP a_DET Unidade_PROPN do_ADP+DET Recanto_NOUN das_ADP+DET Emas_PROPN ,_PUNCT " + "antigo_ADJ Ciago_PROPN ._PUNCT"); POSSample predicted = stream.read(); Assert.assertEquals(expected, 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();  }