ctext
index
Name CWordnet
Examples
CWordnet wordnet = new CWordnet(this, "/opt/wordnet21/");
String[] hypos = wordnet.getHyponyms("dog", "n");   	
Description Object supporting lookups on a pre-installed Wordnet installation.
If a user-specified WORDNET_HOME is required, pass this as an
argument to the constructor

Note: windows paths require double backslashes as follows:

 CWordnet wordnet = new CWordnet(this, "c:\\Program Files\\Wordnet21\\");
 
Supports the following operations:
    -------------------------- Basic ------------------------------------- -
  • getSynset(a) - Returns direct synset (synonym set) for a given word/pos
  • getGloss(a) - Returns full gloss for a given word/pos: dog->
    a member of the genus Canis (probably descended from the common
    wolf) that has been domesticated by man since prehistoric times;
    occurs in many breeds; "the dog barked all night"
  • getDescription(a) - Returns description for a given word/pos a member of the genus Canis (probably descended from the common
    wolf) that has been domesticated by man since prehistoric times;
    occurs in many breeds;
  • getExamples(a) - Returns array of examples for a given word/pos: dog->
    a member of the genus Canis (probably descended from the common
    wolf) that has been domesticated by man since prehistoric times;
    occurs in many breeds; "the dog barked all night"
  • getAntonyms(a) - Returns direct antonyms for a given word/pos
  • getAllHypernyms(a) - Returns all parents in Wordnet ontology: dog->mammal
  • getAllHyponyms(a) - Returns all children in Wordnet ontology: dog->bulldog
  • getHypernyms(a) - Returns direct parents in Wordnet ontology: dog->mammal
  • getHyponyms(a) - Returns direct children in Wordnet ontology: dog->bulldog
  • getHolonyms(a) - Returns direct holonyms in Wordnet ontology: paw->dog
  • getMeronyms(a) - Returns direct meronyms in Wordnet ontology: dog->paw
  • getCoordinates(a) - Returns coordinates in Wordnet ontology: arm->leg
  • getDerivedTerms(a) - Returns adverbs derived from related adjectives: happily->gayly
  • getNominalizations(a) - Returns related adjectives for nouns & vice-versa: happiness(n) <-> happy(a)
  • getSimilar(a) - Returns similar adjectives in ontology: happy(a) -> [blessed, blissful, bright]
  • getVerbGroup(a) - Returns similar verbs in ontology: live -> [dwell, inhabit]
    -------------------------- Other --------------------------------------
  • getDistance(a,b) - Returns the distance btwn word pair (result normalized btwn 0-1)
  • getCommonParents(a,b) - Returns the Synset for the first common hypernym synset of a word pair
  • getRandomWords(p, i) - Returns 'i' random words of pos 'p'.
  • getRandomWord(p) - Returns a random words of pos 'p'.
  • getStem(word, p) - Returns the morphological stem of word
  • isStem(word, p) - Returns true if the word is a morphological stem
  • isAdjective(word) - Returns true if some adjective sense of word exists
  • isAdverb(word) - Returns true if some adverb sense of word exists
  • isVerb(word) - Returns true if some verb sense of word exists
  • isNoun(word) - Returns true if some noun sense of word exists
Notes:
  • At current, supports Wordnet 2.0/2.1 only (installed locally)
  • and methods operate only on most frequent/common sense of input word
Constructors
CWordnet(pApplet);
CWordnet(pApplet, wordNetHomeDir);
Methods
checkExists ( )   Checks the existence of a 'word' in the ontology

getAllAlsoSees ( )   Returns also-see terms for all senses ofword/pos or null if not found
Holds for nouns (?) & adjectives
Example: happy -> [cheerful, elated, euphoric, felicitous, joyful, joyous...]

getAllAntonyms ( )   Returns String[] of Antonyms for the 1st sense of 'word' with 'pos' or null if not found
Holds for adjectives only (?)

getAllCoordinates ( )   Returns coordinate terms for all sense of word/pos, or null if not found
X is a coordinate term of Y if there exists a term Z which is the hypernym of both X and Y.
Examples:
  • blackbird and robin are coordinate terms (since they are both a kind of thrush)
  • gun and bow are coordinate terms (since they are both weapons)
  • fork and spoon are coordinate terms (since they are both cutlery, or eating utensils)
  • hat and helmet are coordinate terms (since they are both a kind of headgear or headdress)
Example: arm -> [hind-limb, forelimb, flipper, leg, crus, thigh, arm...]
Holds btwn nouns/nouns and verbs/verbs

getAllDerivedTerms ( )   Returns derived terms forall senses of word/pos or null if not found
Holds for adverbs
Example: happily -> [jubilant, blithe, gay, mirthful, merry, happy]

getAllExamples ( )   Returns examples for all senses of 'word' with 'pos' or null if not found

getAllHolonyms ( )   Returns part-to-whole relationships for all sense of word/pos, or none if not found
X is a meronym of Y if Y has X as a part.
X is a holonym of Y if X has Y as a part. That is, if Y is a meronym of X.
Holds between: nouns and nouns
Returns part, member, and substance holonyms
Example: arm -> [body, physical-structure, man, human...]

getAllHypernyms ( )   Returns an ordered String[] of hypernym-synsets (each a semi-colon delimited String) up to the root of Wordnet for the id, or null if not found

getAllHyponyms ( )   Returns an unordered String[] of hyponym-synsets (each a colon-delimited String), or null if not found



getAllMeronyms ( )   Returns array of whole-to-part relationships for all senses of word/pos, or null if not found
X is a meronym of Y if Y has X as a part.
X is a holonym of Y if X has Y as a part. That is, if Y is a meronym of X.
Holds between: Nouns and nouns
Returns part,member, and substance meronyms
Example: arm -> [wrist, carpus, wrist-joint, radiocarpal-joint...]

getAllNominalizations ( )   Returns nominalized terms for all sense of word/pos or null if not found
Refers to the use of a verb or an adjective as a noun. Holds for nouns, verbs & adjecstives(?)
Example: happiness(n) -> [happy, unhappy]
happy(a) -> [happiness, felicity]


getAllSimilar ( )   Returns similar-to list for all sense of word/pos or null if not found
Holds for adjectives
Example:
happy(a) -> [blessed, blissful, bright, golden, halcyon, prosperous...]


getAllSynonyms ( )   Returns String[] of words in each synset for all senses of word with pos, or null if not found

getAllVerbGroups ( )   Returns verb group for all senses of verb or null if not found
Example: live -> [dwell, inhabit]
Holds for verbs

getAlsoSees ( )   Returns also-see terms for 1st sense of word/pos or null if not found
Holds for nouns (?) & adjectives
Example: happy -> [cheerful, elated, euphoric, felicitous, joyful, joyous...]

getAntonyms ( )   Returns String[] of Antonyms for the specified id, or null if not found
Holds for adjectives only (?)

getAnyExample ( )   Return a random example from the set of examples from all senses of 'word' with 'pos', or null if not found

getBestPos ( )   Returns most-common pos according to polysemy count, returning the pos with the most different senses.

getCommonParent ( )   Returns common parent for words with unique ids id1, id2, or null if either word or no parent is found

getCommonParents ( )   Returns String[] of Common Parents for 1st senses of words with specified pos' or null if not found

getCoordinates ( )   Returns String[] of Coordinates for the specified id, or null if not found


getDerivedTerms ( )   Returns derived terms for the id, or null if not found
Holds for adverbs
Example: happily -> [jubilant, blithe, gay, mirthful, merry, happy]

getDescription ( )   Returns description for 'word' with 'pos' or null if not found

getDistance ( )   Returns the min distance between any two senses for the 2 words in the wordnet tree (result normalized to 0-1) with specified pos, or 1.0 if either is not found

getExamples ( )   Returns examples for word with unique senseId, or null if not found

getGloss ( )   Returns full gloss for word with unique senseId, or null if not found

getHolonyms ( )   Returns part-to-whole relationships for 1st sense of word/pos, or none if not found
X is a meronym of Y if Y has X as a part.
X is a holonym of Y if X has Y as a part. That is, if Y is a meronym of X.
Holds between: nouns and nouns
Returns part, member, and substance holonyms
Example: arm -> [body, physical-structure, man, human...]

getHypernyms ( )   Returns Hypernym String[] for id, or null if not found

X is a hyponym of Y if there exists an is-a relationship between X and Y.
That is, if X is a subtype of Y.
Or, for example, if X is a species of the genus Y.
X is a hypernym of Y is Y is a hyponym of X.
Holds between: nouns and nouns & verbs and verbs
Examples:

  • artifact is a hyponym of object
  • object is a hypernym of artifact
  • carrot is a hyponym of herb
  • herb is a hypernym of carrot


getHyponyms ( )   Returns Hyponym String[] for id, or null if not found

X is a hyponym of Y if there exists an is-a relationship between X and Y.
That is, if X is a subtype of Y.
Or, for xample, if X is a species of the genus Y.
X is a hypernym of Y is Y is a hyponym of X.
Holds between: nouns and nouns & verbs and verbs
Examples:

  • artifact is a hyponym of object
  • object is a hypernym of artifact
  • carrot is a hyponym of herb
  • herb is a hypernym of carrot


getMeronyms ( )   Returns array of whole-to-part relationships for id, or null if not found
X is a meronym of Y if Y has X as a part.
X is a holonym of Y if X has Y as a part. That is, if Y is a meronym of X.
Holds between: Nouns and nouns
Returns part,member, and substance meronyms
Example: arm -> [wrist, carpus, wrist-joint, radiocarpal-joint...]

getNominalizations ( )   Returns nominalized terms for id, or null if not found
Refers to the use of a verb or an adjective as a noun. Holds for nouns, verbs & adjecstives(?)
Example: happiness(n) -> [happy, unhappy]
happy(a) -> [happiness, felicity]


getPos ( )   Returns an array of all parts-of-speech ordered according to their polysemy count, returning the pos with the most different senses in the first position, etc.

getRandomExample ( )   Returns a random example from a random word w' pos

getRandomExamples ( )   Returns numExamples random examples from random words w' pos

getRandomWord ( )   Returns a random word with pos and a maximum of maxChars.

getRandomWords ( )   Returns count random words w' pos

getSenseCount ( )   Return the # of senses (polysemy) for a given word/pos.

getSenseIds ( )   Returns String[] of unique ids, one for each sense of word with pos, or null if none are found.

getSimilar ( )   Returns similar-to list for id, or null if not found
Holds for adjectives
Example:
happy(a) -> [blessed, blissful, bright, golden, halcyon, prosperous...]


getStems ( )   Returns an array of all stems, or null if not found

getSubstringMatches ( )   Returns all words in DB w' pos matching the given substring or null if not found

getSynonyms ( )   Returns String[] of Synsets for unique id id or null if not found Note: just calls getSynset(id) for now

getSynset ( )   Returns String[] of Synsets for unique id id or null if not found

getVerbGroup ( )   Returns verb group for id, or null if not found
Example: live -> [dwell, inhabit]
Holds for verbs

isCompound ( )   true if the word is considered compound (contains either a space, dash,or underscore)

isStem ( )   Returns true if 'word' exists with 'pos' and is equal (via String.equals()) to any of its stem forms, else false;

removeNonExistent ( )   Check each word in 'words' and removes those that don't exist in the ontology.

Note: destructive operation

Usage Web & Application
Related