public final class WordNet extends OnlineDictionary implements java.lang.AutoCloseable
alternativeDefinitions, timeout
Constructor and Description |
---|
WordNet()
Create a new instance of WordNet
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkLocalDictionary(java.lang.String localFolder)
Check if the local dictionary and file path is OK.
|
void |
close()
For garbage collection.
|
boolean |
createLocalDictionary(java.lang.String localFolder)
Create an instance of the local dictionary.
|
edu.smu.tspell.wordnet.Synset[] |
getSynsetsLocal(java.lang.String theWord)
Get the set of synsets related to the word from a local dictionary.
|
edu.smu.tspell.wordnet.Synset[] |
getSynsetsLocal(java.lang.String theWord,
edu.smu.tspell.wordnet.SynsetType type)
Get the set of synsets related to the word from a local dictionary.
|
edu.smu.tspell.wordnet.Synset[] |
getSynsetsLocal(java.lang.String theWord,
edu.smu.tspell.wordnet.SynsetType type,
boolean useMorphology)
Get the set of synsets related to the word from a local dictionary.
|
java.util.HashMap<java.lang.String,?> |
queryDictionary(java.util.ArrayList<java.lang.String[]> parameters)
Query the dictionary using a single http GET request.
|
java.util.HashMap<java.lang.String,?> |
queryDictionary(java.util.ArrayList<java.lang.String[]> parameters,
java.lang.String language)
Query the dictionary using a single http GET request.
|
java.util.HashMap<java.lang.String,?> |
queryLocalDictionary(java.util.ArrayList<java.lang.String[]> parameters)
Query the dictionary using a single HTTP GET request.
|
java.util.HashMap<java.lang.String,?> |
requeryDictionary(java.lang.String whichMeaning,
java.util.ArrayList<java.lang.String[]> parameters)
Re-query the dictionary using a single HTTP GET request.
|
convertCode, getReplyHash, isDefaultLanguage, requeryDictionary
public boolean checkLocalDictionary(java.lang.String localFolder)
localFolder
- the local dictionary folder.public boolean createLocalDictionary(java.lang.String localFolder)
localFolder
- the local WordNet 'dict' dictionary folder.public java.util.HashMap<java.lang.String,?> queryLocalDictionary(java.util.ArrayList<java.lang.String[]> parameters) throws java.lang.Exception
parameters
- the parameter list of type String[2] (name, value).java.lang.Exception
- any error.public java.util.HashMap<java.lang.String,?> queryDictionary(java.util.ArrayList<java.lang.String[]> parameters, java.lang.String language) throws java.lang.Exception
queryDictionary
in class OnlineDictionary
parameters
- the parameter list of type String[2] (name, value).language
- the code for the language the query should be in.java.lang.Exception
- any error.public java.util.HashMap<java.lang.String,?> queryDictionary(java.util.ArrayList<java.lang.String[]> parameters) throws java.lang.Exception
queryDictionary
in class OnlineDictionary
parameters
- the parameter list of type String[2] (name, value).java.lang.Exception
- any error.public java.util.HashMap<java.lang.String,?> requeryDictionary(java.lang.String whichMeaning, java.util.ArrayList<java.lang.String[]> parameters)
requeryDictionary
in class OnlineDictionary
whichMeaning
- which meaning to query if alternatives are possible.parameters
- the parameter list of type String[2] (name, value).public edu.smu.tspell.wordnet.Synset[] getSynsetsLocal(java.lang.String theWord) throws java.lang.Exception
theWord
- the word term to check for.java.lang.Exception
- any error.public edu.smu.tspell.wordnet.Synset[] getSynsetsLocal(java.lang.String theWord, edu.smu.tspell.wordnet.SynsetType type) throws java.lang.Exception
theWord
- the word term to check for.type
- the type of synsets (e.g., noun) to return. If this argument is null,
all synsets will be returned that contain the specified word form.java.lang.Exception
- any error.public edu.smu.tspell.wordnet.Synset[] getSynsetsLocal(java.lang.String theWord, edu.smu.tspell.wordnet.SynsetType type, boolean useMorphology) throws java.lang.Exception
theWord
- the word term to check for.type
- the type of synsets (e.g., noun) to return. If this argument is null,
all synsets will be returned that contain the specified word form.useMorphology
- when true, indicates that this method should return synsets
that contain any morphological variation of the specified word form; conversely,
a value of false returns in only synsets being returned that contain the word for
exactly as it is specified. In other words, specifying false indicates that an
exact-match-only approach should be used to determine which synsets to return.java.lang.Exception
- any error.public void close()
close
in interface java.lang.AutoCloseable