如何从 ONEAI NLP API 获取输出?

我发现了一个非常酷的NLP API,可以使用特殊技能来分析文本。然而,我是Python新手,不知道如何获取输出。有人能帮帮我吗?这是我尝试过的内容:

# Edit this One AI API call using our studio at https://studio.oneai.com/?pipeline=nGM7cx# pip install oneaiimport oneaioneai.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)

回答:

看起来你的代码是有效的。所以你需要做的唯一一件事就是打印pipeline。只需在你的代码末尾添加以下一行:

print(output)

这是修改后的代码:

# Edit this One AI API call using our studio at https://studio.oneai.com/?pipeline=nGM7cx# pip install oneaiimport oneaioneai.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工作室获取你的API密钥。如oneai的文档中提到的 – https://docs.oneai.com/docs/quick-start

另外,请确保使用 pip install oneai 安装oneai。

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注