jcolibri.extensions.textual.wordnet
Class WordNetBridge

java.lang.Object
  extended by jcolibri.extensions.textual.wordnet.WordNetBridge

public class WordNetBridge
extends java.lang.Object

WordNet wrapper that loads the dictionary into memory without having to install it in the file system. The JColibriPrincetonObjectDictionary is a modification of the WordNet original dictionary that allows to load the dictionary from the class-path or jar file into memory. That avoids having to install wordnet in the file system.

To avoid memory problems use the -Xms -Xmx VM params. For example to use a max of 1Gb of memory use: -Xms256m -Xmx1024m

Version:
1.0
Author:
Juan A. Recio-Garcia

Nested Class Summary
static class WordNetBridge.POS
          Part-Of-Speech tags
 
Constructor Summary
WordNetBridge()
           
 
Method Summary
static void deInit()
          Releases all resources and dictionaries
static java.lang.String[] getChildren(java.lang.String word, WordNetBridge.POS pos)
          Get all of the childrens of a word
static java.lang.String[] getParents(java.lang.String word, WordNetBridge.POS pos)
          Get all of the hypernyms (parents) of a word
static int hypernymDistance(java.lang.String w1, WordNetBridge.POS pos1, java.lang.String w2, WordNetBridge.POS pos2)
          Distance between two words using the Hypernym relationship
static void init()
          Initializes WordNet loading everything into memory.
static void main(java.lang.String[] args)
          Test case.
static boolean sameSynset(java.lang.String w1, WordNetBridge.POS pos1, java.lang.String w2, WordNetBridge.POS pos2)
          Checks if two words are in the same synset when the have the given POS tag
static int similarToDistance(java.lang.String w1, WordNetBridge.POS pos1, java.lang.String w2, WordNetBridge.POS pos2)
          Distance between two words using the SimilarTo relationship
static java.lang.String[] SynsetWords(java.lang.String word, WordNetBridge.POS posw)
          Returs a list of words in the same synset that the given word
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordNetBridge

public WordNetBridge()
Method Detail

init

public static void init()
Initializes WordNet loading everything into memory.
To avoid memory problems use the -Xms -Xmx VM params. For example to use a max of 1Gb of memory use: -Xms256m -Xmx1024m


deInit

public static void deInit()
Releases all resources and dictionaries


sameSynset

public static boolean sameSynset(java.lang.String w1,
                                 WordNetBridge.POS pos1,
                                 java.lang.String w2,
                                 WordNetBridge.POS pos2)
Checks if two words are in the same synset when the have the given POS tag

Parameters:
w1 - word 1
pos1 - POS tag of word 1
w2 - word 2
pos2 - POS tag of word 2

SynsetWords

public static java.lang.String[] SynsetWords(java.lang.String word,
                                             WordNetBridge.POS posw)
Returs a list of words in the same synset that the given word

Parameters:
word - word to find the synset
posw - POS tag of the word

getParents

public static java.lang.String[] getParents(java.lang.String word,
                                            WordNetBridge.POS pos)
Get all of the hypernyms (parents) of a word


getChildren

public static java.lang.String[] getChildren(java.lang.String word,
                                             WordNetBridge.POS pos)
Get all of the childrens of a word


similarToDistance

public static int similarToDistance(java.lang.String w1,
                                    WordNetBridge.POS pos1,
                                    java.lang.String w2,
                                    WordNetBridge.POS pos2)
Distance between two words using the SimilarTo relationship


hypernymDistance

public static int hypernymDistance(java.lang.String w1,
                                   WordNetBridge.POS pos1,
                                   java.lang.String w2,
                                   WordNetBridge.POS pos2)
Distance between two words using the Hypernym relationship


main

public static void main(java.lang.String[] args)
Test case.