Пример #1
0
    def _renrank_on_topics(self, query_topics, docs):
        recommender = self.recommender
        results = []
        for doc in docs:
            score = topic_model.histogram_intersection_kernel(query_topics, recommender.topics[doc])
            results.append((doc, score))

        return sorted(results, key=itemgetter(1), reverse=True)
Пример #2
0
 def rank_communities_by_topics(self, topics):
     similarity_scores = []
     for com, com_topics in self.community_topics.items():
         score = topic_model.histogram_intersection_kernel(topics, com_topics)
         similarity_scores.append((com, score))
     return  sorted(similarity_scores, key=itemgetter(1), reverse=True)