Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复页面摘要器中的属性错误_Python_Python 3.x_Machine Learning - Fatal编程技术网

Python 如何修复页面摘要器中的属性错误

Python 如何修复页面摘要器中的属性错误,python,python-3.x,machine-learning,Python,Python 3.x,Machine Learning,尝试获取令牌时,在我的页面摘要器模型中获取属性错误,但不断获取错误,似乎看不出有任何错误 def text(): for i in range(0,len(text_p)): text += text_p[i].text text = text.lower() # tokenize the text tokens =[t for t in text.split()] print(tokens) AttributeError回溯(最近一次呼叫上次)

尝试获取令牌时,在我的页面摘要器模型中获取属性错误,但不断获取错误,似乎看不出有任何错误

def text():
      for i in range(0,len(text_p)):
        text += text_p[i].text
        text = text.lower()


# tokenize the text
tokens =[t for t in text.split()]
print(tokens)
AttributeError回溯(最近一次呼叫上次) 在() 6. 7#标记文本 ---->8个标记=[t表示text.split()中的t] 9打印(代币)

AttributeError:“函数”对象没有属性“拆分”

您正在使用函数名和变量名作为“文本”


更改变量名或函数名

您的变量声明不清楚。。。请注意解释一下这段代码的用途以及每个变量的作用