protected WordNetManager() throws JWNLException { if (wordnet == null) { synchronized (WordNetManager.class) { if (wordnet == null) { JWNL.initialize(); // Create dictionary object wordnet = Dictionary.getInstance(); } } } }
public Examples() throws JWNLException { ACCOMPLISH = Dictionary.getInstance().getIndexWord(POS.VERB, "accomplish"); DOG = Dictionary.getInstance().getIndexWord(POS.NOUN, "dog"); CAT = Dictionary.getInstance().lookupIndexWord(POS.NOUN, "cat"); FUNNY = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "funny"); DROLL = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "droll"); }
public Examples() throws JWNLException { ACCOMPLISH = Dictionary.getInstance().getIndexWord(POS.VERB, "accomplish"); DOG = Dictionary.getInstance().getIndexWord(POS.NOUN, "dog"); CAT = Dictionary.getInstance().lookupIndexWord(POS.NOUN, "cat"); FUNNY = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "funny"); DROLL = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "droll"); }
private void demonstrateMorphologicalAnalysis(String phrase) throws JWNLException { // "running-away" is kind of a hard case because it involves // two words that are joined by a hyphen, and one of the words // is not stemmed. So we have to both remove the hyphen and stem // "running" before we get to an entry that is in WordNet System.out.println("Base form for \"" + phrase + "\": " + Dictionary.getInstance().lookupIndexWord(POS.VERB, phrase)); }
public Examples() throws JWNLException { ACCOMPLISH = Dictionary.getInstance().getIndexWord(POS.VERB, "accomplish"); DOG = Dictionary.getInstance().getIndexWord(POS.NOUN, "dog"); CAT = Dictionary.getInstance().lookupIndexWord(POS.NOUN, "cat"); FUNNY = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "funny"); DROLL = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "droll"); }
private void demonstrateMorphologicalAnalysis(String phrase) throws JWNLException { // "running-away" is kind of a hard case because it involves // two words that are joined by a hyphen, and one of the words // is not stemmed. So we have to both remove the hyphen and stem // "running" before we get to an entry that is in WordNet System.out.println("Base form for \"" + phrase + "\": " + Dictionary.getInstance().lookupIndexWord(POS.VERB, phrase)); }
private void demonstrateMorphologicalAnalysis(String phrase) throws JWNLException { // "running-away" is kind of a hard case because it involves // two words that are joined by a hyphen, and one of the words // is not stemmed. So we have to both remove the hyphen and stem // "running" before we get to an entry that is in WordNet System.out.println("Base form for \"" + phrase + "\": " + Dictionary.getInstance().lookupIndexWord(POS.VERB, phrase)); }
private void loadSynset(int i) throws JWNLException { if (_synsets[i] == null) { _synsets[i] = Dictionary.getInstance().getSynsetAt(_pos, _synsetOffsets[i]); } }
protected WordNetManager() throws JWNLException { if (wordnet == null) { synchronized (WordNetManager.class) { if (wordnet == null) { JWNL.initialize(); // Create dictionary object wordnet = Dictionary.getInstance(); } } } }
private void demonstrateMorphologicalAnalysis(String phrase) throws JWNLException { // "running-away" is kind of a hard case because it involves // two words that are joined by a hyphen, and one of the words // is not stemmed. So we have to both remove the hyphen and stem // "running" before we get to an entry that is in WordNet System.out.println("Base form for \"" + phrase + "\": " + Dictionary.getInstance().lookupIndexWord(POS.VERB, phrase)); }
public Examples() throws JWNLException { ACCOMPLISH = Dictionary.getInstance().getIndexWord(POS.VERB, "accomplish"); DOG = Dictionary.getInstance().getIndexWord(POS.NOUN, "dog"); CAT = Dictionary.getInstance().lookupIndexWord(POS.NOUN, "cat"); FUNNY = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "funny"); DROLL = Dictionary.getInstance().lookupIndexWord(POS.ADJECTIVE, "droll"); }
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 boolean execute(POS pos, String lemma, BaseFormSet baseForms) throws JWNLException { if (Dictionary.getInstance().getIndexWord(pos, lemma) != null) { baseForms.add(lemma); return true; } return false; } }
/** Get the actual target of this pointer. */ public PointerTarget getTarget() throws JWNLException { if (_target == null) { Dictionary dic = Dictionary.getInstance(); Synset syn = dic.getSynsetAt(_targetIndex._pos, _targetIndex._offset); _target = (_targetIndex._index == 0) ? (PointerTarget) syn : (PointerTarget) syn.getWord(_targetIndex._index - 1); } return _target; }
public WordNet(InputStream propertiesStream) { try { JWNL.initialize(propertiesStream); dict = Dictionary.getInstance(); } catch (JWNLException e) { e.printStackTrace(); } }
public boolean execute(POS pos, String derivation, BaseFormSet form) throws JWNLException { Exc exc = Dictionary.getInstance().getException(pos, derivation); if (exc != null) { String[] exceptions = exc.getExceptionArray(); for (int i = 0; i < exceptions.length; i++) { form.add(exceptions[i]); } return true; } return false; } }
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(); } }
/** * Lookup the base form of a word. Given a lemma, finds the WordNet * entry most like that lemma. This function returns the first base form * found. Subsequent calls to this function with the same part-of-speech * and word will return the same base form. To find another base form for * the pos/word, call lookupNextBaseForm. * @param pos the part-of-speech of the word to look up * @param derivation the word to look up * @return IndexWord the IndexWord found during lookup */ public IndexWord lookupBaseForm(POS pos, String derivation) throws JWNLException { // See if we've already looked this word up LookupInfo info = getCachedLookupInfo(new POSKey(pos, derivation)); if (info != null && info.getBaseForms().isCurrentFormAvailable()) { // get the last base form we retrieved. if you want // the next possible base form, use lookupNextBaseForm return Dictionary.getInstance().getIndexWord(pos, info.getBaseForms().getCurrentForm()); } else { return lookupNextBaseForm(pos, derivation, info); } }