1
我有這個繼承的代碼,它在Python 2.7中成功返回XML中的結果,然後由ElementTree進行分析。是outputMode仍然受支持在alchemy_language.entities
result = alchemyObj.TextGetRankedNamedEntities(text)
root = ET.fromstring(result)
我更新程序到Python 3.5和我試圖做到這一點,這樣我就不需要修改結果的XML解析:
result = alchemy_language.entities(outputMode='xml', text='text', max_
items='10'),
root = ET.fromstring(result)
每http://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#entities輸出outputmode允許JSON默認的選擇和xml。但是,我收到此錯誤:
Traceback (most recent call last):
File "bin/nerv35.py", line 93, in <module>
main()
File "bin/nerv35.py", line 55, in main
result = alchemy_language.entities(outputMode='xml', text='text', max_items='10'),
TypeError: entities() got an unexpected keyword argument 'outputMode'
outputMode實際上是否仍然存在?如果是這樣,實體參數有什麼問題?
是否使用watson_developer_cloud? –