fr.inrialpes.exmo.align.ling
Class JWNLDistances
java.lang.Object
fr.inrialpes.exmo.align.ling.JWNLDistances
public class JWNLDistances
- extends 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
Method Summary |
double |
BasicSynonymDistance(String s1,
String s2)
Compute a basic distance between 2 strings using WordNet synonym. |
private double |
bestMatch(double[][] matrix)
|
double |
compareComponentNames(String s1,
String s2)
|
double |
computeSimilarity(String s1,
String s2)
|
double |
computeTokenSimilarity(net.didion.jwnl.data.IndexWord index1,
net.didion.jwnl.data.IndexWord index2)
|
void |
display(net.didion.jwnl.data.Synset syn)
|
void |
displayMatrix(double[][] matrix)
|
void |
fillWithOnes(double[][] matrix)
|
double |
findMatchForAdj(net.didion.jwnl.data.IndexWord index1,
net.didion.jwnl.data.IndexWord index2)
|
double[][] |
getAdjectivesResults()
|
int |
getCommonConcepts(net.didion.jwnl.data.list.PointerTargetNodeList list1,
net.didion.jwnl.data.list.PointerTargetNodeList list2)
|
double[][] |
getNounsResults()
|
int |
getNumberOfOccurences(String token,
Hashtable nouns,
Hashtable adj,
Hashtable verbs)
|
int |
getNumberOfOccurences(String token,
int n)
|
double[][] |
getVerbsResults()
|
void |
Initialize()
Initialize the JWNL API. |
void |
Initialize(String wordnetdir,
String wordnetversion)
|
boolean |
isAlpha(char c)
|
boolean |
isAlphaCap(char c)
|
boolean |
isAlphaNum(char c)
|
boolean |
isAlphaSmall(char c)
|
boolean |
isNum(char c)
|
void |
lookUpWord(String word,
Hashtable nouns,
Hashtable adjectives,
Hashtable verbs)
TODO Look up for other things than nouns |
static void |
main(String[] args)
|
Vector |
tokenize(String s)
|
Vector |
tokenizeDep(String s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
nouns1
private Hashtable nouns1
adjectives1
private Hashtable adjectives1
verbs1
private Hashtable verbs1
nouns2
private Hashtable nouns2
adjectives2
private Hashtable adjectives2
verbs2
private Hashtable verbs2
JWNLDistances
public JWNLDistances()
Initialize
public void Initialize()
throws AlignmentException
- Initialize the JWNL API. Must be done one time before computing distance
Need to configure the file_properties.xml located in the current
directory
- Throws:
AlignmentException
Initialize
public void Initialize(String wordnetdir,
String wordnetversion)
throws AlignmentException
- Throws:
AlignmentException
BasicSynonymDistance
public double BasicSynonymDistance(String s1,
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(String s1,
String s2)
compareComponentNames
public double compareComponentNames(String s1,
String s2)
computeTokenSimilarity
public double computeTokenSimilarity(net.didion.jwnl.data.IndexWord index1,
net.didion.jwnl.data.IndexWord index2)
findMatchForAdj
public double findMatchForAdj(net.didion.jwnl.data.IndexWord index1,
net.didion.jwnl.data.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 Vector tokenize(String s)
tokenizeDep
public Vector tokenizeDep(String s)
- Parameters:
s
- A string.
- Returns:
- a vector containing a collection of tokens.
lookUpWord
public void lookUpWord(String word,
Hashtable nouns,
Hashtable adjectives,
Hashtable verbs)
- TODO Look up for other things than nouns
- Parameters:
word
-
display
public void display(net.didion.jwnl.data.Synset syn)
getCommonConcepts
public int getCommonConcepts(net.didion.jwnl.data.list.PointerTargetNodeList list1,
net.didion.jwnl.data.list.PointerTargetNodeList list2)
bestMatch
private double bestMatch(double[][] matrix)
getNumberOfOccurences
public int getNumberOfOccurences(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(String token,
Hashtable nouns,
Hashtable adj,
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(String[] args)
(C) INRIA & friends, 2003-2008