info.ephyra.nlp.semantics.ontologies
Class WordNet

java.lang.Object
  extended by info.ephyra.nlp.semantics.ontologies.WordNet
All Implemented Interfaces:
Ontology, Dictionary

public class WordNet
extends java.lang.Object
implements Ontology

An interface to WordNet, a lexical database for the English language.

This class implements the interface Ontology.

Version:
2007-05-30
Author:
Nico Schlaefer

Field Summary
static net.didion.jwnl.data.POS ADJECTIVE
          Indicates that a word is an adjective.
static net.didion.jwnl.data.POS ADVERB
          Indicates that a word is an adverb.
private static double CAUSING_WEIGHT
          Weight for the relation 'causing'.
private static net.didion.jwnl.dictionary.Dictionary dict
          WordNet dictionary.
private static double ENTAILING_WEIGHT
          Weight for the relation 'entailing'.
private static double HAS_MEMBER_WEIGHT
          Weight for the relation 'has-member'.
private static double HAS_PART_WEIGHT
          Weight for the relation 'has-part'.
private static double HAS_SUBSTANCE_WEIGHT
          Weight for the relation 'has-substance'.
private static double HYPERNYM_WEIGHT
          Weight for the relation 'hypernym'.
private static double HYPONYM_WEIGHT
          Weight for the relation 'hyponym'.
static int MAX_PATH_LENGTH
          Maximum length of a path to an expansion.
private static double MEMBER_OF_WEIGHT
          Weight for the relation 'member-of'.
static net.didion.jwnl.data.POS NOUN
          Indicates that a word is a noun.
private static double PART_OF_WEIGHT
          Weight for the relation 'part-of'.
private static double SUBSTANCE_OF_WEIGHT
          Weight for the relation 'substance-of'.
private static double SYNONYM_WEIGHT
          Weight for the relation 'synonym'.
static net.didion.jwnl.data.POS VERB
          Indicates that a word is a verb.
 
Constructor Summary
WordNet()
           
 
Method Summary
 boolean contains(java.lang.String word)
          Looks up a word.
 java.util.Map<java.lang.String,java.lang.Double> expandEntity(java.lang.String entity)
          Expands an entity by looking up related entities.
 java.util.Map<java.lang.String,java.lang.Double> expandEvent(java.lang.String event)
          Expands an event by looking up related events.
 java.util.Map<java.lang.String,java.lang.Double> expandModifier(java.lang.String modifier, net.didion.jwnl.data.POS pos)
          Expands a modifier by looking up related modifiers.
static java.lang.String[] getCausing(java.lang.String verb)
          Looks up verbs that cause the given verb, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getCausingSynsets(net.didion.jwnl.data.Synset synset)
           
private static net.didion.jwnl.data.Synset getCommonSynset(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up the most common synset of a word.
static java.lang.String getCompoundLemma(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up the lemma of a compound word.
static java.lang.String[] getEntailing(java.lang.String verb)
          Looks up verbs that entail the given verb, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getEntailingSynsets(net.didion.jwnl.data.Synset synset)
           
private static net.didion.jwnl.data.Synset[] getHasMemberSynsets(net.didion.jwnl.data.Synset synset)
           
private static net.didion.jwnl.data.Synset[] getHasPartSynsets(net.didion.jwnl.data.Synset synset)
           
private static net.didion.jwnl.data.Synset[] getHasSubstanceSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String[] getHaveMember(java.lang.String noun)
          Looks up member meronyms of the given noun, assuming that it is used in its most common sense.
static java.lang.String[] getHavePart(java.lang.String noun)
          Looks up part meronyms of the given noun, assuming that it is used in its most common sense.
static java.lang.String[] getHaveSubstance(java.lang.String noun)
          Looks up substance meronyms of the given noun, assuming that it is used in its most common sense.
static java.lang.String[] getHypernyms(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up hypernyms of the given word, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getHypernymSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String[] getHyponyms(net.didion.jwnl.data.POS pos, long offset)
          Looks up hyponyms of the synset with the given POS and offset.
static java.lang.String[] getHyponyms(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up hyponyms of the given word, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getHyponymSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String getLemma(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up the lemma of a word.
private static java.lang.String[] getLemmas(net.didion.jwnl.data.Synset synset)
          Looks up the lemmas of the words in a synset.
private static java.lang.String[] getLemmas(net.didion.jwnl.data.Synset[] synsets)
          Looks up the lemmas of the words in all synsets.
private static net.didion.jwnl.data.Synset[] getMemberOfSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String[] getMembersOf(java.lang.String noun)
          Looks up member holonyms of the given noun, assuming that it is used in its most common sense.
static java.lang.String[] getNounHyponyms(long offset)
          Looks up hyponyms of the synset with POS "noun" and the given offset.
private static net.didion.jwnl.data.Synset[] getPartOfSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String[] getPartsOf(java.lang.String noun)
          Looks up part holonyms of the given noun, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getSubstanceOfSynsets(net.didion.jwnl.data.Synset synset)
           
static java.lang.String[] getSubstancesOf(java.lang.String noun)
          Looks up substance holonyms of the given noun, assuming that it is used in its most common sense.
static java.lang.String[] getSynonyms(java.lang.String word, net.didion.jwnl.data.POS pos)
          Looks up synonyms of the given word, assuming that it is used in its most common sense.
private static net.didion.jwnl.data.Synset[] getSynsets(net.didion.jwnl.data.list.PointerTargetNodeList nodes)
          Looks up the synsets that correspond to the nodes in a node list.
static boolean initialize(java.lang.String properties)
          Initializes the wrapper for the WordNet dictionary.
static boolean isAdjective(java.lang.String word)
          Checks if the word exists as an adjective.
static boolean isAdverb(java.lang.String word)
          Checks if the word exists as an adverb.
static boolean isCompoundNoun(java.lang.String word)
          Checks if the word exists as a noun.
static boolean isCompoundWord(java.lang.String word)
          Checks if the word exists in WordNet.
static boolean isNoun(java.lang.String word)
          Checks if the word exists as a noun.
static boolean isVerb(java.lang.String word)
          Checks if the word exists as a verb.
static boolean isWord(java.lang.String word)
          Checks if the word exists in WordNet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADJECTIVE

public static final net.didion.jwnl.data.POS ADJECTIVE
Indicates that a word is an adjective.


ADVERB

public static final net.didion.jwnl.data.POS ADVERB
Indicates that a word is an adverb.


NOUN

public static final net.didion.jwnl.data.POS NOUN
Indicates that a word is a noun.


VERB

public static final net.didion.jwnl.data.POS VERB
Indicates that a word is a verb.


MAX_PATH_LENGTH

public static final int MAX_PATH_LENGTH
Maximum length of a path to an expansion.

See Also:
Constant Field Values

SYNONYM_WEIGHT

private static final double SYNONYM_WEIGHT
Weight for the relation 'synonym'.

See Also:
Constant Field Values

HYPERNYM_WEIGHT

private static final double HYPERNYM_WEIGHT
Weight for the relation 'hypernym'.

See Also:
Constant Field Values

HYPONYM_WEIGHT

private static final double HYPONYM_WEIGHT
Weight for the relation 'hyponym'.

See Also:
Constant Field Values

ENTAILING_WEIGHT

private static final double ENTAILING_WEIGHT
Weight for the relation 'entailing'.

See Also:
Constant Field Values

CAUSING_WEIGHT

private static final double CAUSING_WEIGHT
Weight for the relation 'causing'.

See Also:
Constant Field Values

MEMBER_OF_WEIGHT

private static final double MEMBER_OF_WEIGHT
Weight for the relation 'member-of'.

See Also:
Constant Field Values

SUBSTANCE_OF_WEIGHT

private static final double SUBSTANCE_OF_WEIGHT
Weight for the relation 'substance-of'.

See Also:
Constant Field Values

PART_OF_WEIGHT

private static final double PART_OF_WEIGHT
Weight for the relation 'part-of'.

See Also:
Constant Field Values

HAS_MEMBER_WEIGHT

private static final double HAS_MEMBER_WEIGHT
Weight for the relation 'has-member'.

See Also:
Constant Field Values

HAS_SUBSTANCE_WEIGHT

private static final double HAS_SUBSTANCE_WEIGHT
Weight for the relation 'has-substance'.

See Also:
Constant Field Values

HAS_PART_WEIGHT

private static final double HAS_PART_WEIGHT
Weight for the relation 'has-part'.

See Also:
Constant Field Values

dict

private static net.didion.jwnl.dictionary.Dictionary dict
WordNet dictionary.

Constructor Detail

WordNet

public WordNet()
Method Detail

initialize

public static boolean initialize(java.lang.String properties)
Initializes the wrapper for the WordNet dictionary.

Parameters:
properties - property file

isWord

public static boolean isWord(java.lang.String word)
Checks if the word exists in WordNet.

Parameters:
word - a word
Returns:
true iff the word is in WordNet

isCompoundWord

public static boolean isCompoundWord(java.lang.String word)
Checks if the word exists in WordNet. Supports multi-token terms.

Parameters:
word - a word
Returns:
true iff the word is in WordNet

isAdjective

public static boolean isAdjective(java.lang.String word)
Checks if the word exists as an adjective.

Parameters:
word - a word
Returns:
true iff the word is an adjective

isAdverb

public static boolean isAdverb(java.lang.String word)
Checks if the word exists as an adverb.

Parameters:
word - a word
Returns:
true iff the word is an adverb

isNoun

public static boolean isNoun(java.lang.String word)
Checks if the word exists as a noun.

Parameters:
word - a word
Returns:
true iff the word is a noun

isCompoundNoun

public static boolean isCompoundNoun(java.lang.String word)
Checks if the word exists as a noun. Supports multi-token terms.

Parameters:
word - a word
Returns:
true iff the word is a noun

isVerb

public static boolean isVerb(java.lang.String word)
Checks if the word exists as a verb.

Parameters:
word - a word
Returns:
true iff the word is a verb

getLemma

public static java.lang.String getLemma(java.lang.String word,
                                        net.didion.jwnl.data.POS pos)
Looks up the lemma of a word.

Parameters:
word - a word
pos - its part of speech
Returns:
lemma or null if lookup failed

getCompoundLemma

public static java.lang.String getCompoundLemma(java.lang.String word,
                                                net.didion.jwnl.data.POS pos)
Looks up the lemma of a compound word.

Parameters:
word - a word
pos - its part of speech
Returns:
lemma or null if lookup failed

getCommonSynset

private static net.didion.jwnl.data.Synset getCommonSynset(java.lang.String word,
                                                           net.didion.jwnl.data.POS pos)
Looks up the most common synset of a word.

Parameters:
word - a word
pos - its part of speech
Returns:
synset or null if lookup failed

getSynsets

private static net.didion.jwnl.data.Synset[] getSynsets(net.didion.jwnl.data.list.PointerTargetNodeList nodes)
Looks up the synsets that correspond to the nodes in a node list.

Parameters:
nodes - node list
Returns:
synsets

getLemmas

private static java.lang.String[] getLemmas(net.didion.jwnl.data.Synset synset)
Looks up the lemmas of the words in a synset.

Parameters:
synset - a synset
Returns:
lemmas

getLemmas

private static java.lang.String[] getLemmas(net.didion.jwnl.data.Synset[] synsets)
Looks up the lemmas of the words in all synsets.

Parameters:
synsets - the synsets
Returns:
lemmas

getSynonyms

public static java.lang.String[] getSynonyms(java.lang.String word,
                                             net.didion.jwnl.data.POS pos)
Looks up synonyms of the given word, assuming that it is used in its most common sense.

Parameters:
word - a word
pos - its part of speech
Returns:
synonyms or null if lookup failed

getHypernyms

public static java.lang.String[] getHypernyms(java.lang.String word,
                                              net.didion.jwnl.data.POS pos)
Looks up hypernyms of the given word, assuming that it is used in its most common sense.

Parameters:
word - a word
pos - its part of speech
Returns:
hypernyms or null if lookup failed

getHypernymSynsets

private static net.didion.jwnl.data.Synset[] getHypernymSynsets(net.didion.jwnl.data.Synset synset)

getHyponyms

public static java.lang.String[] getHyponyms(java.lang.String word,
                                             net.didion.jwnl.data.POS pos)
Looks up hyponyms of the given word, assuming that it is used in its most common sense.

Parameters:
word - a word
pos - its part of speech
Returns:
hyponyms or null if lookup failed

getHyponyms

public static java.lang.String[] getHyponyms(net.didion.jwnl.data.POS pos,
                                             long offset)
Looks up hyponyms of the synset with the given POS and offset.

Parameters:
pos - POS of the synset
offset - offset of the synset
Returns:
hyponyms or null if lookup failed

getNounHyponyms

public static java.lang.String[] getNounHyponyms(long offset)
Looks up hyponyms of the synset with POS "noun" and the given offset.

Parameters:
offset - offset of the synset
Returns:
hyponyms or null if lookup failed

getHyponymSynsets

private static net.didion.jwnl.data.Synset[] getHyponymSynsets(net.didion.jwnl.data.Synset synset)

getEntailing

public static java.lang.String[] getEntailing(java.lang.String verb)
Looks up verbs that entail the given verb, assuming that it is used in its most common sense.

Parameters:
verb - a verb
Returns:
entailing verbs or null if lookup failed

getEntailingSynsets

private static net.didion.jwnl.data.Synset[] getEntailingSynsets(net.didion.jwnl.data.Synset synset)

getCausing

public static java.lang.String[] getCausing(java.lang.String verb)
Looks up verbs that cause the given verb, assuming that it is used in its most common sense.

Parameters:
verb - a verb
Returns:
causing verbs or null if lookup failed

getCausingSynsets

private static net.didion.jwnl.data.Synset[] getCausingSynsets(net.didion.jwnl.data.Synset synset)

getMembersOf

public static java.lang.String[] getMembersOf(java.lang.String noun)
Looks up member holonyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
member holonyms or null if lookup failed

getMemberOfSynsets

private static net.didion.jwnl.data.Synset[] getMemberOfSynsets(net.didion.jwnl.data.Synset synset)

getSubstancesOf

public static java.lang.String[] getSubstancesOf(java.lang.String noun)
Looks up substance holonyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
substance holonyms or null if lookup failed

getSubstanceOfSynsets

private static net.didion.jwnl.data.Synset[] getSubstanceOfSynsets(net.didion.jwnl.data.Synset synset)

getPartsOf

public static java.lang.String[] getPartsOf(java.lang.String noun)
Looks up part holonyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
part holonyms or null if lookup failed

getPartOfSynsets

private static net.didion.jwnl.data.Synset[] getPartOfSynsets(net.didion.jwnl.data.Synset synset)

getHaveMember

public static java.lang.String[] getHaveMember(java.lang.String noun)
Looks up member meronyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
member meronyms or null if lookup failed

getHasMemberSynsets

private static net.didion.jwnl.data.Synset[] getHasMemberSynsets(net.didion.jwnl.data.Synset synset)

getHaveSubstance

public static java.lang.String[] getHaveSubstance(java.lang.String noun)
Looks up substance meronyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
substance meronyms or null if lookup failed

getHasSubstanceSynsets

private static net.didion.jwnl.data.Synset[] getHasSubstanceSynsets(net.didion.jwnl.data.Synset synset)

getHavePart

public static java.lang.String[] getHavePart(java.lang.String noun)
Looks up part meronyms of the given noun, assuming that it is used in its most common sense.

Parameters:
noun - a noun
Returns:
part meronyms or null if lookup failed

getHasPartSynsets

private static net.didion.jwnl.data.Synset[] getHasPartSynsets(net.didion.jwnl.data.Synset synset)

contains

public boolean contains(java.lang.String word)
Looks up a word.

Specified by:
contains in interface Dictionary
Parameters:
word - the word to look up
Returns:
true iff the word was found

expandEvent

public java.util.Map<java.lang.String,java.lang.Double> expandEvent(java.lang.String event)
Expands an event by looking up related events.

Specified by:
expandEvent in interface Ontology
Parameters:
event - an event
Returns:
related events and their weights

expandEntity

public java.util.Map<java.lang.String,java.lang.Double> expandEntity(java.lang.String entity)
Expands an entity by looking up related entities.

Specified by:
expandEntity in interface Ontology
Parameters:
entity - an entity
Returns:
related entities and their weights

expandModifier

public java.util.Map<java.lang.String,java.lang.Double> expandModifier(java.lang.String modifier,
                                                                       net.didion.jwnl.data.POS pos)
Expands a modifier by looking up related modifiers.

Specified by:
expandModifier in interface Ontology
Parameters:
modifier - a modifier
pos - its part of speech: POS.ADJECTIVE or POS.ADVERB
Returns:
related modifiers and their weights