我發現了一個非常酷的 NLP API,它可以幫助使用特殊技能分析文本。但是,我是 Python 新手,不知道如何獲取輸出。有人可以幫忙嗎?這是我嘗試過的:
# Edit this One AI API call using our studio at https://studio.oneai.com/?pipeline=nGM7cx
# pip install oneai
import oneai
oneai.api_key = "INSERT_API_KEY"
text = 'Natural language processing (NLP) is a subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to process and analyze large amounts of natural language data. The goal is a computer capable of "understanding" the contents of documents, including the contextual nuances of the language within them. The technology can then accurately extract information and insights contained in the documents as well as categorize and organize the documents themselves. Challenges in natural language processing frequently involve speech recognition, natural language understanding, and natural language generation. Based on long-standing trends in the field, it is possible to extrapolate future directions of NLP. As of 2020, three trends among the topics of the long-standing series of CoNLL Shared Tasks can be observed: Interest on increasingly abstract, "cognitive" aspects of natural language, Increasing interest in multilinguality and Elimination of symbolic representations.'
pipeline = oneai.Pipeline(
steps=[
oneai.skills.Highlights(),
oneai.skills.Topics(),
oneai.skills.Summarize(),
]
)
output = pipeline.run(text)
uj5u.com熱心網友回復:
看起來您的代碼是有效的。所以你唯一需要做的就是列印管道。只需將以下行添加到代碼的末尾:
print(output)
這是更改后的代碼:
# Edit this One AI API call using our studio at https://studio.oneai.com/?pipeline=nGM7cx
# pip install oneai
import oneai
oneai.api_key = "INSERT_API_KEY"
text = 'Natural language processing (NLP) is a subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to process and analyze large amounts of natural language data. The goal is a computer capable of "understanding" the contents of documents, including the contextual nuances of the language within them. The technology can then accurately extract information and insights contained in the documents as well as categorize and organize the documents themselves. Challenges in natural language processing frequently involve speech recognition, natural language understanding, and natural language generation. Based on long-standing trends in the field, it is possible to extrapolate future directions of NLP. As of 2020, three trends among the topics of the long-standing series of CoNLL Shared Tasks can be observed: Interest on increasingly abstract, "cognitive" aspects of natural language, Increasing interest in multilinguality and Elimination of symbolic representations.'
pipeline = oneai.Pipeline(
steps=[
oneai.skills.Highlights(),
oneai.skills.Topics(),
oneai.skills.Summarize(),
]
)
output = pipeline.run(text)
print(output)
請確保您從 oneai studio 獲取您的 API 密鑰。如 oneai 的檔案中所述 - https://docs.oneai.com/docs/quick-start
還要確保使用“pip install oneai”安裝 oneai
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/531291.html
上一篇:如何使用JS/jQuery.animate({影片元素從Last到First/ReverseAnimation的函式
