|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tudarmstadt.ukp.jwktl.parser.util.SimilarityUtils
public class SimilarityUtils
Some convenient string utilities.
Field Summary | |
---|---|
protected static Pattern |
NGRAM_PATTERN
|
Constructor Summary | |
---|---|
SimilarityUtils()
|
Method Summary | |
---|---|
protected static Map<String,Integer> |
computeNGrams(int startOrder,
int maxOrder,
String text)
Compute N Grams. |
protected static Map<String,Integer> |
computeWord2count(String text)
Calculate word frequency. |
protected static double |
similarity(Map<String,Integer> ngramsA,
Map<String,Integer> ngramsB)
Calculate similarity between two sets of n grams |
static double |
similarity(String textA,
String textB)
Calculate similarity between two text based on trigram. |
static double |
wordSim(String textA,
String textB)
Calculate string similarity based on ugram of words. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Pattern NGRAM_PATTERN
Constructor Detail |
---|
public SimilarityUtils()
Method Detail |
---|
protected static Map<String,Integer> computeNGrams(int startOrder, int maxOrder, String text)
startOrder
- maxOrder
- text
-
protected static Map<String,Integer> computeWord2count(String text)
Calculate word frequency.
text
- a text to process
protected static double similarity(Map<String,Integer> ngramsA, Map<String,Integer> ngramsB)
Calculate similarity between two sets of n grams
ngramsA
- a set of n gramsngramsB
- a set of n grams
public static double similarity(String textA, String textB)
Calculate similarity between two text based on trigram.
textA
- text AtextB
- text B
public static double wordSim(String textA, String textB)
Calculate string similarity based on ugram of words.
textA
- text AtextB
- text B
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |