Python模块Wikipedia产生错误的答案
代码
QUESTION=input("") #Albert Einstein
RESULTS = wikipedia.search(str(QUESTION))#['einstein family', 'hans albert einstein', 'albert einstein', 'religious and philosophical views of albert einstein', "albert einstein's brain", 'albert einstein house', 'elsa einstein', 'albert einstein memorial', 'albert einstein college of medicine', 'bernhard caesar einstein']
for i in range(len(RESULTS)):
print(RESULTS[i])#einstein family
RESULT = wikipedia.summary(str(RESULTS[i]))#PAGE ID "EPSTEIN FAMILY" DOES NOT MATCH ANY PAGES. TRY ANOTHER ID!
它出于某种原因将爱因斯坦家族变成爱泼斯坦家族,我不知道为什么有人知道为什么会发生这个错误?
Code
QUESTION=input("") #Albert Einstein
RESULTS = wikipedia.search(str(QUESTION))#['einstein family', 'hans albert einstein', 'albert einstein', 'religious and philosophical views of albert einstein', "albert einstein's brain", 'albert einstein house', 'elsa einstein', 'albert einstein memorial', 'albert einstein college of medicine', 'bernhard caesar einstein']
for i in range(len(RESULTS)):
print(RESULTS[i])#einstein family
RESULT = wikipedia.summary(str(RESULTS[i]))#PAGE ID "EPSTEIN FAMILY" DOES NOT MATCH ANY PAGES. TRY ANOTHER ID!
It for some reason changes einstein family to epstein family and i have no idea why does anyone know why this error occurs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将我更改
为
我正在查看
wikipedia.py
文件,发现auto_suggest
可以将您的结果[i]
更改为关闭近似值,因此通过将其转换为false
,它可以停止并给我正确的答案。至于详细信息,请检查 wikipedia api 。
Change the
to
I was looking through the
wikipedia.py
file and found thatauto_suggest
can change yourRESULTS[i]
to a close approximation and so by turning it toFalse
it stops that and gives me the correct answer.As for the details, please check Wikipedia API.