public class WordnetManager
extends Object
Modifier and Type | Field and Description |
---|---|
private static boolean |
_JWNLinitialized |
private static double |
activeVersion |
static net.didion.jwnl.dictionary.Dictionary |
dict |
static String |
file_properties_xml |
private static boolean |
initializationFailed |
static String |
wordnetDictionaryFilename |
Modifier | Constructor and Description |
---|---|
private |
WordnetManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
attachDescriptor(AbstractTypeDescriptor[] ds,
GNode gn)
Associates a set of descriptors with a particular object.
|
boolean |
attachDescriptor(AbstractTypeDescriptor descr,
GNode gn)
Associates a descriptor with a particular object.
|
GenericTypeDescriptor |
chooseGenericSense(String word,
String phrase,
AbstractTypeDescriptor initialOption) |
static net.didion.jwnl.data.Synset[] |
collectAllSenses(String word)
Returns all senses, regardless of their part of speech.
|
boolean |
forgetDescriptors(GNode gn)
Sets the descriptor to null for this GNode.
|
static double |
getActiveVersion()
Identify the Wordnet version for the dictionary that is currently being
used.
|
static WordnetManager |
getInstance()
Create a new instance of a wordnet manager.
|
static net.didion.jwnl.data.POS |
getPOSForLabel(String label)
Return the POS constant (e.g., POS.NOUN, etc) corresponding to the label.
|
static net.didion.jwnl.data.Synset |
getSynset(net.didion.jwnl.data.POS pos,
long offset)
A wrapper for Dictionary.getSynsetAt.
|
String |
getTrimmedGloss(net.didion.jwnl.data.Synset s,
int length,
boolean includePOS,
boolean includeExamples)
` Removes trailing example sentences from a gloss entry and adds a
part-of-speech label to the front.
|
private static void |
initializeWordnet() |
static boolean |
isWordnetAvailable()
Tests whether the wordnet system is available.
|
AbstractTypeDescriptor |
queryForSense(String word,
AbstractTypeDescriptor initialOption,
boolean tryGeneric)
Invokes queryForSense on a word, with no phrase.
|
AbstractTypeDescriptor |
queryForSense(String word,
boolean tryGeneric)
Invokes queryForSense on a word, with no phrase and no default.
|
AbstractTypeDescriptor |
queryForSense(String word,
String phrase,
AbstractTypeDescriptor initialOption,
boolean tryGeneric)
Interactively query a user to choose a synset for a given word.
|
AbstractTypeDescriptor |
queryForSense(String word,
String phrase,
boolean tryGeneric)
Invokes queryForSense on a word in a phrase.
|
boolean |
wordExists(String word)
Determines whether the word is in any ontology at all.
|
private static boolean _JWNLinitialized
public static String wordnetDictionaryFilename
public static net.didion.jwnl.dictionary.Dictionary dict
private static boolean initializationFailed
private static double activeVersion
public static String file_properties_xml
public static boolean isWordnetAvailable()
true
if Wordnet is initialized and
available; false
otherwise. Wordnet is only initialized once
per session, so if its availability changes during a session, nothing
will change. If Wordnet becomes unavailable during a session where it was
previously available, unpredictable (but probably bad) things will
happen.public static double getActiveVersion()
public static WordnetManager getInstance()
t
- A transcript to be used for any interactive knowledge
acquisition.private static void initializeWordnet()
public static net.didion.jwnl.data.Synset[] collectAllSenses(String word)
word
- The word taken directly from some textpublic AbstractTypeDescriptor queryForSense(String word, String phrase, AbstractTypeDescriptor initialOption, boolean tryGeneric)
word
- The word for whom a synset is to be chosenphrase
- A phrase in which the word appears, to aid the userinitialOption
- the initial synset to selecttryGeneric
- whether to query a generic "free-form" sense from the
user if Wordnet fails.null
if the user cancelled, or if the word wasn't
found.chooseGenericSense(java.lang.String, java.lang.String, charger.gloss.AbstractTypeDescriptor)
,
WNUtil.guessWordsFromPhrase(java.lang.String)
public AbstractTypeDescriptor queryForSense(String word, String phrase, boolean tryGeneric)
public AbstractTypeDescriptor queryForSense(String word, AbstractTypeDescriptor initialOption, boolean tryGeneric)
public AbstractTypeDescriptor queryForSense(String word, boolean tryGeneric)
public String getTrimmedGloss(net.didion.jwnl.data.Synset s, int length, boolean includePOS, boolean includeExamples)
s
- Wordnet gloss entrylength
- the maximum length of the resulting string; if 0 (zero)
then don't truncateincludePOS
- whether to include a string denoting the part of speechincludeExamples
- whether to include explanatory or examples that
usually appear at the end of a glossary entrypublic boolean wordExists(String word)
word
- case insensitivepublic static net.didion.jwnl.data.Synset getSynset(net.didion.jwnl.data.POS pos, long offset)
public boolean attachDescriptor(AbstractTypeDescriptor descr, GNode gn)
descr
- the descriptor to associate. If s is null, there is no
effect; use forgetDescriptor.gn
- the non-null GNode to be associated.forgetDescriptors(charger.obj.GNode)
public boolean attachDescriptor(AbstractTypeDescriptor[] ds, GNode gn)
ds
- the descriptors to associate. If s is null or zero-length,
there is no effect; use forgetDescriptor.gn
- the non-null GNode to be associated.forgetDescriptors(charger.obj.GNode)
public boolean forgetDescriptors(GNode gn)
gn
- The GNode whose descriptor is to be erasedattachDescriptor(charger.gloss.AbstractTypeDescriptor, charger.obj.GNode)
public static net.didion.jwnl.data.POS getPOSForLabel(String label)
label
- a label such as one returned by a call to POS.getLabel()public GenericTypeDescriptor chooseGenericSense(String word, String phrase, AbstractTypeDescriptor initialOption)