protected WordNetManager() throws JWNLException { if (wordnet == null) { synchronized (WordNetManager.class) { if (wordnet == null) { JWNL.initialize(); // Create dictionary object wordnet = Dictionary.getInstance(); } } } }
/** * Resolve <var>msg</var> in one of the resource bundles used by the system * @param params parameters to insert into the resolved message */ public static String resolveMessage(String msg, Object[] params) { checkInitialized(UNINITIALIZED); return insertParams(_bundle.getString(msg), params); }
public static void shutdown() { _initStage = UNINITIALIZED; Dictionary.uninstall(); _version = null; createResourceBundle(); }
private static Dictionary getDictionary() { synchronized (WordNet.class) { if (dictionary == null) { JWNL.shutdown(); // in case it was previously initialized try { final String properties = Resources.toString( WordNet.class.getResource("jwnl.xml"), Charsets.UTF_8).replace( "DICTIONARY_PATH_PLACEHOLDER", dictionaryPath); final InputStream stream = new ByteArrayInputStream( properties.getBytes(Charsets.UTF_8)); JWNL.initialize(stream); dictionary = Dictionary.getInstance(); } catch (final Throwable ex) { JWNL.shutdown(); throw new Error("Cannot initialize JWNL using dictionary path '" + dictionaryPath + "'", ex); } } return dictionary; } }
public static void initialize(InputStream propertiesStream) throws JWNLException { checkInitialized(UNINITIALIZED); _bundle.setLocale(getLocale( getAttribute(root, LANGUAGE_ATTRIBUTE), getAttribute(root, COUNTRY_ATTRIBUTE))); String resource = getAttribute(resourceNodes.item(i), CLASS_ATTRIBUTE); if (resource != null) { _bundle.addResource(resource); String number = getAttribute(version, NUMBER_ATTRIBUTE); _version = new Version( getAttribute(version, PUBLISHER_ATTRIBUTE), (number == null) ? 0.0 : Double.parseDouble(number), getLocale(getAttribute(version, LANGUAGE_ATTRIBUTE), getAttribute(version, COUNTRY_ATTRIBUTE))); throw new JWNLException("JWNL_EXCEPTION_005"); createElementFromNode(dictionaryNodeList.item(0)).install();
/** Get the current WordNet version */ public static Version getVersion() { checkInitialized(VERSION_SET); return _version; }
protected WordNetManager() throws JWNLException { if (wordnet == null) { synchronized (WordNetManager.class) { if (wordnet == null) { JWNL.initialize(); // Create dictionary object wordnet = Dictionary.getInstance(); } } } }
public WordNet(String configPath) { try { JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream(configPath)); dict = Dictionary.getInstance(); } catch (JWNLException e) { e.printStackTrace(); } }
public WordNet() { try { JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream("wordnet_properties.xml")); dict = Dictionary.getInstance(); } catch (JWNLException e) { e.printStackTrace(); } }
public static void main(String[] args) { if (args.length != 1) { System.out.println(USAGE); System.exit(-1); } String propsFile = args[0]; try { // initialize JWNL (this must be done before JWNL can be used) JWNL.initialize(new FileInputStream(propsFile)); new Examples().go(); } catch (Exception ex) { ex.printStackTrace(); System.exit(-1); } }
public static void main(String[] args) { if (args.length != 1) { System.out.println(USAGE); System.exit(-1); } String propsFile = args[0]; try { // initialize JWNL (this must be done before JWNL can be used) JWNL.initialize(new FileInputStream(propsFile)); new Examples().go(); } catch (Exception ex) { ex.printStackTrace(); System.exit(-1); } }
public static void main(String[] args) { if (args.length != 1) { System.out.println(USAGE); System.exit(-1); } String propsFile = args[0]; try { // initialize JWNL (this must be done before JWNL can be used) JWNL.initialize(new FileInputStream(propsFile)); new Examples().go(); } catch (Exception ex) { ex.printStackTrace(); System.exit(-1); } }
public static void main(String[] args) { if (args.length != 1) { System.out.println(USAGE); System.exit(-1); } String propsFile = args[0]; try { // initialize JWNL (this must be done before JWNL can be used) JWNL.initialize(new FileInputStream(propsFile)); new Examples().go(); } catch (Exception ex) { ex.printStackTrace(); System.exit(-1); } }
public WordNet(InputStream propertiesStream) { try { JWNL.initialize(propertiesStream); dict = Dictionary.getInstance(); } catch (JWNLException e) { e.printStackTrace(); } }
private WordNetAPI(InputStream propsFile) throws Exception { info("Initialize WordNet...: "); if (propsFile == null) throw new RuntimeException("Missing required property 'WN_PROP'"); try { JWNL.initialize(propsFile); wDict = Dictionary.getInstance(); pUtils = PointerUtils.getInstance(); morphProcessor = wDict.getMorphologicalProcessor(); } catch (Exception e) { throw new RuntimeException("Initialization failed", e); } info("Done initializing WordNet..."); }
public WordNetDidion(String workDir){ String propsFile; try{ if(!FileUtil.exist(workDir) && FileUtil.exist(EnvVariable.getDragonHome()+"/"+workDir)) workDir=EnvVariable.getDragonHome()+"/"+workDir; propsFile=workDir+"/file_properties.xml"; if(!checkDataDirectory(propsFile,workDir)){ System.out.println("The wordnet data directory is not correct!"); return; } JWNL.initialize(new FileInputStream(propsFile)); dict = Dictionary.getInstance(); } catch(Exception e) { e.printStackTrace(); } }
JWNL.initialize(new FileInputStream(this.configurationFile));