[PYTHON] Winner of the one with the highest degree of similarity to the original story in "The winner of the one who wrote the most stinky Hototogisu"

Overview

A long time ago, there was a story saying, "The guy who wrote the most stinky Hototogisu won the championship [^ 1]". If you don't cry, invite me to nothingness (Izanae) Tokitori (Lesser cuckoo) It's like Crying my jet-black blade, Hototogisu.

I like all the works, but it's not good if this kind of work is too far from the original material, and the best taste is to keep the shape and meaning similar to the original material but to give a sense of kitchen. I'm wondering.

Therefore, this time, we decided to hold a decisive battle ** in which "Kitchen two-smelling Hototogisu" and the original Hototogisu three phrases [^ 2] are compared by ** natural language processing, and the one with the highest degree of similarity is the winner. ..

kids_chuunibyou_boy.png (Figure. Contest image)

[^ 1]: Summary blog and [Original thread (disappeared)](http://hibari.2ch.net/test/read.cgi/ news4vip / 0307964783 /). There was a high-quality reading video with Nico Douga [Author](https://dic.nicovideo.jp/a/%E3%83%84%E3%83%90%E3%82%B5%40% It seems that E3% 83% A6% E3% 83% BC% E3% 83% 95% E3% 83% AB% E3% 82% AB) has disappeared. .. .. Sorry. [^ 2]: Source of the phrase that Nobunaga, Hideyoshi, and Ieyasu wrote (Kokushikan University Library / Information Media Center)

"Kitchen Smell Hototogisu" work list

Click to expand

(Line breaks are converted to spaces)

hototogisu_utf8.csv


If it doesn't ring, it will decay there.
If it doesn't ring, swallow it in the abyss! Dark Infinity! !!
If you can't cry, scream in a scream, Hototogisu
If you don't scream, wait for a long time until you scream.
If it doesn't ring, let's prove the reason for my existence by not ringing Hototogisu
Circular Truth Tiro Finale
The world will be filled with screams of chaos, even if it doesn't cry.
If it doesn't ring, it's the only beautiful thing in this crazy world. It's a comedy called love spun by humans, bound by sad reincarnation.
Dokoku ──"Unlucky return"
If it doesn't ring, go crazy in the dark night
If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci
If you don't cry, invite me to nothingness(Izanae)Tokitori(Lesser cuckoo)
If it doesn't ring, go to the end of the circle(Phoenix)
If you don't cry, it looks like me
If it doesn't ring, eat the darkness of the heavens and the earth, and kill the thunder.
Cry, don't let me down
If it doesn't ring, it sounds empty
Prophet and Savior if you don't cry(Amos and Messiah)Lesser cuckoo
If it doesn't ring, keep quiet and watch me
My Requiem Dedicated to the King Without (Hototogisu)
If it doesn't ring, the crimson universe(Sky)Lesser cuckoo
If it doesn't ring, Now cool mar day mar tall Hototogisu
Crying My Jet Black Blade Flame Doo Fighting Sword(Lesser cuckoo)
If it doesn't ring, count your sins--Hototogisu!
If you don't cry, hold my darkness Hototogisu
When he was a child, his parents were killed in front of him, and he was deeply hurt and lost his emotions. Since then, I've become a body that can't cry.
Cut down the forbidden underworld"Unlucky return"
Don't cry I don't want to see your tears.
If it doesn't ring, let's destroy everything.
Does Temee not want to help the Lesser Cuckoo??Temee and others have been waiting for a long time?You don't have to kill the lesser cuckoo, you don't have to turn to the enemy of the lesser cuckoo, everyone laughs and the highest and highest happy ending that everyone wants!You've been waiting for a long time, like this!It's not a place to connect until the hero comes!It's not time to make Hideyoshi appear!Nobody else, not Ieyasu!Didn't you vow to help and show only one bird with that hand of Temee?!?I wanted to be the main character all the time!I wanted to be a military commander who protects only one bird who bets his life on BASARA.!Then it's not over at all!It ’s not even started!Don't despair with a slightly longer prologue!!You can reach it if you reach out!Let's get started!!Nobunaga!!!
Unleash the dim and eternal death and destroy everything that is full of deception
It doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !!

Implementation

Similarity calculation API provided by COTOHA API /apireference.html#similarity) is used.

The original material of the lesser cuckoo is the following three works. Nobunaga: If it doesn't ring, kill it. Hideyoshi: If it doesn't ring, let's ring it. Ieyasu: If it doesn't ring, wait until it rings.

First, compare each of the above three phrases with the "Kitchen Smell Hototogisu Works" in order to create a ranking that resembles each daimyo. After that, by summing the numerical values of each degree of similarity, the "kitchen two-smelling lesser cuckoo overall winning work" with the highest degree of similarity to the original material is determined. (That is, the one with the highest degree of similarity on average wins.)

code

Click to expand

I borrowed @ youwht's COTOHA fastest tutorial and implemented it on Colaboratory. First of all, let's move the tutorial by referring to the article.

Next, do "+ Add code" and refer to @ uni-3's article How to read a file with google Colaboratory.

# show upload dialog
from google.colab import files
uploaded = files.upload()

Write, display the uploader, and upload the above work list "hototogisu_utf8.csv". After that, read the file line by line as shown below.


import csv

f = open('hototogisu_utf8.csv','r',encoding = "utf-8-sig")
reader = csv.reader(f)

sentence1 = "If it doesn't ring, kill it."
d_nobunaga = {}
for row in reader:
    sentence2="".join(row)
    print(sentence2) #For progress display
    api_result  = cotoha_api.callSimilarityApi(sentence1, sentence2)
    result_score = api_result['result']['score']
    d_nobunaga[sentence2]=result_score
f.close()
print(d_nobunaga) #For result display

For example, the degree of similarity with each daimyo is calculated and stored in the dictionary. When sorting and displaying in order of similarity,


import pprint

d_sorted = sorted(d_nobunaga.items(), key=lambda x:x[1])
pprint.pprint(d_sorted)

It is said. If the degree of similarity with each of the three daimyo can be obtained, it is totaled as follows.


from collections import Counter

d_sum = dict(Counter(d_nobunaga) + Counter(d_hideyoshi) + Counter(d_ieyasu))
d_sum_sorted = sorted(d_sum.items(), key=lambda x:x[1])

pprint.pprint(d_sum_sorted)

Result announcement

Finally, we will announce the similarity ranking with each of the three daimyo and the overall ranking that totals them.

Nobunaga similarity ranking

Comparison source "If it doesn't ring, kill it. Hototogisu"

** Third place "If you don't scream, wait for a long time until you scream. Hototogisu" ** Score=0.98137116

** Second place 'If it doesn't ring, let's destroy everything' Hototogisu' ** Score=0.9890674

** First place 'If it doesn't ring, go crazy in the dark night Hototogisu' ** Score=0.9925457

List of all results (click to expand)
[('Circular Truth Tiro Finale', 0.0968629),
 ('Dokoku ──"Unlucky return"', 0.18160401),
 ('My Requiem Dedicated to the King Without (Hototogisu)', 0.5759884),
 ('Prophet and Savior if you don't cry(Amos and Messiah)Lesser cuckoo', 0.7431393),
 ('Cut down the forbidden underworld"Unlucky return"', 0.7440541),
 ('Don't cry I don't want to see your tears.', 0.81511253),
 ('If it doesn't ring, swallow it in the abyss! Dark Infinity! !!', 0.81713116),
 ('Unleash the dim and eternal death and destroy everything that is full of deception', 0.84358317),
 ('If it doesn't ring, Now cool mar day mar tall Hototogisu', 0.8505782),
 ('If it doesn't ring, it's the only beautiful thing in this crazy world. It's a comedy called love spun by humans, bound by sad reincarnation.', 0.8562619),
 ('Crying My Jet Black Blade Flame Doo Fighting Sword(Lesser cuckoo)', 0.87478447),
 ('If it doesn't ring, go to the end of the circle(Phoenix)', 0.8792434),
 ('If it doesn't ring, eat the darkness of the heavens and the earth, and kill the thunder.', 0.89703643),
 ('If it doesn't ring, let's prove the reason for my existence by not ringing Hototogisu', 0.9015832),
 ('Does Temee not want to help the Lesser Cuckoo??Temee and others have been waiting for a long time?You don't have to kill the lesser cuckoo, you don't have to turn to the enemy of the lesser cuckoo,'
  'Everyone laughs and the highest and highest happy ending that everyone wants!You've been waiting for a long time, like this! '
  'It's not a place to connect until the hero comes!It's not time to make Hideyoshi appear!Nobody else, not Ieyasu! '
  'Didn't you vow to help and show only one bird with that hand of Temee?!?I wanted to be the main character all the time! '
  'I wanted to be a military commander who protects only one bird who bets his life on BASARA.!Then it's not over at all! '
  'It ’s not even started!Don't despair with a slightly longer prologue!!You can reach it if you reach out!Let's get started!!Nobunaga!!!',
  0.921118),
 ('The world will be filled with screams of chaos, even if it doesn't cry.', 0.92247653),
 ('If you don't cry, it looks like me', 0.92531496),
 ('If it doesn't ring, the crimson universe(Sky)Lesser cuckoo', 0.9365017),
 ('If it doesn't ring, keep quiet and watch me', 0.9551776),
 ('If you don't cry, hold my darkness Hototogisu', 0.955265),
 ('If it doesn't ring, count your sins--Hototogisu!', 0.9661663),
 ('If it doesn't ring, it sounds empty', 0.96618557),
 ('If you can't cry, scream in a scream', 0.97172475),
 ('If you don't cry, invite me to nothingness(Izanae)Tokitori(Lesser cuckoo)', 0.97251),
 ('Cry, don't let me down', 0.97454035),
 ('If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci', 0.97529954),
 ('When he was a child, his parents were killed in front of him, and he was deeply hurt and lost his emotions. Since then, I've become a body that can't cry.',
  0.9760083),
 ('It doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !!', 0.97693664),
 ('If it doesn't ring, it will decay there.', 0.98118687),
 ('If you don't scream, wait for a long time until you scream.', 0.98137116),
 ('If it doesn't ring, let's destroy everything.', 0.9890674),
 ('If it doesn't ring, go crazy in the dark night', 0.9925457)]

Hideyoshi Similarity Ranking

Comparison source "If it doesn't ring, let's ring it. Hototogisu"

** Third place "If you don't scream, wait for a long time until you scream. Hototogisu" ** Score=0.9980564

** Second place 'If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci' ** Score=0.9987527

** First place 'Do not ring! !! !! !! !! !! !! !! !! !! !! !! !! !! '** Score=0.999147

List of all results (click to expand)
[('Dokoku ──"Unlucky return"', 0.06115984),
 ('Circular Truth Tiro Finale', 0.11472729),
 ('My Requiem Dedicated to the King Without (Hototogisu)', 0.36956403),
 ('Cut down the forbidden underworld"Unlucky return"', 0.39860317),
 ('Unleash the dim and eternal death and destroy everything that is full of deception', 0.54992396),
 ('When he was a child, his parents were killed in front of him, and he was deeply hurt and lost his emotions. Since then, I've become a body that can't cry.',
  0.5935572),
 ('Does Temee not want to help the Lesser Cuckoo??Temee and others have been waiting for a long time?You don't have to kill the lesser cuckoo, you don't have to turn to the enemy of the lesser cuckoo,'
  'Everyone laughs and the highest and highest happy ending that everyone wants!You've been waiting for a long time, like this! '
  'It's not a place to connect until the hero comes!It's not time to make Hideyoshi appear!Nobody else, not Ieyasu! '
  'Didn't you vow to help and show only one bird with that hand of Temee?!?I wanted to be the main character all the time! '
  'I wanted to be a military commander who protects only one bird who bets his life on BASARA.!Then it's not over at all! '
  'It ’s not even started!Don't despair with a slightly longer prologue!!You can reach it if you reach out!Let's get started!!Nobunaga!!!',
  0.68453455),
 ('If it doesn't ring, it's the only beautiful thing in this crazy world. It's a comedy called love spun by humans, bound by sad reincarnation.', 0.74453974),
 ('Prophet and Savior if you don't cry(Amos and Messiah)Lesser cuckoo', 0.76365894),
 ('Don't cry I don't want to see your tears.', 0.7834858),
 ('If it doesn't ring, eat the darkness of the heavens and the earth, and kill the thunder.', 0.9013229),
 ('If it doesn't ring, keep quiet and watch me', 0.90755564),
 ('The world will be filled with screams of chaos, even if it doesn't cry.', 0.9110487),
 ('If it doesn't ring, swallow it in the abyss! Dark Infinity! !!', 0.9147637),
 ('Crying My Jet Black Blade Flame Doo Fighting Sword(Lesser cuckoo)', 0.9175889),
 ('If you don't cry, invite me to nothingness(Izanae)Tokitori(Lesser cuckoo)', 0.9391265),
 ('If it doesn't ring, let's prove the reason for my existence by not ringing Hototogisu', 0.9501219),
 ('If it doesn't ring, go to the end of the circle(Phoenix)', 0.9604996),
 ('If it doesn't ring, Now cool mar day mar tall Hototogisu', 0.9611823),
 ('If you don't cry, it looks like me', 0.96483713),
 ('If you don't cry, hold my darkness Hototogisu', 0.9742791),
 ('If it doesn't ring, the crimson universe(Sky)Lesser cuckoo', 0.98564553),
 ('If it doesn't ring, let's destroy everything.', 0.988247),
 ('If it doesn't ring, count your sins--Hototogisu!', 0.99067533),
 ('Cry, don't let me down', 0.99199975),
 ('If it doesn't ring, go crazy in the dark night', 0.9949761),
 ('If it doesn't ring, it will decay there.', 0.99638695),
 ('If you can't cry, scream in a scream', 0.99683446),
 ('If it doesn't ring, it sounds empty', 0.99736595),
 ('If you don't scream, wait for a long time until you scream.', 0.9980564),
 ('If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci', 0.9987527),
 ('It doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !!', 0.999147)]

Ieyasu similarity ranking

Comparison source "If it doesn't ring, wait until it rings."

** Third place 'If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci' ** Score=0.99719757

** Second place 'Do not ring! !! !! !! !! !! !! !! !! !! !! !! !! !! '** Score=0.997973

** First place "If you don't scream, wait for a long time until you scream. Hototogisu" ** Score=0.99912924

List of all results (click to expand)
[('Dokoku ──"Unlucky return"', 0.077604),
 ('Circular Truth Tiro Finale', 0.13157393),
 ('My Requiem Dedicated to the King Without (Hototogisu)', 0.38498312),
 ('Unleash the dim and eternal death and destroy everything that is full of deception', 0.4915818),
 ('Cut down the forbidden underworld"Unlucky return"', 0.49610156),
 ('When he was a child, his parents were killed in front of him, and he was deeply hurt and lost his emotions. Since then, I've become a body that can't cry.',
  0.6056571),
 ('Prophet and Savior if you don't cry(Amos and Messiah)Lesser cuckoo', 0.6661081),
 ('If it doesn't ring, it's the only beautiful thing in this crazy world. It's a comedy called love spun by humans, bound by sad reincarnation.', 0.68198323),
 ('Don't cry I don't want to see your tears.', 0.77132803),
 ('Does Temee not want to help the Lesser Cuckoo??Temee and others have been waiting for a long time?You don't have to kill the lesser cuckoo, you don't have to turn to the enemy of the lesser cuckoo,'
  'Everyone laughs and the highest and highest happy ending that everyone wants!You've been waiting for a long time, like this! '
  'It's not a place to connect until the hero comes!It's not time to make Hideyoshi appear!Nobody else, not Ieyasu! '
  'Didn't you vow to help and show only one bird with that hand of Temee?!?I wanted to be the main character all the time! '
  'I wanted to be a military commander who protects only one bird who bets his life on BASARA.!Then it's not over at all! '
  'It ’s not even started!Don't despair with a slightly longer prologue!!You can reach it if you reach out!Let's get started!!Nobunaga!!!',
  0.8294906),
 ('If it doesn't ring, eat the darkness of the heavens and the earth, and kill the thunder.', 0.84384555),
 ('If it doesn't ring, swallow it in the abyss! Dark Infinity! !!', 0.8595806),
 ('If it doesn't ring, let's prove the reason for my existence by not ringing Hototogisu', 0.8727503),
 ('Crying My Jet Black Blade Flame Doo Fighting Sword(Lesser cuckoo)', 0.8862257),
 ('The world will be filled with screams of chaos, even if it doesn't cry.', 0.8894223),
 ('If it doesn't ring, go to the end of the circle(Phoenix)', 0.9269579),
 ('If it doesn't ring, Now cool mar day mar tall Hototogisu', 0.94417894),
 ('If it doesn't ring, keep quiet and watch me', 0.9468389),
 ('If you don't cry, invite me to nothingness(Izanae)Tokitori(Lesser cuckoo)', 0.9621264),
 ('If you don't cry, hold my darkness Hototogisu', 0.9646823),
 ('If you don't cry, it looks like me', 0.96526414),
 ('If it doesn't ring, the crimson universe(Sky)Lesser cuckoo', 0.97001034),
 ('If it doesn't ring, let's destroy everything.', 0.9796889),
 ('Cry, don't let me down', 0.98772347),
 ('If it doesn't ring, count your sins--Hototogisu!', 0.98809355),
 ('If it doesn't ring, it sounds empty', 0.99373204),
 ('If you can't cry, scream in a scream', 0.9938769),
 ('If it doesn't ring, it will decay there.', 0.9939769),
 ('If it doesn't ring, go crazy in the dark night', 0.9942371),
 ('If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci', 0.99719757),
 ('It doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !!', 0.997973),
 ('If you don't scream, wait for a long time until you scream.', 0.99912924)]

Overall similarity ranking

It is a ranking that adds up all the above scores.

** Third place 'Do not ring! !! !! !! !! !! !! !! !! !! !! !! !! !! '** Score=2.97405664

** Second place "If you don't scream, wait for a long time until you scream. Hototogisu" ** Score=2.9785568

** First place 'If it doesn't ring, go crazy in the dark night Hototogisu' ** Score=2.981758

List of all results (click to expand)
[('Dokoku ──"Unlucky return"', 0.32036785),
 ('Circular Truth Tiro Finale', 0.34316412),
 ('My Requiem Dedicated to the King Without (Hototogisu)', 1.33053555),
 ('Cut down the forbidden underworld"Unlucky return"', 1.63875883),
 ('Unleash the dim and eternal death and destroy everything that is full of deception', 1.8850889300000002),
 ('Prophet and Savior if you don't cry(Amos and Messiah)Lesser cuckoo', 2.17290634),
 ('When he was a child, his parents were killed in front of him, and he was deeply hurt and lost his emotions. Since then, I've become a body that can't cry.',
  2.1752225999999997),
 ('If it doesn't ring, it's the only beautiful thing in this crazy world. It's a comedy called love spun by humans, bound by sad reincarnation.', 2.28278487),
 ('Don't cry I don't want to see your tears.', 2.36992636),
 ('Does Temee not want to help the Lesser Cuckoo??Temee and others have been waiting for a long time?You don't have to kill the lesser cuckoo, you don't have to turn to the enemy of the lesser cuckoo,'
  'Everyone laughs and the highest and highest happy ending that everyone wants!You've been waiting for a long time, like this! '
  'It's not a place to connect until the hero comes!It's not time to make Hideyoshi appear!Nobody else, not Ieyasu! '
  'Didn't you vow to help and show only one bird with that hand of Temee?!?I wanted to be the main character all the time! '
  'I wanted to be a military commander who protects only one bird who bets his life on BASARA.!Then it's not over at all! '
  'It ’s not even started!Don't despair with a slightly longer prologue!!You can reach it if you reach out!Let's get started!!Nobunaga!!!',
  2.43514315),
 ('If it doesn't ring, swallow it in the abyss! Dark Infinity! !!', 2.59147546),
 ('If it doesn't ring, eat the darkness of the heavens and the earth, and kill the thunder.', 2.64220488),
 ('Crying My Jet Black Blade Flame Doo Fighting Sword(Lesser cuckoo)', 2.6785990699999997),
 ('The world will be filled with screams of chaos, even if it doesn't cry.', 2.72294753),
 ('If it doesn't ring, let's prove the reason for my existence by not ringing Hototogisu', 2.7244554),
 ('If it doesn't ring, Now cool mar day mar tall Hototogisu', 2.75593944),
 ('If it doesn't ring, go to the end of the circle(Phoenix)', 2.7667009),
 ('If it doesn't ring, keep quiet and watch me', 2.8095721399999998),
 ('If you don't cry, it looks like me', 2.85541623),
 ('If you don't cry, invite me to nothingness(Izanae)Tokitori(Lesser cuckoo)', 2.8737629),
 ('If it doesn't ring, the crimson universe(Sky)Lesser cuckoo', 2.89215757),
 ('If you don't cry, hold my darkness Hototogisu', 2.8942264),
 ('If it doesn't ring, count your sins--Hototogisu!', 2.94493518),
 ('Cry, don't let me down', 2.95426357),
 ('If it doesn't ring, let's destroy everything.', 2.9570033000000002),
 ('If it doesn't ring, it sounds empty', 2.95728356),
 ('If you can't cry, scream in a scream', 2.96243611),
 ('If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci', 2.9712498099999998),
 ('If it doesn't ring, it will decay there.', 2.9715507199999998),
 ('It doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !!', 2.97405664),
 ('If you don't scream, wait for a long time until you scream.', 2.9785568),
 ('If it doesn't ring, go crazy in the dark night', 2.9817589)]

Comment (Summary)

That's why the overall victory was **'If it doesn't ring, it's crazy in the dark night' **! Although it is simple, it has a "likeness" and has a high affinity with Nobunaga, so I think it is a reasonable place. The average sync rate was as high as ** 99.4% **.

**'If you don't scream, wait for a long time until you scream'. Hototogisu' ** is Ieyasu with only 5 + 2 characters added, so it was stable enough to always keep within the third place. Perhaps because the number of sounds has increased, the result is that I am content with the second place overall. I think the point of evaluation is that even if the kanji for "啼 KU" is different, the degree of similarity is high.

'Doesn't ring! !! !! !! !! !! !! !! !! !! !! !! !! !! It was surprising that' was evaluated. Only the first three letters match, but the synchronization rate with Hideyoshi was ** 99.9147% **, which was the highest record among all the similarity scores this time. ** Is it okay? ** **

**'If it doesn't ring, Madoin Periticilium Suzaku Falsi's Luci' ** also had a pretty strong presence, but it was a pity that it fell to 5th place overall. The reason for the high evaluation is that Suzaku and Tokitori had a high affinity, or because it was a joker-like existence that the meaning of Falsi's Luci was too unclear and the similarity to any word was high. I don't know if it was, but it was a great fight. It's actually Peri ** City ** Rium.

By the way, my personal favorite is **'My requiem dedicated to the King of Nothing (Hototogisu)' **, but it was judged that it wasn't even scratched, and it was the third from the bottom. ** Well, that's right. ** **

That's all from the field.

Recommended Posts