如何从 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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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