@Test public void testMain() { POSTagDictCreator.main(new String[] { "src/test/resources/posSamples.opennlp", "src/test/resources/tagDict.test.delete.xml", "true" }); File dictFile = new File("src/test/resources/tagDict.test.delete.xml"); assertTrue(dictFile.exists()); assertTrue(dictFile.length() > 100); try (InputStream is = FileUtils.openInputStream(dictFile)) { POSDictionary loadedPOSDictionary = POSDictionary.create(is); assertTrue(loadedPOSDictionary.isCaseSensitive()); Set<String> expectedTagsLower = new HashSet<>(Arrays.asList("TEST2", "JJ")); Set<String> expectedTagsUpper = new HashSet<>(Arrays.asList("TEST", "JJ")); assertEquals(expectedTagsLower, new HashSet<String>(Arrays.asList(loadedPOSDictionary.getTags("small")))); assertEquals(expectedTagsUpper, new HashSet<String>(Arrays.asList(loadedPOSDictionary.getTags("Small")))); } catch (IOException e) { e.printStackTrace(); } }
public static void main(String[] args) { if (args.length != 3) { System.err .println("Usage: " + POSTagDictCreator.class.getSimpleName() + " <POS sample file in OpenNLP format to derive dictionary from> <dictionary output file> <case sensitive true/false>"); System.exit(1); } File sampleFile = new File(args[0]); File dictOutputFile = new File(args[1]); boolean caseSensitive = Boolean.parseBoolean(args[2]); POSDictionary posDictionary = createPOSTagDict(sampleFile, caseSensitive); try (FileOutputStream os = new FileOutputStream(dictOutputFile)) { posDictionary.serialize(os); } catch (IOException e) { e.printStackTrace(); } System.out.println("POS dictionary written to " + dictOutputFile + "."); }
POSTagDictCreator { public static void main(String[] args) { if (args.length != 3) { System.err .println("Usage: " + POSTagDictCreator.class.getSimpleName() + " <POS sample file in OpenNLP format to derive dictionary from> <dictionary output file> <case sensitive true/false>"); System.exit(1); } File sampleFile = new File(args[0]); File dictOutputFile = new File(args[1]); boolean caseSensitive = Boolean.parseBoolean(args[2]); POSDictionary posDictionary = createPOSTagDict(sampleFile, caseSensitive); try (FileOutputStream os = new FileOutputStream(dictOutputFile)) { posDictionary.serialize(os); } catch (IOException e) { e.printStackTrace(); } System.out.println("POS dictionary written to " + dictOutputFile + "."); } }
POSTagDictCreator { public static void main(String[] args) { if (args.length != 3) { System.err .println("Usage: " + POSTagDictCreator.class.getSimpleName() + " <POS sample file in OpenNLP format to derive dictionary from> <dictionary output file> <case sensitive true/false>"); System.exit(1); } File sampleFile = new File(args[0]); File dictOutputFile = new File(args[1]); boolean caseSensitive = Boolean.parseBoolean(args[2]); POSDictionary posDictionary = createPOSTagDict(sampleFile, caseSensitive); try (FileOutputStream os = new FileOutputStream(dictOutputFile)) { posDictionary.serialize(os); } catch (IOException e) { e.printStackTrace(); } System.out.println("POS dictionary written to " + dictOutputFile + "."); }  }
POSTagDictCreator { public static void main(String[] args) { if (args.length != 3) { System.err .println("Usage: " + POSTagDictCreator.class.getSimpleName() + " <POS sample file in OpenNLP format to derive dictionary from> <dictionary output file> <case sensitive true/false>"); System.exit(1); } File sampleFile = new File(args[0]); File dictOutputFile = new File(args[1]); boolean caseSensitive = Boolean.parseBoolean(args[2]); POSDictionary posDictionary = createPOSTagDict(sampleFile, caseSensitive); try (FileOutputStream os = new FileOutputStream(dictOutputFile)) { posDictionary.serialize(os); } catch (IOException e) { e.printStackTrace(); } System.out.println("POS dictionary written to " + dictOutputFile + "."); }  static void main(String[] args); static POSDictionary createPOSTagDict(File sampleFile, boolean caseSensitive); static List<POSSample> readPOSSamples(File sampleFile); }
POSTagDictCreator { public static void main(String[] args) { if (args.length != 3) { System.err .println("Usage: " + POSTagDictCreator.class.getSimpleName() + " <POS sample file in OpenNLP format to derive dictionary from> <dictionary output file> <case sensitive true/false>"); System.exit(1); } File sampleFile = new File(args[0]); File dictOutputFile = new File(args[1]); boolean caseSensitive = Boolean.parseBoolean(args[2]); POSDictionary posDictionary = createPOSTagDict(sampleFile, caseSensitive); try (FileOutputStream os = new FileOutputStream(dictOutputFile)) { posDictionary.serialize(os); } catch (IOException e) { e.printStackTrace(); } System.out.println("POS dictionary written to " + dictOutputFile + "."); }  static void main(String[] args); static POSDictionary createPOSTagDict(File sampleFile, boolean caseSensitive); static List<POSSample> readPOSSamples(File sampleFile);  }