python - 如何解决这个问题?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
任何帮助将不胜感激,
解决方案
推荐阅读
- python - 我需要使用 discord.py rewrite 更改 python discord bot 的头像(个人资料图片)
- fullcalendar - 获取视图信息 Fullcalendar V5
- python - 尝试在 jupyter notebook 中拆分数据时出错
- kubernetes - 使用 K8s Init Container 复制现有文件
- shell - 为什么 find 在传递当前目录与路径时返回不同的排序结果?
- apache-nifi - NiFi - 无法转换 CHOICE,类型必须明确
- azure-devops - 从公司 AD 中删除时删除 Azure DevOps 帐户
- scala - 如何计算spark scala中一行中选定列的平均值?
- python - 如何使用 Python 拆分 Google 电子表格中特定工作表的所有合并单元格?
- tensorflow - AttributeError:“张量”对象没有使用 CRF 的属性“_keras_history”