首页 > 解决方案 > 如何解决这个问题?def _create_frequency_table(text_string)->dict: ^ SyntaxError: 无效语法

问题描述

这是代码的一部分:

'''
Don’t leave your dreams to chance.
'''


def _create_frequency_table(text_string) -> dict:
    """
    we create a dictionary for the word frequency table.
    For this, we should only use the words that are not part of the stopWords array.

    Removing stop words and making frequency table
    Stemmer - an algorithm to bring words to its root word.
    :rtype: dict
    """
    stopWords = set(stopwords.words("english"))
    words = word_tokenize(text_string)
    ps = PorterStemmer()

这是我试图理解的代码的一部分。下面是错误。

line 29
    def _create_frequency_table(text_string) -> dict:
                                             ^
SyntaxError: invalid syntax

任何帮助将不胜感激,

标签: pythonatom-editor

解决方案


推荐阅读