public class WordNetUtilities extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
TPTPidCounter |
protected static ArrayList<String> |
WordNetRelations |
| Constructor and Description |
|---|
WordNetUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
commentSentiment(String fileWithPath) |
static ArrayList<String> |
convertTermList(String termList)
Convert a list of Terms in the format "&%term1 &%term2" to an ArrayList
of bare term Strings
|
static String |
convertWordNetPointer(String ptr) |
static void |
deduceMissingLinks()
Use the WordNet hyper-/hypo-nym links to deduce a likely link
for a SUMO term that has not yet been manually linked.
|
static void |
extractMeronyms()
A utility to extract meronym relations as relations between
SUMO terms.
|
static HashSet<String> |
findLeaves(String rel)
Find all the leaf nodes for a particular relation in WordNet.
|
static HashSet<String> |
findLeavesInTree(HashSet<String> rels)
Find all the leaf nodes for a particular relation in WordNet.
|
static ArrayList<ArrayList<String>> |
findPathsToRoot(ArrayList<String> base,
String synset)
Find the complete path from a given synset.
|
static String |
formatWords(TreeMap<String,String> words,
String kbName)
HTML format a TreeMap of word senses and their associated synset
|
static String |
formatWordsList(TreeMap<String,ArrayList<String>> words,
String kbName)
HTML format a TreeMap of ArrayLists word senses
|
static String |
getBareSUMOTerm(String term)
Get a SUMO term minus its &% prefix and one character mapping
suffix.
|
static String |
getPOSfromKey(String senseKey)
Extract the POS from a word_POS_num sense key.
|
static String |
getSenseFromKey(String senseKey)
Extract the synset corresponding to a word_POS_num sense key.
|
static char |
getSUMOMappingSuffix(String term)
Get a SUMO term mapping suffix.
|
static String |
getWordFromKey(String senseKey)
Extract the word from a word_POS_num sense key.
|
void |
imageNetLinks()
Import links from www.image-net.org that are linked to
WordNet and links them to SUMO terms when the synset has a
directly equivalent SUMO term
|
static String |
lowestCommonParent(String s1,
String s2) |
static void |
main(String[] args)
A main method, used only for testing.
|
static String |
mappingCharToName(char mappingType) |
static void |
mergeUpdates()
Read in a file with a nine-digit synset number followed by a space
and a SUMO term.
|
static int |
numSynsets(char pos) |
static String |
posLettersToNumber(String pos)
Convert a part of speech number to the two letter format used by
the WordNet sense index code.
|
static char |
posLetterToNumber(char POS) |
static char |
posNumberToLetter(char POS) |
static String |
posNumberToLetters(String pos)
Convert a part of speech number to the two letter format used by
the WordNet sense index code.
|
static String |
printStatistics() |
static void |
processMissingLinks(String fileName,
String pattern,
String posNum)
This is a utility routine that should not be called during
normal Sigma operation.
|
static String |
removeTermPrefixes(String formula) |
static void |
searchCoherence(String fileWithPath)
Take a file of
|
static int |
sensePOS(String sense)
Take a WordNet sense identifier, and return the integer part of
speech code.
|
static void |
showAllLeaves() |
static void |
showAllRoots() |
static String |
subst(String result,
String match,
String subst)
A utility function that mimics the functionality of the perl
substitution feature (s/match/replacement/).
|
static boolean |
substTest(String result,
String match,
String subst,
Hashtable<String,String> hash)
A utility function that mimics the functionality of the perl
substitution feature (s/match/replacement/) but rather than
returning the result of the substitution, just tests whether the
result is a key in a hashtable.
|
static String |
synsetToOneWord(String s) |
void |
updateWNversion()
Port the mappings from one version of WordNet to another.
|
void |
updateWNversionProcess(String fileName,
String pattern,
String posNum)
This is a utility routine that should not be called during
normal Sigma operation.
|
void |
updateWNversionReading(String fileName,
String pattern,
String posNum)
Read the version mapping files and store in the HashMap
called "mappings".
|
static String |
verbPlural(String verb)
Return the plural form of the verb.
|
static HashSet<String> |
wordsToSynsets(String word) |
static void |
writeTPTPWordNet(PrintWriter pw)
Write TPTP format for WordNet
|
public static String getBareSUMOTerm(String term)
public static String getPOSfromKey(String senseKey)
public static String getWordFromKey(String senseKey)
public static String getSenseFromKey(String senseKey)
public static ArrayList<String> convertTermList(String termList)
public static char getSUMOMappingSuffix(String term)
public static char posLetterToNumber(char POS)
public static char posNumberToLetter(char POS)
public static String posNumberToLetters(String pos)
public static String posLettersToNumber(String pos)
public static int sensePOS(String sense)
public static String mappingCharToName(char mappingType)
public static String subst(String result, String match, String subst)
result - is the string on which the substitution is performed.match - is the substring to be found and replaced.subst - is the string replacement for match.public static boolean substTest(String result, String match, String subst, Hashtable<String,String> hash)
result - is the string on which the substitution is performed.match - is the substring to be found and replaced.subst - is the string replacement for match.hash - is a hashtable to be checked against the result.public static String verbPlural(String verb)
public static String formatWords(TreeMap<String,String> words, String kbName)
public static String formatWordsList(TreeMap<String,ArrayList<String>> words, String kbName)
public static void mergeUpdates()
throws IOException
IOExceptionpublic static void processMissingLinks(String fileName, String pattern, String posNum) throws IOException
IOExceptionpublic static void deduceMissingLinks()
throws IOException
IOExceptionpublic void updateWNversionProcess(String fileName, String pattern, String posNum) throws IOException
IOExceptionpublic void updateWNversionReading(String fileName, String pattern, String posNum) throws IOException
IOExceptionpublic void updateWNversion()
throws IOException
IOExceptionpublic static int numSynsets(char pos)
public static String printStatistics()
public void imageNetLinks()
throws IOException
IOExceptionpublic static void extractMeronyms()
public static void searchCoherence(String fileWithPath)
public static void commentSentiment(String fileWithPath)
public static void writeTPTPWordNet(PrintWriter pw) throws IOException
IOExceptionpublic static HashSet<String> findLeavesInTree(HashSet<String> rels)
public static ArrayList<ArrayList<String>> findPathsToRoot(ArrayList<String> base, String synset)
public static HashSet<String> findLeaves(String rel)
public static void showAllLeaves()
public static void showAllRoots()
public static HashSet<String> wordsToSynsets(String word)
public static void main(String[] args)
Copyright © 2015. All rights reserved.