protected Object parseLine(POS pos, long offset, String line) { IndexWord word = null; if (isCachingEnabled()) word = getCachedIndexWord(new POSKey(_pos, offset)); if (word == null) word = parseAndCacheIndexWordLine(_pos, offset, line); return word; } }
private void cache(DictionaryElementType fileType, POSKey key, Object obj) { if (isCachingEnabled()) { getCaches().cacheObject(fileType, key, obj); } }
public void clearCache(DictionaryElementType elementType) { if (isCachingEnabled()) { getCaches().clearCache(elementType); } }
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"); }
/** * Get the IndexWord object for a String and POS */ public synchronized IndexWord getIndexWord(POS pos, String s) throws JWNLException { // This function tries the stemmed form of the lemma return wordnet.lookupIndexWord(pos, s); }
/** * Construct a Dictionary that retrieves file data from <code>fileManager</code>. * A client can use this to create a Dictionary backed by a RemoteFileManager. * @see net.didion.jwnl.dictionary.file_manager.RemoteFileManager */ public static void install(FileManager fileManager, FileDictionaryElementFactory factory) { install(fileManager, null, factory); }
protected Object parseLine(POS pos, long offset, String line) { Exc exc = null; if (isCachingEnabled()) { exc = getCachedException(new POSKey(pos, offset)); } if (exc == null) { exc = parseAndCacheExceptionLine(pos, offset, line); } return exc; } };
private Object getCached(DictionaryElementType fileType, POSKey key) { if (isCachingEnabled()) { return getCaches().getCachedObject(fileType, key); } return null; }
protected DictionaryElement createElement() throws Exception { long offset = getResults().getLong(1); return getSynsetAt(getPOS(), offset); } }
protected DictionaryElement createElement() throws Exception { String lemma = getResults().getString(1); return getIndexWord(getPOS(), lemma); } }
public static void install(FileManager fileManager, MorphologicalProcessor morph, FileDictionaryElementFactory factory, boolean enableCaching) { setDictionary(new FileBackedDictionary(fileManager, morph, factory, enableCaching)); }
public int getCacheCapacity(DictionaryElementType type) { return getCaches().getCacheCapacity(type); }
public int getCacheSizes(DictionaryElementType type) { return getCaches().getCacheSize(type); }
public void setCacheCapacity(DictionaryElementType type, int size) { getCaches().setCacheCapacity(type, size); }
protected Cache createCache(int size) { ObservableCache cache = new ObservableCache(size); cache.addObserver(this); return cache; } }
public Iterator getIndexWordIterator(final POS pos, final String substring) throws JWNLException { return new SubstringIndexFileLookaheadIterator(pos, prepareQueryString(substring)); }
public static void uninstall() { if (_dictionary != null) { _dictionary.close(); _dictionary = null; } }
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"); }
/** * Construct a Dictionary that retrieves file data from <code>fileManager</code>. * If enableCaching is true, lookup operations will check the relavant cache before * doing a lookup and will cache their results after doing a lookup. */ public static void install(FileManager fileManager, MorphologicalProcessor morph, FileDictionaryElementFactory factory) { install(fileManager, morph, factory, true); }
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"); }