ranking/ranking.py
def rank(self, urls):
        ''' Rank the urls with respect to the seeds
            Return the sorted ranking scores together with the urls'''
        # Fetch the urls
        urls, text = self.fetcher.fetch_urls(urls)

        # Rank
        knn_scores = []
        scores = self.similarity.compute_similarity(text) 
        for i in xrange(len(urls)):
            sorted_scores = sorted(scores[i], reverse=True)
            knn_score = sum(sorted_scores[:self.K])/float(min(self.K, len(sorted_scores)))
            knn_scores.append((urls[i], knn_score))
        knn_scores = sorted(knn_scores, key=lambda x:x[1])

        return knn_scores
 Rank the urls with respect to the seeds
            Return the sorted ranking scores together with the urls
Rank the urls with respect to the seeds
Return the sorted ranking scores together with the urls
Rank the urls with respect to the seeds Return the sorted ranking scores together with the urls
def rank(self, urls):
        urls, text = self.fetcher.fetch_urls(urls)
        knn_scores = []
        scores = self.similarity.compute_similarity(text) 
        for i in xrange(len(urls)):
            sorted_scores = sorted(scores[i], reverse=True)
            knn_score = sum(sorted_scores[:self.K])/float(min(self.K, len(sorted_scores)))
            knn_scores.append((urls[i], knn_score))
        knn_scores = sorted(knn_scores, key=lambda x:x[1])
        return knn_scores
def rank ( self , urls ) : urls , text = self . fetcher . fetch_urls ( urls ) knn_scores = [ ] scores = self . similarity . compute_similarity ( text ) for i in xrange ( len ( urls ) ) : sorted_scores = sorted ( scores [ i ] , reverse = True ) knn_score = sum ( sorted_scores [ : self . K ] ) / float ( min ( self . K , len ( sorted_scores ) ) ) knn_scores . append ( ( urls [ i ] , knn_score ) ) knn_scores = sorted ( knn_scores , key = lambda x : x [ 1 ] ) return knn_scores
Rank the urls with respect to the seeds
Return the sorted ranking scores together with the urls
Rank the urls with respect to the seeds Return the sorted ranking scores together with the urls
''' Rank the urls with respect to the seeds
            Return the sorted ranking scores together with the urls''' # Fetch the urls # Rank
self
urls