Class AEdgeCountingSemanticMeasure
- java.lang.Object
-
- org.aksw.limes.core.measures.measure.AMeasure
-
- org.aksw.limes.core.measures.measure.semantic.edgecounting.AEdgeCountingSemanticMeasure
-
- All Implemented Interfaces:
IMeasure,IEdgeCountingSemanticMeasure
- Direct Known Subclasses:
LCHMeasure,LiMeasure,ShortestPathMeasure,WuPalmerMeasure
public abstract class AEdgeCountingSemanticMeasure extends AMeasure implements IEdgeCountingSemanticMeasure
Implements the edge-counting semantic string similarity abstract class.- Version:
- 1.0
- Author:
- Kleanthi Georgala (georgala@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description protected static intADJECTIVE_DEPTHprotected static intADVERB_DEPTHprotected SemanticDictionarydictionaryprotected AIndexIndexerprotected static intNOUN_DEPTHprotected static intVERB_DEPTH
-
Constructor Summary
Constructors Constructor Description AEdgeCountingSemanticMeasure(AIndex indexer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecheckSimilarity(HashMap<String,Double> similaritiesMap, String sourceToken, String targetToken)Checks if a semantic similarity between two tokens has already been calculated.voidclose()Closes and removes the semantic dictionary from memoryintgetHierarchyDepth(int posNumber)Retrieves the hierarchy depth for a given POS.edu.mit.jwi.item.IIndexWordgetIIndexWord(String str)Retrieves the IIndexWord for a given input stringedu.mit.jwi.item.IWordgetIWord(edu.mit.jwi.item.IWordID wordID)Retrieves a IWord for a given IWordIDArrayList<ArrayList<edu.mit.jwi.item.ISynsetID>>getPaths(edu.mit.jwi.item.ISynset synset)Retrieves a list of hypernym paths for a given concept, stored in an index instance.SemanticDictionarygetSemanticDictionary()doublegetSimilarity(edu.mit.jwi.item.IIndexWord w1, edu.mit.jwi.item.IIndexWord w2)Calculates the semantic similarity between two IIndexWords.doublegetSimilarity(edu.mit.jwi.item.ISynset synset1, edu.mit.jwi.item.ISynset synset2)Calculates the semantic similarity between two concepts.doublegetSimilarity(Object object1, Object object2)Returns the similarity between two objects.doublegetSimilarity(Instance instance1, Instance instance2, String property1, String property2)Returns the similarity between two instances, given their corresponding properties.edu.mit.jwi.item.ISynsetgetSynset(edu.mit.jwi.item.IWord iword)Retrieves an ISynset for a given IWordList<edu.mit.jwi.item.IWordID>getWordIDs(edu.mit.jwi.item.IIndexWord w)Retrieves a list of IWordID for a given IIndexWordvoidsetDictionary(SemanticDictionary dict)String[]tokenize(String[] strings)Tokenizes an array of strings-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.aksw.limes.core.measures.measure.semantic.edgecounting.IEdgeCountingSemanticMeasure
getSimilarityBetweenConcepts
-
Methods inherited from interface org.aksw.limes.core.measures.measure.IMeasure
getName, getRuntimeApproximation, getType
-
-
-
-
Field Detail
-
NOUN_DEPTH
protected static final int NOUN_DEPTH
- See Also:
- Constant Field Values
-
VERB_DEPTH
protected static final int VERB_DEPTH
- See Also:
- Constant Field Values
-
ADJECTIVE_DEPTH
protected static final int ADJECTIVE_DEPTH
- See Also:
- Constant Field Values
-
ADVERB_DEPTH
protected static final int ADVERB_DEPTH
- See Also:
- Constant Field Values
-
Indexer
protected AIndex Indexer
-
dictionary
protected SemanticDictionary dictionary
-
-
Constructor Detail
-
AEdgeCountingSemanticMeasure
public AEdgeCountingSemanticMeasure(AIndex indexer)
-
-
Method Detail
-
getSemanticDictionary
public SemanticDictionary getSemanticDictionary()
-
setDictionary
public void setDictionary(SemanticDictionary dict)
-
getHierarchyDepth
public int getHierarchyDepth(int posNumber)
Retrieves the hierarchy depth for a given POS.- Parameters:
posNumber- , the input POS number id- Returns:
- the corresponding hierarchy depth
-
getIWord
public edu.mit.jwi.item.IWord getIWord(edu.mit.jwi.item.IWordID wordID)
Retrieves a IWord for a given IWordID- Parameters:
wordID- , the input IWordID- Returns:
- the corresponding IWord
-
getSynset
public edu.mit.jwi.item.ISynset getSynset(edu.mit.jwi.item.IWord iword)
Retrieves an ISynset for a given IWord- Parameters:
iword- , the input IWord- Returns:
- the corresponding ISynset
-
getWordIDs
public List<edu.mit.jwi.item.IWordID> getWordIDs(edu.mit.jwi.item.IIndexWord w)
Retrieves a list of IWordID for a given IIndexWord- Parameters:
w- , the input IIndexWord- Returns:
- the corresponding list of IWordIDs
-
getPaths
public ArrayList<ArrayList<edu.mit.jwi.item.ISynsetID>> getPaths(edu.mit.jwi.item.ISynset synset)
Retrieves a list of hypernym paths for a given concept, stored in an index instance.- Parameters:
synset- , the input concept- Returns:
- the corresponding list of hypernym paths
-
getSimilarity
public double getSimilarity(edu.mit.jwi.item.ISynset synset1, edu.mit.jwi.item.ISynset synset2)Calculates the semantic similarity between two concepts.- Parameters:
synset1- , the first input conceptsynset2- , the second input concept- Returns:
- the actual semantic similarity between synset1 and synset2
-
getSimilarity
public double getSimilarity(edu.mit.jwi.item.IIndexWord w1, edu.mit.jwi.item.IIndexWord w2)Calculates the semantic similarity between two IIndexWords.- Parameters:
w1- , the first input IIndexWordw2- , the second input IIndexWord- Returns:
- the actual semantic similarity between w1 and w2
-
tokenize
public String[] tokenize(String[] strings)
Tokenizes an array of strings- Parameters:
strings- , the input array of strings- Returns:
- an array of tokenized strings
-
checkSimilarity
public double checkSimilarity(HashMap<String,Double> similaritiesMap, String sourceToken, String targetToken)
Checks if a semantic similarity between two tokens has already been calculated.- Parameters:
similaritiesMap- , the map that stores the semantic similarities between two tokenssourceToken- , the source input tokentargetToken- , the target input token- Returns:
- the similarity of the tokens, if it exists, or the maximum double value
-
getSimilarity
public double getSimilarity(Instance instance1, Instance instance2, String property1, String property2)
Description copied from interface:IMeasureReturns the similarity between two instances, given their corresponding properties.- Specified by:
getSimilarityin interfaceIMeasure- Parameters:
instance1- , the source instanceinstance2- , the target instanceproperty1- , the source propertyproperty2- , the target property- Returns:
- The similarity of the instances
-
close
public void close()
Closes and removes the semantic dictionary from memory
-
getSimilarity
public double getSimilarity(Object object1, Object object2)
Description copied from interface:IMeasureReturns the similarity between two objects.- Specified by:
getSimilarityin interfaceIMeasure- Parameters:
object1- , the source objectobject2- , the target object- Returns:
- The similarity of the objects
-
getIIndexWord
public edu.mit.jwi.item.IIndexWord getIIndexWord(String str)
Retrieves the IIndexWord for a given input string- Parameters:
str- , the input string- Returns:
- the corresponding IIndexWord
-
-