ranking/jaccard_similarity.py
def _smd(self, w1, w2):
        """
        Use Sum of Minimum Distance method (SMD) to compute the similarity between two sites
        """
        max_scores1 = [0]*len(w1.pages)
        max_scores2 = [0]*len(w2.pages)
        for i, page1 in enumerate(w1):
            for j, page2 in enumerate(w2):
                score = self._jaccard(page1.get_word_set(self.text_type), page2.get_word_set(self.text_type))
                max_scores1[i] = max(max_scores1[i], score)
                max_scores2[j] = max(max_scores2[j], score)
        sum_scores = sum(max_scores1) + sum(max_scores2)
        n = len(max_scores1) + len(max_scores2)
        sim = sum_scores/float(n) if n else 0
        return sim

        Use Sum of Minimum Distance method (SMD) to compute the similarity between two sites
        
Use Sum of Minimum Distance method (SMD) to compute the similarity between two sites
Use Sum of Minimum Distance method ( SMD ) to compute the similarity between two sites
def _smd(self, w1, w2):
        max_scores1 = [0]*len(w1.pages)
        max_scores2 = [0]*len(w2.pages)
        for i, page1 in enumerate(w1):
            for j, page2 in enumerate(w2):
                score = self._jaccard(page1.get_word_set(self.text_type), page2.get_word_set(self.text_type))
                max_scores1[i] = max(max_scores1[i], score)
                max_scores2[j] = max(max_scores2[j], score)
        sum_scores = sum(max_scores1) + sum(max_scores2)
        n = len(max_scores1) + len(max_scores2)
        sim = sum_scores/float(n) if n else 0
        return sim
def _smd ( self , w1 , w2 ) : max_scores1 = [ 0 ] * len ( w1 . pages ) max_scores2 = [ 0 ] * len ( w2 . pages ) for i , page1 in enumerate ( w1 ) : for j , page2 in enumerate ( w2 ) : score = self . _jaccard ( page1 . get_word_set ( self . text_type ) , page2 . get_word_set ( self . text_type ) ) max_scores1 [ i ] = max ( max_scores1 [ i ] , score ) max_scores2 [ j ] = max ( max_scores2 [ j ] , score ) sum_scores = sum ( max_scores1 ) + sum ( max_scores2 ) n = len ( max_scores1 ) + len ( max_scores2 ) sim = sum_scores / float ( n ) if n else 0 return sim
Use Sum of Minimum Distance method (SMD) to compute the similarity between two sites
Use Sum of Minimum Distance method ( SMD ) to compute the similarity between two sites
"""
        Use Sum of Minimum Distance method (SMD) to compute the similarity between two sites
        """
self
w1
w2