OntologyEntityFinder
Class StringOperation

java.lang.Object
  extended by OntologyEntityFinder.StringOperation

public class StringOperation
extends java.lang.Object

Utility Class for string operations

Author:
Simeon Polfliet (simeon.polfliet@ensimag.imag.fr)

Field Summary
private static java.util.Hashtable<java.lang.String,java.lang.Double> alreadyComp
          Store the words already computed to avoid useless computations
private static java.util.Hashtable<java.lang.String,java.lang.String> convertWord
           
static int counter
          counter for performance evaluation
private static java.util.LinkedList<java.lang.String> discardWord
          list to modify the result of the split
private static uk.ac.shef.wit.simmetrics.similaritymetrics.JaroWinkler jarowin
           
private static edu.sussex.nlp.jws.Lin lin
           
private static boolean useWordNet
           
private static edu.sussex.nlp.jws.JWS ws
          Similarity constructor and measures
private static edu.sussex.nlp.jws.WuAndPalmer wup
           
 
Constructor Summary
StringOperation(boolean useWN)
          Standard constructor
 
Method Summary
static double compareWord(java.lang.String word1, java.lang.String word2)
          Compare two words
static java.lang.String getSubStringWithCondition(java.lang.String str, java.lang.String mustContain, java.lang.String delimiter, boolean startDelimiter)
          Get the substring between the two delimiters characters if startDelimiter is true or between the end of the string that must be contained and the delimiter character otherwise.
static java.lang.String removeSpe(java.lang.String str)
          Remove all the special characters from the string
static java.util.LinkedList<java.lang.String> split(java.lang.String s)
          Splits a string into a list of words
private static java.util.LinkedList<java.lang.String> splitWN(java.lang.String s)
          Split the words using a test based on their presence in the WordNet dictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counter

public static int counter
counter for performance evaluation


alreadyComp

private static java.util.Hashtable<java.lang.String,java.lang.Double> alreadyComp
Store the words already computed to avoid useless computations


ws

private static edu.sussex.nlp.jws.JWS ws
Similarity constructor and measures


lin

private static edu.sussex.nlp.jws.Lin lin

wup

private static edu.sussex.nlp.jws.WuAndPalmer wup

jarowin

private static uk.ac.shef.wit.simmetrics.similaritymetrics.JaroWinkler jarowin

useWordNet

private static boolean useWordNet

discardWord

private static java.util.LinkedList<java.lang.String> discardWord
list to modify the result of the split


convertWord

private static java.util.Hashtable<java.lang.String,java.lang.String> convertWord
Constructor Detail

StringOperation

public StringOperation(boolean useWN)
Standard constructor

Parameters:
useWN - will use WordNet Similarity if true and only String similarity if false
Method Detail

splitWN

private static java.util.LinkedList<java.lang.String> splitWN(java.lang.String s)
Split the words using a test based on their presence in the WordNet dictionary

Parameters:
s - The string to split
Returns:
the list of words

split

public static java.util.LinkedList<java.lang.String> split(java.lang.String s)
Splits a string into a list of words

Parameters:
s - the string to split
Returns:
list of words

compareWord

public static double compareWord(java.lang.String word1,
                                 java.lang.String word2)
Compare two words

Parameters:
word1 - the word to compare with word2
word2 - the word to compare with word1
Returns:
the similarity between the two words

removeSpe

public static java.lang.String removeSpe(java.lang.String str)
Remove all the special characters from the string

Parameters:
str - the string to simplify
Returns:
the result string

getSubStringWithCondition

public static java.lang.String getSubStringWithCondition(java.lang.String str,
                                                         java.lang.String mustContain,
                                                         java.lang.String delimiter,
                                                         boolean startDelimiter)
Get the substring between the two delimiters characters if startDelimiter is true or between the end of the string that must be contained and the delimiter character otherwise. If the string mustContain is not contained in the string str, the result is an empty string Used for the skos hack.

Parameters:
str - the input string
mustContain - the string that must be contained in str
delimiter - the delimiter character
startDelimiter - determine where the substring should start
Returns:
the substring