INNER CODE UNIT · Python

_calculate_word_scores

vgrabovets/multi_rake · multi_rake/algorithm.py:181

    def _calculate_word_scores(phrase_list):
        word_frequency = defaultdict(int)
        word_degree = defaultdict(int)

        for phrase in phrase_list:
            word_list = separate_words(phrase)
            word_list_length = len(word_list)
            word_list_degree = word_list_length - 1

            for word in word_list:
                word_frequency[word] += 1
                word_degree[word] += word_list_degree

        for item in word_frequency:
            word_degree[item] = word_degree[item] + word_frequency[item]

        word_score = defaultdict(int)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…