[First COTOHA API] I tried to summarize the old story

[Qiita x COTOHA API present plan] Let's analyze text with COTOHA API! I found a project, so I will summarize how to use the COTOHA API and the result of actually summarizing the old story using the COTOHA API. I did.

What is COTOHA API?

スクリーンショット 2020-02-13 21.40.35.png

See About the COTOHA API for more information.

How to use COTOHA API

Get the information you need to use the API

To use the COTOHA API, you must first register for an account in order to obtain the information required to use the API. Click the "New Registration" button at the top right of the COTOHA API Site to move to the email address registration screen. Register your account from the URL in the email that comes after you register your email address. After completing the account registration, log in from the Login screen. When you log in, you will see two items in the "for Developers Account Information" table: "Client ID" and "Client secret". These are the information you need to use the COTOHA API.

Use the COTOHA API with Google Colaboratory

Colaboratory is a Jupyter notebook environment that runs entirely in the cloud. No settings are required and you can use it for free. With Colaboratory, you can write and execute code, store and share analyzes, access powerful computing resources, and more, all for free from your browser.

Google Colaboratory

You can use Google Colaboratory if you have a Google account.

When you open Google Colaboratory, first select File → New Notebook from the menu to create a new notebook. スクリーンショット 2020-02-15 18.09.19.png

Next, copy the code from this article.

Replace only the following parts with your own "Client ID" and "Client secret" that were displayed when you logged in earlier.

client_id = "Client ID"
client_secret = "Client secret"

After copying the code, press the ▷ button to execute the code.

スクリーンショット 2020-02-12 21.38.34.png

If you want to add a code, press "+ code".

Summary of old stories

Since it's a big deal, I tried to summarize various old stories using the summary API of the COTOHA API.

The summary API receives a sentence composed of multiple sentences written in Japanese as input, calculates the importance of this sentence for each sentence, and gives a score. Then, it returns important sentences according to the number of summary sentences specified at the time of input. This API will be provided as a beta version. https://api.ce-cotoha.com/contents/reference/apireference.html

I borrowed the text of the old story from the following site. http://hukumusume.com/douwa/pc/jap/index.html

The program code is below.

cotoha_call("summary", "Once upon a time, an old man and an old woman lived in a certain place. ~~~")

Momotaro

"Momotaro-san, Momotaro-san. Where are you going?" "I'm going to Onigashima to get rid of the demons." "Then let me accompany you." "Okay, I understand. Then I'll do the best millet dumplings in Japan, so follow me." In this way, the dog received a millet dumpling and joined Momotaro's companion.

Kintaro

Kintaro's friends are mountain animals. Among the animals, there were big bears, cows, horses and deer, but Kintaro is the only one. "Tug of war also wins Kintaro!" Kintaro is a very strong man, but he is not only strong but also a very kind boy.

Urashima Taro

Please take your time. " Mr. Urashima was guided to the hall of Ryugu. "By the way, Otohime-sama said. When you open this Tamatebako," time "will come back.

One dimension master

The grandfather and grandmother asked God because they had no children. A demon also came to this. "Please say,'Get your back, get your back,' as if my back were stretched." The princess gladly shook her head.

Giving back the crane

What a gentle girl you notice. Then my daughter started to take the opportunity again. "Hey, grandfather.

Tick mountain

"Grandfather, what's wrong?" "The raccoon dog, the raccoon dog, ran away like this for her grandmother." "Oh, that bad raccoon dog. "Raccoon dog. I made a boat, so let's go fishing in the sea." "That's good.

Hanasaka Jiisan

Please lend me your white eagle. " The greedy grandfather forcibly took Shiro to the field. However, only stones come out, and no treasure comes out. "Let's make dead trees bloom.

Princess Kaguya

Yeah! ···Yup? this is! When the grandfather cut the bamboo, there was a little girl inside. Among them, there were five particularly enthusiastic young people. There is no more Muko-san. " Kaguya Hime, who does not intend to go to her bride, decided to refuse, but if she goes against Mikado, she may be killed.

Marriage of a mouse

I'll hide me. " So the father and mother mice went to the clouds. Would you like to have Chuko as your bride? " "I'm happy, but the wind is stronger than I am. "The strongest wall in the world.

Summary

Somehow, I think it's a summary. The summary is still in beta, so I'm looking forward to the official version.

COTOHA API Portal

Recommended Posts

[First COTOHA API] I tried to summarize the old story
I tried to touch the COTOHA API
I tried to summarize the umask command
I tried to summarize the graphical modeling.
I tried to touch the API of ebay
LeetCode I tried to summarize the simple ones
I tried to summarize various sentences using the automatic summarization API "summpy"
I tried to extract and illustrate the stage of the story using COTOHA
I tried to summarize SparseMatrix
I tried to summarize the basic form of GPLVM
I tried to summarize the string operations of Python
I tried to create Quip API
I tried the Naro novel API 2
I tried to score the syntax that was too humorous and humorous using the COTOHA API.
I tried to summarize the code often used in Pandas
I tried to touch Tesla's API
I tried to summarize the commands often used in business
[Machine learning] I tried to summarize the theory of Adaboost
I tried the Naruro novel API
I tried the Google Cloud Vision API for the first time
I tried to get various information from the codeforces API
I tried to move the ball
I tried using the checkio API
I tried to estimate the interval.
I tried to summarize how to use the EPEL repository again
[Linux] I tried to summarize the command of resource confirmation system
I tried using the COTOHA API (there is code on GitHub)
I tried to summarize the commands used by beginner engineers today
I tried to summarize the frequently used implementation method of pytest-mock
I tried to summarize Python exception handling
I tried tensorflow for the first time
I tried to recognize the wake word
Python3 standard input I tried to summarize
I tried to estimate the pi stochastically
I tried to make a Web API
I tried to summarize Ansible modules-Linux edition
I tried using the BigQuery Storage API
[Slack api + Python] I tried to summarize the methods such as status confirmation and message sending
[Qiita API] [Statistics • Machine learning] I tried to summarize and analyze the articles posted so far.
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I tried to summarize until I quit the bank and became an engineer
I tried to summarize the general flow up to service creation by self-education.
zoom I tried to quantify the degree of excitement of the story at the meeting
I tried to get the authentication code of Qiita API with Python.
I tried to summarize the logical way of thinking about object orientation.
I tried to summarize the Linux commands used by beginner engineers today-Part 1-
I tried to get the movie information of TMDb API with Python
I tried the common story of using Deep Learning to predict the Nikkei 225
Using COTOHA, I tried to follow the emotional course of Run, Melos!
I tried web scraping to analyze the lyrics.
I tried using scrapy for the first time
I tried hitting the Qiita API from go
I tried to optimize while drying the laundry
I tried to save the data with discord
Before the coronavirus, I first tried SARS analysis
I tried using the Google Cloud Vision API
I tried python programming for the first time.
I tried to correct the keystone of the image
I tried Mind Meld for the first time
Qiita Job I tried to analyze the job offer
I tried to implement the traveling salesman problem