I found a very cool NLP API that helps analyze text using special skills. However, I am new to Python and I don't know how to get the output. Can someone help? This is what I tried:
# 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)
CodePudding user response:
It looks like your code is valid. So the only thing you need to do is just print the pipeline. Just add the following line to the end of your code:
print(output)
Here's the code after the change:
# 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)
Please make sure you get your API key from oneai studio. As mentioned in oneai's documentation - https://docs.oneai.com/docs/quick-start
Also make sure you install oneai by using "pip install oneai"