INRIA & friends

fr.inrialpes.exmo.align.ling
Class JWNLDistances

java.lang.Object
  extended byfr.inrialpes.exmo.align.ling.JWNLDistances

public class JWNLDistances
extends java.lang.Object

Compute a string distance using the JWNL API (WordNet API)

Version:
$Id: JWNLDistances.java,v 1.0 2004/08/04
Author:
Jerome Pierson, David Loup, Petko Valtchev

Field Summary
static double ADJ_WEIGHT
           
private  java.util.Hashtable adjectives1
           
private  java.util.Hashtable adjectives2
           
(package private)  double[][] adjectivesMasks
           
(package private)  double[][] adjectivesResults
           
private  java.io.FileInputStream fis
           
private static double MINIMUM_DISTANCE
           
static double NOUN_WEIGHT
           
private  java.util.Hashtable nouns1
           
private  java.util.Hashtable nouns2
           
(package private)  double[][] nounsMasks
           
(package private)  double[][] nounsResults
           
static double VERB_WEIGHT
           
private  java.util.Hashtable verbs1
           
private  java.util.Hashtable verbs2
           
(package private)  double[][] verbsMasks
           
(package private)  double[][] verbsResults
           
 
Constructor Summary
JWNLDistances()
           
 
Method Summary
 double BasicSynonymDistance(java.lang.String s1, java.lang.String s2)
          Compute a basic distance between 2 strings using WordNet synonym.
private  double bestMatch(double[][] matrix)
           
 double compareComponentNames(java.lang.String s1, java.lang.String s2)
           
 double computeSimilarity(java.lang.String s1, java.lang.String s2)
           
 double computeTokenSimilarity(IndexWord index1, IndexWord index2)
           
 void display(Synset syn)
           
 void displayMatrix(double[][] matrix)
           
 void fillWithOnes(double[][] matrix)
           
 double findMatchForAdj(IndexWord index1, IndexWord index2)
           
 double[][] getAdjectivesResults()
           
 int getCommonConcepts(PointerTargetNodeList list1, PointerTargetNodeList list2)
           
 double[][] getNounsResults()
           
 int getNumberOfOccurences(java.lang.String token, java.util.Hashtable nouns, java.util.Hashtable adj, java.util.Hashtable verbs)
           
 int getNumberOfOccurences(java.lang.String token, int n)
           
 double[][] getVerbsResults()
           
 void Initialize()
          Initialize the JWNL API.
 boolean isAlpha(char c)
           
 boolean isAlphaCap(char c)
           
 boolean isAlphaNum(char c)
           
 boolean isAlphaSmall(char c)
           
 boolean isNum(char c)
           
 void lookUpWord(java.lang.String word, java.util.Hashtable nouns, java.util.Hashtable adjectives, java.util.Hashtable verbs)
          TODO Look up for other things than nouns
static void main(java.lang.String[] args)
           
 java.util.Vector tokenize(java.lang.String s)
           
 java.util.Vector tokenizeDep(java.lang.String s)
           
private  void updateMaskAndResults(java.util.Hashtable hash1, java.util.Hashtable hash2, double[][] mask, double[][] results)
          Deprecated. The use of a mask is deprecated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOUN_WEIGHT

public static final double NOUN_WEIGHT
See Also:
Constant Field Values

ADJ_WEIGHT

public static final double ADJ_WEIGHT
See Also:
Constant Field Values

VERB_WEIGHT

public static final double VERB_WEIGHT
See Also:
Constant Field Values

MINIMUM_DISTANCE

private static final double MINIMUM_DISTANCE
See Also:
Constant Field Values

nounsResults

double[][] nounsResults

verbsResults

double[][] verbsResults

adjectivesResults

double[][] adjectivesResults

nounsMasks

double[][] nounsMasks

verbsMasks

double[][] verbsMasks

adjectivesMasks

double[][] adjectivesMasks

fis

private java.io.FileInputStream fis

nouns1

private java.util.Hashtable nouns1

adjectives1

private java.util.Hashtable adjectives1

verbs1

private java.util.Hashtable verbs1

nouns2

private java.util.Hashtable nouns2

adjectives2

private java.util.Hashtable adjectives2

verbs2

private java.util.Hashtable verbs2
Constructor Detail

JWNLDistances

public JWNLDistances()
Method Detail

Initialize

public void Initialize()
Initialize the JWNL API. Must be done one time before computing distance Need to configure the file_properties.xml located in the current directory (ontoalign)


BasicSynonymDistance

public double BasicSynonymDistance(java.lang.String s1,
                                   java.lang.String s2)
Compute a basic distance between 2 strings using WordNet synonym.

Parameters:
s1 -
s2 -
Returns:
Distance between s1 & s2 (return 1 if s2 is a synonym of s1, else return a BasicStringDistance between s1 & s2)

computeSimilarity

public double computeSimilarity(java.lang.String s1,
                                java.lang.String s2)

updateMaskAndResults

private void updateMaskAndResults(java.util.Hashtable hash1,
                                  java.util.Hashtable hash2,
                                  double[][] mask,
                                  double[][] results)
Deprecated. The use of a mask is deprecated.

Updates the values contained in specified mask and results matrix.

Parameters:
hash1 - First hashtable (eg. containing the nouns of the first ontology).
hash2 - Second hashtable (eg. containing the nouns of the second ontology).
mask - A mask matrix.
results - A result matrix.

compareComponentNames

public double compareComponentNames(java.lang.String s1,
                                    java.lang.String s2)

computeTokenSimilarity

public double computeTokenSimilarity(IndexWord index1,
                                     IndexWord index2)

findMatchForAdj

public double findMatchForAdj(IndexWord index1,
                              IndexWord index2)

isAlphaNum

public boolean isAlphaNum(char c)

isAlpha

public boolean isAlpha(char c)

isAlphaCap

public boolean isAlphaCap(char c)

isAlphaSmall

public boolean isAlphaSmall(char c)

isNum

public boolean isNum(char c)

tokenize

public java.util.Vector tokenize(java.lang.String s)

tokenizeDep

public java.util.Vector tokenizeDep(java.lang.String s)
Parameters:
s - A string.
Returns:
a vector containing a collection of tokens.

lookUpWord

public void lookUpWord(java.lang.String word,
                       java.util.Hashtable nouns,
                       java.util.Hashtable adjectives,
                       java.util.Hashtable verbs)
TODO Look up for other things than nouns

Parameters:
word -
Returns:

display

public void display(Synset syn)

getCommonConcepts

public int getCommonConcepts(PointerTargetNodeList list1,
                             PointerTargetNodeList list2)

bestMatch

private double bestMatch(double[][] matrix)

getNumberOfOccurences

public int getNumberOfOccurences(java.lang.String token,
                                 int n)
Parameters:
token - A token.
n - The number of the ontology (typically 1 or 2).
Returns:
the number of occurences of the token in the hashtables nouns, adjectives and verbs.

getNumberOfOccurences

public int getNumberOfOccurences(java.lang.String token,
                                 java.util.Hashtable nouns,
                                 java.util.Hashtable adj,
                                 java.util.Hashtable verbs)

displayMatrix

public void displayMatrix(double[][] matrix)

fillWithOnes

public void fillWithOnes(double[][] matrix)

getAdjectivesResults

public double[][] getAdjectivesResults()

getNounsResults

public double[][] getNounsResults()

getVerbsResults

public double[][] getVerbsResults()

main

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

INRIA & friends

..no bottom yet...