I have lived a life with a lot of "happiness". [Use COTOHA API to make "human disqualification" "happy"]

Introduction

During this time, I read "No Longer Human" by Osamu Dazai. As anyone who has read it will understand, Reading in an almost dull atmosphere made me feel quite dark.

Well then ** Let's rewrite it into a happy sentence. ** **

What I used

COTOHA API Use the sentiment analysis function to acquire the keyword (emotion keyword) that made the emotion judgment in the sentence and the emotion represented by the emotion keyword. ・ Word2vec Add or subtract another word to the emotional keyword to get the word that matches the meaning.

Text to use

I picked some sentences that make me happy.

"I have lived a shameful life."

"In other words, I don't know.
I have no idea what the nature and extent of the suffering of my neighbor is. "

"The woman died.
Then, only I was saved. "

"Ask God.
Trust is a sin. "

"Human, disqualified.
I am no longer a human being at all. "

1. I added "happiness"

Method

  1. Use the COTOHA API to get one line of emotional keywords from each sentence.
  2. Use word2vec to get the word that adds "happiness" to the emotional keyword.
  3. Replace the acquired word with an emotional keyword.

** Example: **

  1. Acquire the emotional keyword "song" from "I enjoy the spring of life".
  2. If you add "unhappiness" to "song", you can get "hardship", "unhappiness", "ruin", etc.
  3. Replace "song" with "hardship". Then " Enjoying the spring of life " But " I'm "hardening" the spring of life " It becomes.

result

「"joy"I have lived a life with many people. "

"That is,"Recognize"It is.
Neighbor's"suffer"I have no idea what the nature or degree of is. "

"The woman died.
And only myself"Help"。」

"Ask God.
"happiness"Is sinful. "

"Human,"False start"。
I am no longer a human being at all. "

I feel happy and happy. But in some places, it only emphasizes happiness, such as "Ask God." Happiness "is sin."

Now, let's put out words with a little stronger emotional keywords.

2. I added "happiness" while emphasizing the original text

Method

  1. Use the COTOHA API to get one line of emotional keywords from each sentence.
  2. Use word2vec to get the word that adds "happiness" to the emotional keyword.
  3. ** Add emotion keywords to the acquired words to acquire other words. ** **
  4. Replace the acquired word with an emotional keyword.

** Example: **

  1. Acquire the emotional keyword "song" from "I enjoy the spring of life".
  2. If you add "unhappiness" to "song", you can get "hardship", "unhappiness", "ruin", etc.
  3. If you add "song" to "suffering", you can get "suffering", "prosperity", "suffering", etc.
  4. Replace "song" with "distress". Then " Enjoying the spring of life " But " I'm "distressing" the spring of life " It becomes.

result

「"sorrow"I have lived a life with many people. "

"That is,"Understand"It is.
Neighbor's"Suffering"I have no idea what the nature or degree of is. "

"The woman died.
And only myself"Helped"。」

"Ask God.
"happiness"Is sinful. "

"Human,"Start accident"。
I am no longer a human being at all. "

I will ignore the fact that there are some strange parts in the text this time.

The dull part of the original text has come out too strongly. If adding the original text as it is would make it dull like this, Let's subtract the emotions represented by the emotion keywords.

3. I tried to draw emotions and add "happiness"

Method

  1. Use the COTOHA API to get one line of emotional keywords from each sentence.
  2. Use word2vec to add "happiness" to the emotional keyword and get the ** emotionally subtracted ** word.
  3. Replace the acquired word with an emotional keyword.

** Example: **

  1. Acquire the emotional keyword "song" from "I enjoy the spring of life".
  2. If you add "unhappiness" to "song" and subtract the emotion "pleasant", you can get "ruin", "hardship", "hardship", etc.
  3. Replace "song" with "ruin". Then " Enjoying the spring of life " But " The spring of life is "ruined" " It becomes.

result

「"happiness"I have lived a life with many people. "

"That is,"Understand"It is.
Neighbor's"suffer"I have no idea what the nature or degree of is. "

"The woman died.
And only myself"happiness"。」

"Ask God.
"Sincerity"Is sinful. "

"Human,"winner"。
I am no longer a human being at all. "

I look very happy! That famous phrase " I have lived a shameful life. " But " I have lived a life with a lot of "happiness". " You can see the north by living a happy life with smooth sailing.

Another famous phrase Human, disqualified. `` But Human," winner ". `` It has become. I think it was a life where I had good relationships, worked properly, and didn't drown in alcohol.

Conclusion

I became "happy" as it was.

Recommended Posts

I have lived a life with a lot of "happiness". [Use COTOHA API to make "human disqualification" "happy"]
[Introduction to StyleGAN] I played with "The Life of a Man" ♬
I tried to make a mechanism of exclusive control with Go
I tried to make a Web API
I tried to make "Sakurai-san" a LINE BOT with API Gateway + Lambda
I tried to make a simple mail sending application with tkinter of Python
I want to make a game with Python
I tried to make a castle search API with Elasticsearch + Sudachi + Go + echo
I tried to make a simple image recognition API with Fast API and Tensorflow
I tried to make something like a chatbot with the Seq2Seq model of TensorFlow
I want to make a blog editor with django admin
I want to start a lot of processes from python
I want to make a click macro with pyautogui (desire)
NikuGan ~ I want to see a lot of delicious meat! !!
I want to make a click macro with pyautogui (outlook)
I want to use a virtual environment with jupyter notebook!
[5th] I tried to make a certain authenticator-like tool with python
I want to use a wildcard that I want to shell with Python remove
Rubyist tried to make a simple API with Python + bottle + MySQL
[2nd] I tried to make a certain authenticator-like tool with python
I tried to make a regular expression of "amount" using Python
I tried to make a regular expression of "time" using Python
[3rd] I tried to make a certain authenticator-like tool with python
Correspondence analysis of sentences with COTOHA API and save to file
Sample to use after OAuth authentication of BOX API with Python
I tried to create a list of prime numbers with python
I made a lot of files for RDP connection with Python
I tried to make a regular expression of "date" using Python
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
[1st] I tried to make a certain authenticator-like tool with python
I tried to make a strange quote for Jojo with LSTM
Is it possible to enter a venture before listing and make a lot of money with stock options?
I tried to make a thumbnail image of the best avoidance flag-chan! With RGB values ​​[Histogram] [Visualization]
Beginners will make a Bitcoin automatic trading bot aiming for a lot of money! Part 2 [Transaction with API]
I tried to introduce a serverless chatbot linked with Rakuten API to Teams
Use shutil to delete all folders with a small number of files
[Python] I made a decorator that doesn't seem to have any use.
I came up with a way to make a 3D model from a photo.
I tried to make a calculator with Tkinter so I will write it
[AWS] [GCP] I tried to make cloud services easy to use with Python
I tried to get the authentication code of Qiita API with Python.
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
I tried to get the movie information of TMDb API with Python
I tried to make a url shortening service serverless with AWS CDK
I was addicted to trying Cython with PyCharm, so make a note
I wanted to use the find module of Ansible2, but it took some time, so make a note