大家早上好
你们中的任何人是否知道工具或API或以句子作为输入和输出的东西,它给出了该句子的主题或关键字?
我在在线演示中尝试过TextRazor,效果很好,就像您在屏幕截图中看到的一样 但是当我在python代码中用作库时,即使对于演示中使用的句子,它也总是给我一个空白列表 这是我在python中的代码:
import textrazor
import ssl
textrazor.api_key ="bdd69bdc3f91045cdb6d4261d39df34d887278602cb8f60401b7eb0b"
client = textrazor.TextRazor(extractors=["entities","topics"])
client.set_cleanup_mode("cleanHTML")
client.set_classifiers(["textrazor_newscodes"])
sentence = "Adam Hill,b It's Super Bowl Sunday pastors. Get your Jesus Jukes ready! Guilt is an awesome motivator! #sarcasm"
response = client.analyze(sentence)
print(sentence)
print(len(response.topics()))
entities = list(response.entities())
print(len(entities))
for topic in response.topics():
if topic.score > 0.3:
print (topic.label)
它给我的实体和主题长度为零
有人建议我使用OpenNlp,但是如果你们中的任何人有任何教程或说明,我都无法提取主题和关键字,请帮助我
在此先谢谢你