public class WordNet extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ADJECTIVE |
static int |
ADJECTIVE_SATELLITE |
Hashtable<String,String> |
adjectiveDocumentationHash |
Hashtable<String,String> |
adjectiveSUMOHash |
Hashtable<String,String> |
adjectiveSynsetHash |
static int |
ADVERB |
Hashtable<String,String> |
adverbDocumentationHash |
Hashtable<String,String> |
adverbSUMOHash |
Hashtable<String,String> |
adverbSynsetHash |
Hashtable<String,String> |
exceptionNounHash
list of irregular plural forms where the key is the
plural, singular is the value.
|
Hashtable<String,String> |
exceptionVerbHash |
static boolean |
initNeeded |
String |
maxNounSynsetID |
String |
maxVerbSynsetID |
MultiWords |
multiWords |
static int |
NOUN |
Hashtable<String,String> |
nounDocumentationHash |
Hashtable<String,String> |
nounSUMOHash |
Hashtable<String,String> |
nounSynsetHash |
HashMap<String,HashMap<String,String>> |
OMW
A HashMap with language name keys and HashMap
|
Hashtable<String,ArrayList<AVPair>> |
relations
Keys are POS-prefixed synsets, values are ArrayList(s) of AVPair(s)
in which the attribute is a pointer type according to
http://wordnet.princeton.edu/man/wninput.5WN.html#sect3 and
the value is a POS-prefixed synset @see WordNetUtilities.convertWordNetPointer
|
HashMap<String,String> |
reverseSenseIndex
A HashMap where the keys are 9 digit POS prefixed WordNet synset byte offsets,
and the values are of the form word_POS_sensenum (alpha POS like "VB").
|
HashMap<String,Integer> |
senseFrequencies
a HashMap where the key is a 9-digit POS-prefixed sense and the value is a
the number of times that sense occurs in the Brown corpus.
|
HashMap<String,String> |
senseIndex
A HashMap where the keys are of the form word_POS_sensenum (alpha POS like "VB")
and values are 8 digit WordNet synset byte offsets.
|
ArrayList<String> |
stopwords
English "stop words" such as "a", "at", "them", which have no or little
inherent meaning when taken alone.
|
Hashtable<String,ArrayList<String>> |
SUMOHash
Keys are SUMO terms, values are ArrayLists(s) of
POS-prefixed synset String(s) meaning that the part of speech code is
prepended to the synset number.
|
Hashtable<String,ArrayList<String>> |
synsetsToWords
Keys are String POS-prefixed synsets.
|
static int |
VERB |
Hashtable<String,String> |
verbDocumentationHash |
HashMap<String,ArrayList<String>> |
verbFrames
A HashMap where keys are 8 digit
WordNet synset byte offsets or synsets appended with a dash and a specific
word such as "12345678-foo".
|
Hashtable<String,String> |
verbSUMOHash |
Hashtable<String,String> |
verbSynsetHash |
static WordNet |
wn |
static HashMap<String,WordNet> |
wns |
protected HashMap<String,HashMap<String,Integer>> |
wordCoFrequencies
a HashMap of HashMaps where the key is a word sense of the
form word_POS_num signifying the word, part of speech and number
of the sense in WordNet.
|
protected HashMap<String,TreeSet<AVPair>> |
wordFrequencies
a HashMap of HashMaps where the key is a word and the value is a
HashMap of 9-digit POS-prefixed senses and the number of times that
sense occurs in the Brown corpus.
|
HashMap<String,ArrayList<String>> |
wordsToSenses
A HashMap with words as keys and ArrayList as values.
|
| Constructor and Description |
|---|
WordNet() |
| Modifier and Type | Method and Description |
|---|---|
HashMap<String,Integer> |
collectCountedWordSenses(String sentence)
Collect all the synsets that represent the best guess at
meanings for all the words in a sentence.
|
boolean |
containsWord(String word,
int pos)
Does WordNet contain the given word.
|
String |
displayByKey(String sumokbname,
String key,
String params) |
String |
displaySynset(String sumokbname,
String synset,
String params) |
String |
generateNounSynsetID()
Generate a new noun synset ID that doesn't have an existing hash
|
String |
generateVerbSynsetID()
Generate a new noun synset ID that doesn't have an existing hash
|
String |
getDocumentation(String synset) |
MultiWords |
getMultiWords() |
TreeMap<String,ArrayList<String>> |
getSensesFromWord(String word)
Get all the synsets for a given word.
|
String |
getSUMOMapping(String synset)
Get the SUMO mapping for a POS-prefixed synset
|
String |
getSUMOterm(String word,
int pos)
Get the SUMO term for the given root form word and part of speech.
|
File |
getWnFile(String key)
Returns the WordNet File object corresponding to key.
|
ArrayList<String> |
getWordsFromSynset(String synset) |
TreeMap<String,String> |
getWordsFromTerm(String SUMOterm)
Get the words and synsets corresponding to a SUMO term.
|
static void |
initOnce()
Read the WordNet files only on initialization of the class.
|
boolean |
isFile(String s) |
boolean |
isHyponym(String synset,
String hypo) |
boolean |
isHyponymRecurse(String synset,
String hypo,
ArrayList<String> visited) |
boolean |
isStopWord(String word)
Check whether the word is a stop word
|
static void |
main(String[] args)
A main method, used only for testing.
|
String |
nounRootForm(String mixedCase,
String input)
Return the root form of the noun, or null if it's not in the lexicon.
|
String |
nounSynsetFromTermFormat(String tf,
String SUMOterm,
KB kb)
Generate a new noun synset from a termFormat
|
String |
page(String inp,
int pos,
String kbname,
String synset,
String params)
This is the regular point of entry for this class.
|
protected boolean |
processNounLine(String line) |
String |
processPrologString(String doc)
Double any single quotes that appear.
|
void |
readSenseCount()
Read word sense frequencies into a HashMap of PriorityQueues
containing AVPairs where the value is a word and the attribute
(on which PriorityQueue is sorted) is an 8 digit String
representation of an integer count.
|
void |
readSenseIndex()
Note that WordNet forces all these words to lowercase in the index.xxx files
|
void |
readStopWords() |
void |
readWordCoFrequencies()
Return a HashMap of HashMaps where the key is a word sense of the
form word_POS_num signifying the word, part of speech and number
of the sense in WordNet.
|
String |
removeStopWords(String sentence)
Remove stop words from a sentence.
|
String |
senseKeyPOS(String senseKey) |
static ArrayList<String> |
splitToArrayList(String st)
Return an ArrayList of the string split by spaces.
|
static ArrayList<String> |
splitToArrayListSentence(String st)
Return an ArrayList of the string split by periods.
|
String |
sumoFileDisplay(String pathname,
String counter,
String params)
A routine which takes a full pathname as input and returns a sentence by sentence display of sense
and sentiment analysis
|
String |
sumoSentenceDisplay(String input,
String context,
String params)
A routine which looks up a given list of words in the hashtables
to find the relevant word definitions and SUMO mappings.
|
String |
sumoSentimentDisplay(String sentence)
A routine that uses computeSentiment in DB.java to display a sentiment score for a single sentence
as well as the individual scores of scored descriptors.
|
void |
synsetFromTermFormat(String tf,
String SUMOterm,
KB kb)
Generate a new synset from a termFormat
|
void |
termFormatsToSynsets(KB kb)
Generate a new synset from a termFormat
|
static void |
testProcessPointers()
A method used only for testing.
|
static void |
testWordFreq()
A method used only for testing.
|
String |
verbRootForm(String mixedCase,
String input)
Return the present tense singular form of the verb, or null if
it's not in the lexicon.
|
String |
verbSynsetFromTermFormat(String tf,
String SUMOterm,
KB kb)
Generate a new verb synset from a termFormat
|
void |
writeProlog(KB kb) |
void |
writeWordNetG() |
void |
writeWordNetHyp() |
void |
writeWordNetProlog() |
void |
writeWordNetS()
Write WordNet data to a prolog file with a single kind of clause
in the following format:
s(Synset_ID, Word_No_in_the_Synset, Word, SS_Type,
Synset_Rank_By_the_Word,Tag_Count)
|
void |
writeXML() |
public static WordNet wn
public static boolean initNeeded
public String maxNounSynsetID
public String maxVerbSynsetID
public Hashtable<String,ArrayList<String>> SUMOHash
public Hashtable<String,ArrayList<String>> synsetsToWords
public Hashtable<String,String> exceptionNounHash
public Hashtable<String,ArrayList<AVPair>> relations
protected HashMap<String,HashMap<String,Integer>> wordCoFrequencies
protected HashMap<String,TreeSet<AVPair>> wordFrequencies
public HashMap<String,Integer> senseFrequencies
public ArrayList<String> stopwords
public HashMap<String,String> senseIndex
public HashMap<String,String> reverseSenseIndex
public HashMap<String,ArrayList<String>> verbFrames
public HashMap<String,ArrayList<String>> wordsToSenses
public MultiWords multiWords
public static final int NOUN
public static final int VERB
public static final int ADJECTIVE
public static final int ADVERB
public static final int ADJECTIVE_SATELLITE
public MultiWords getMultiWords()
public File getWnFile(String key)
key - A descriptive literal String that maps to a regular
expression pattern used to obtain a WordNet file.public static ArrayList<String> splitToArrayList(String st)
public static ArrayList<String> splitToArrayListSentence(String st)
public String getSUMOMapping(String synset)
protected boolean processNounLine(String line)
public void readWordCoFrequencies()
public void readStopWords()
public void readSenseIndex()
public void readSenseCount()
public String sumoSentenceDisplay(String input, String context, String params)
input - is the target sentence to be parsed. See WordSenseBody.jsp for usage.context - is the larger context of the sentence. Can mean more accurate results.params - is the set of html parameterspublic String sumoSentimentDisplay(String sentence)
sentence - is the target sentence to be scored. See WordSenseBody.jsp for usage.public String sumoFileDisplay(String pathname, String counter, String params)
pathname - counter - is used to keep track of which sentence is being displayedparams - is the set of html parameterspublic boolean isFile(String s)
public boolean isHyponymRecurse(String synset, String hypo, ArrayList<String> visited)
public boolean isHyponym(String synset, String hypo)
public boolean isStopWord(String word)
public HashMap<String,Integer> collectCountedWordSenses(String sentence)
public static void initOnce()
public String nounRootForm(String mixedCase, String input)
public String verbRootForm(String mixedCase, String input)
public TreeMap<String,ArrayList<String>> getSensesFromWord(String word)
public TreeMap<String,String> getWordsFromTerm(String SUMOterm)
public String getSUMOterm(String word, int pos)
public boolean containsWord(String word, int pos)
public String page(String inp, int pos, String kbname, String synset, String params)
inp - The string the user is searching for.pos - The part of speech of the word 1=noun, 2=verb, 3=adjective, 4=adverbpublic String getDocumentation(String synset)
synset - is a synset with POS-prefixpublic String displaySynset(String sumokbname, String synset, String params)
synset - is a synset with POS-prefixpublic String displayByKey(String sumokbname, String key, String params)
key - is a WordNet sense keypublic void writeXML()
public void writeProlog(KB kb)
public void writeWordNetS()
public void writeWordNetHyp()
public String processPrologString(String doc)
public void writeWordNetG()
public void writeWordNetProlog()
throws IOException
IOExceptionpublic String generateNounSynsetID()
public String generateVerbSynsetID()
public String nounSynsetFromTermFormat(String tf, String SUMOterm, KB kb)
public String verbSynsetFromTermFormat(String tf, String SUMOterm, KB kb)
public void synsetFromTermFormat(String tf, String SUMOterm, KB kb)
public void termFormatsToSynsets(KB kb)
public static void testWordFreq()
public static void testProcessPointers()
public static void main(String[] args)
Copyright © 2015. All rights reserved.