Class AEdgeCountingSemanticMeasure

    • Constructor Detail

      • AEdgeCountingSemanticMeasure

        public AEdgeCountingSemanticMeasure​(AIndex indexer)
    • Method Detail

      • 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 concept
        synset2 - , 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 IIndexWord
        w2 - , 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 tokens
        sourceToken - , the source input token
        targetToken - , 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: IMeasure
        Returns the similarity between two instances, given their corresponding properties.
        Specified by:
        getSimilarity in interface IMeasure
        Parameters:
        instance1 - , the source instance
        instance2 - , the target instance
        property1 - , the source property
        property2 - , 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: IMeasure
        Returns the similarity between two objects.
        Specified by:
        getSimilarity in interface IMeasure
        Parameters:
        object1 - , the source object
        object2 - , 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