@Test public void testReadPOSSamples() { List<POSSample> posSamples = POSTagDictCreator.readPOSSamples(new File("src/test/resources/posSamples.opennlp")); assertEquals(4, posSamples.size()); POSSample posSample = posSamples.get(0); assertEquals(20, posSample.getSentence().length); assertEquals(20, posSample.getTags().length); assertEquals("Small", posSample.getSentence()[0]); assertEquals("cell", posSample.getSentence()[1]); assertEquals("carcinoma", posSample.getSentence()[2]); assertEquals("JJ", posSample.getTags()[0]); assertEquals("NN", posSample.getTags()[1]); assertEquals("NN", posSample.getTags()[2]); }
public static List<POSSample> readPOSSamples(File sampleFile) { List<POSSample> posSamples = new ArrayList<>(); try (FileInputStream is = FileUtils.openInputStream(sampleFile)) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8); for (String sentenceString : lines) { POSSample posSample = POSSample.parse(sentenceString); posSamples.add(posSample); } } catch (IOException e) { e.printStackTrace(); } return posSamples; }
POSTagDictCreator { public static List<POSSample> readPOSSamples(File sampleFile) { List<POSSample> posSamples = new ArrayList<>(); try (FileInputStream is = FileUtils.openInputStream(sampleFile)) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8); for (String sentenceString : lines) { POSSample posSample = POSSample.parse(sentenceString); posSamples.add(posSample); } } catch (IOException e) { e.printStackTrace(); } return posSamples; } }
POSTagDictCreator { public static List<POSSample> readPOSSamples(File sampleFile) { List<POSSample> posSamples = new ArrayList<>(); try (FileInputStream is = FileUtils.openInputStream(sampleFile)) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8); for (String sentenceString : lines) { POSSample posSample = POSSample.parse(sentenceString); posSamples.add(posSample); } } catch (IOException e) { e.printStackTrace(); } return posSamples; }  }
POSTagDictCreator { public static List<POSSample> readPOSSamples(File sampleFile) { List<POSSample> posSamples = new ArrayList<>(); try (FileInputStream is = FileUtils.openInputStream(sampleFile)) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8); for (String sentenceString : lines) { POSSample posSample = POSSample.parse(sentenceString); posSamples.add(posSample); } } catch (IOException e) { e.printStackTrace(); } return posSamples; }  static void main(String[] args); static POSDictionary createPOSTagDict(File sampleFile, boolean caseSensitive); static List<POSSample> readPOSSamples(File sampleFile); }
POSTagDictCreator { public static List<POSSample> readPOSSamples(File sampleFile) { List<POSSample> posSamples = new ArrayList<>(); try (FileInputStream is = FileUtils.openInputStream(sampleFile)) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8); for (String sentenceString : lines) { POSSample posSample = POSSample.parse(sentenceString); posSamples.add(posSample); } } catch (IOException e) { e.printStackTrace(); } return posSamples; }  static void main(String[] args); static POSDictionary createPOSTagDict(File sampleFile, boolean caseSensitive); static List<POSSample> readPOSSamples(File sampleFile);  }