[PYTHON] I wanted to generate a sentence like "Fucking Deca Rashomon" (past form)

Caution

Contains these elements

Preface

Fucking Deca Rashomon was talked about a while ago, I like this grammar that grows huge, so I want to generate it. Masu

environment

Preparation

Obtaining text data

Download the original Rashomon from Aozora Bunko. Here said that you can download a file without ruby, but I found only ruby, so download that and download ruby. Remove. First, delete the bottom notation added by Aozora Bunko, image.png

With the function on the text editor side||《[^《》]*》|※[[^[]]*]Deletes (replaces nothing) the string that matches the regular expression in. image.png Oh, and the character code was set to Shift-JIS, but I changed it to UTF-8 because it was awkward.

Think about the direction

Comparison for the time being

This completes the preparation of text data for the time being. Let's compare the shit normal Rashomon and the shit deca Rashomon with a little difff.jp. image.png Do you understand. Rashomon is made into a fucking deca with ** complete "addition" ** without cutting the original text at all except for line breaks. After all, you need to be careful not to change the word itself ** when generating a fucking deca sentence. Simply making the part of speech excessive will destroy the original text.

About "one-point specialization"

Also, when it comes to fucking deca, it's more of a ** one-point specialization ** than a lot of description. For example

Instead, a lot of crows gathered from somewhere. When I look at it in the daytime, the crows form a circle and fly around the tall Shibi.

The text of the shit normal Rashomon is changed to shit deca Rashomon like this --- because the pun is bad, let's make it ** shit deka **.

Instead, ** super-evil ** crows have gathered from somewhere ** in billions **. When I look at it in the daytime, the crows make a circle with ** 10,000 ** wings, ** shit ** around the high Shibi ** at the volume of the eardrum destruction level **, while ** at subsonic speed * * Flying around.

This fucking is focused on ** strengthening the existing description , I think. For example, "many" becomes " million units ** many", "how many" becomes "how many ** million ", and "high" becomes " shit ** high". .. For example, it would be possible to increase the attributes by changing "high" to "** big and ** high", but instead of doing that, we are focusing on strengthening the existing description. Also, if the existing description does not exist, ** a new description is created and it is strengthened . If it is a "crow", it becomes " evil ** crow", and it becomes "** super ** evil crow". In the first place, the titles are "** shit ", " big **", and "Rashomon", so "shit" is strengthening "deca". [^ 1]

get along

Pillow for the time being

"Spring" is important for making a shit. These guys will do something right away. In order to "roll up"

  1. Find an independent verb

It seems that you should go through a typical process. I think there is another good way, but I couldn't think of it, so I hit the IPA dictionary directly ** (Reference /adsmedia.hatenablog.com/entry/2016/10/20/002211))).

Data preparation

First, download IPA dictionary, unzip it, copy the file Verb.csv in it to the current directory, and open it. This is a file that contains verb data. The contents are like this. image.png I don't need anything other than the row where "Continuous form" is written in the 10th column, so delete it. I think it would be nice to open it with a text editor (not a spreadsheet software) and delete the string that matches the regular expression of ^ (?!. *, Continuous form,). * $ \ N. image.png Now, save it as ** continuous form list.csv **. Since the post-processing is troublesome, change the character code to ** UTF-8 **. In addition, we will create a file related to the utilization of "Makuru". This part of the original Verb.csv image.png Copy and save it in the current directory with the name ** Spree.csv **. This is also UTF-8.

code

I have written.

python


# -*- coding: utf-8 -*-
import MeCab
import csv
t = MeCab.Tagger()
print("Enter")
text = input()
nodes_s = t.parseToNode(text)
output = ""
with open('Continuous form list.csv',encoding='UTF-8') as r, open("Spree.csv",encoding='UTF-8') as m:
    r_list = [list(x) for x in zip(*[row for row in (csv.reader(r))])]
    m_list = [list(x) for x in zip(*[row for row in (csv.reader(m))])]
while nodes_s:
    nodes_a = nodes_s.feature.split(",")
    if nodes_a[:2] == ["verb", "Independence"] and not nodes_s.feature.split(",")[6] in ["To do","is there"]:
        ori = nodes_a[6]
        type = nodes_a[5]
        renyo = r_list[0][r_list[10].index(ori)]
        mak = m_list[0][m_list[9].index(type)]
        if mak == "Roll" and nodes_s.next.feature.split(",")[7][0] in "Tachitsuteto":
            mak = "Maku"  #Exception handling because there were cases where the connection did not work.
        output += renyo + mak
    else:
        output += nodes_s.surface
    nodes_s = nodes_s.next
print("\n output:\n" + output)

Sorry for the sloppy code. Run this guy.

input `The servant cursed the old woman as she stumbled upon the corpse, blocking her hurriedly trying to escape. The old woman still tries to get rid of her servant. The servant also pushes it back, trying not to let it go. In the corpse, the two grabbed each other silently for a while. However, the victory or defeat is known from the beginning. The servant finally grabbed the old woman's arm and forcibly knocked it down. It's an arm with only bones and skin, just like a chicken leg. ``

output `The servant cursed the old woman as she stumbled upon the corpse, hurriedly fluttering and blocking the line that was trying to escape. The old woman still tries to get rid of her servant. The servant also pushes it back, trying not to let it go. In the corpse, the two grabbed each other silently for a while. However, the victory or defeat is clear from the beginning. The servant finally grabbed the old woman's arm and forcibly knocked it down. It's an arm with only bones and skin, just like a chicken leg. `` For the time being, I feel that what I intended to do is something that seems to be done. There are various deficiencies, If this is left as it is, it will be "rolled too much", so adjustments will be necessary.

Kill "do not spoil"

This code makes it look unnatural when you enter certain characters. For example, no one knows the whereabouts of the servant. Assuming you typed The output is No one knows the whereabouts of the servant. It is . No, what? What does it mean that you don't know all about it? Obviously it's weird so I'll change the code.

python


#Omission
while nodes_s:
    nodes_a = nodes_s.feature.split(",")
    if nodes_a[:2] == ["verb", "Independence"] and not nodes_s.feature.split(",")[6] in ["To do","is there"]:
#Omission

Play with the if here for a moment

python


while nodes_s:
    nodes_a = nodes_s.feature.split(",")
    if nodes_a[:2] == ["verb", "Independence"] and (not nodes_s.feature.split(",")[6] in ["To do","is there"]) and not nodes_s.next.feature.split(",")[4] in ["Special Nai"]:

I will do this. This is a process similar to the exception handling at the time of connection, and it is judged by ** pre-reading ** the next node of the node being processed with next. With this, no one knows the whereabouts of the servant. `Is output.

Kill "Makudde"

I'll kill this guy because "choose" becomes something like "choose and squeeze". Roughly replace to kill. I solved it by inserting ʻoutput = output.replace ("Makutte", "Makutte") one line before print. Oh, there was also something like rolled, so let's always replace it with rolled`

The following is omitted

Well, I artificially fixed an unnatural place like this Since it is troublesome to move the process, I omitted it, and as a result I got this code

python


# -*- coding: utf-8 -*-
import MeCab
import csv
t = MeCab.Tagger()
print("Enter")
inp = input()
def makuring(text):
    nodes_s = t.parseToNode(text)
    output = ""
    with open('Continuous form list.csv',encoding='UTF-8') as r, open("Spree.csv",encoding='UTF-8') as m:
        r_list = [list(x) for x in zip(*[row for row in (csv.reader(r))])]
        m_list = [list(x) for x in zip(*[row for row in (csv.reader(m))])]
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        if nodes_a[:2] == ["verb", "Independence"] and (not nodes_s.feature.split(",")[6] in ["To do", "is there", "Become", "Is","To tell","say","go"]) and not nodes_s.next.feature.split(",")[4] in ["Special Nai", "Special"]:
            ori = nodes_a[6]
            type = nodes_a[5]
            if ori in r_list[10]:
                renyo = r_list[0][r_list[10].index(ori)]
                mak = m_list[0][m_list[9].index(type)]
                if mak == "Roll" and nodes_s.next.feature.split(",")[7][0] in "Tachitsuteto":
                    mak = "Maku"  #Exception handling because there were cases where the connection did not work.
                output += renyo + mak
            else:
                output += nodes_s.surface
        else:
            output += nodes_s.surface
        nodes_s = nodes_s.next
    return output.replace("Makude", "Roll up").replace("Pillow", "Sprinkled").replace("Makuda", "Rolled up")

By the way, I treated these as functions. This completes the "rolling" process for the time being.

Stick the numbers together

Rashomon has also turned the numbers into fucking. Is the rate about 100 to 10000 times? Also, there are many events such as 60,000 people against bandits who are "given strangely concrete numbers". For the time being, I made it feel like multiplying the existing numbers by 10 to the 2nd to 4th power.

python


# -*- coding: utf-8 -*-
import MeCab
import csv
from kanjize import int2kanji, kanji2int
import random
t = MeCab.Tagger()
print("Enter")
inp = input()
kan_dic = { "hundred": "hundred","Five": "Five","5": "Five","Eight": "Eight","・": "・","Trillion": "Trillion","9": "Nine",
            "Seven": "Seven","three": "three","0": "〇","0": "〇","Ten thousand": "Ten thousand","zero": "〇","four": "four",
            "7": "Seven","2": "two","4": "four","1": "one","6": "Six","〇": "〇","Ten": "Ten",
            "Six": "Six","8": "Eight","3": "three","two": "two","○": "〇" ,"thousand": "thousand","one": "one",
            "Billion": "Billion","Nine": "Nine","Hyaku": "hundred","zero": "〇","Ichi": "one"} #A dictionary for normalizing numbers created by processing the IPA dictionary

#(Omitted)
def incr(text):
    nodes_s = t.parseToNode(text)
    output = ""
    int_flag = False
    count = 0
    while nodes_s:
        count += 1
        nodes_a = nodes_s.feature.split(",")
        if nodes_a[1] == "number" and nodes_s.surface in kan_dic.keys():
            if not int_flag:
                int_flag = True
                kansuji = ""
            kansuji += kan_dic[nodes_s.surface]
        else:
            if int_flag:
                int_flag = False
                random.seed(kansuji)
                output += int2kanji(kanji2int(kansuji) * (10 ** random.randint(2,4)))
            elif count > 1:
                if nodes_s.prev.surface in ["what", "What", "How many"] and nodes_s.prev.feature.split(",")[1] == "number":
                    random.seed(nodes_s.surface)
                    output += random.choice(["thousand","Ten thousand","Billion"])
            output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

print("\n output:\n" + makuring(incr(inp)))

input `Under the wide gate, there is no one but this man. However, there is one cricket in a large cylinder with the tan coating peeled off in places. As long as Rashomon is on Suzaku Avenue, there are likely to be a few more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man. ``

output Under the wide gate, there is no one but this man. However, a thousand crickets are gathered in a large cylinder with the tan coating peeled off in places. As long as Rashomon is located on Suzaku Avenue, there are likely to be 5,000 more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man. `` The reason why "two three people" is changed to "5,000 people" instead of "two thousand people" (this is a wrong interpretation) is the kanjize used for mutual conversion between kanji and numbers. I think it depends on the specifications of the library. I feel like I can fix it, but it's a hassle, so I'll stop.

"Many" processing

At the time of shit, "a lot" becomes "a lot in millions", isn't it? It seems that nltk and Wordnet will look good, so refer to this article

python


pip install nltk
python -c "import nltk;nltk.download('wordnet')"
python -c "import nltk;nltk.download('omw')"

At the command prompt to prepare the environment. Now, let's try to output a lot of synonyms. (The code of the article I posted earlier is almost the same, I'm sorry)

python


from nltk.corpus import wordnet

synsets = wordnet.synsets("Lots", lang='jpn')
takusan_synset = synsets[0]
synonyms = takusan_synset.lemma_names("jpn")
print(synonyms)

output ['Many','Immeasurable','Large amount','Large amount','Many','Many','Kodai',' Abundance',' Totally',' Yutaka',' Rich',' Abundance',' plump',' rich',' fertility'] It ’s good, it ’s like a lot. Save this spit out list as an array of "lots of words" and go in the direction of adding specific numbers to the words that have the words contained in that array as synonyms. (I gave up because I couldn't think of a way to increase the number of thieves to 60,000)

python


# -*- coding: utf-8 -*-
import MeCab
import csv
from kanjize import int2kanji, kanji2int
import random
from nltk.corpus import wordnet
#(Omitted)
blacklist = []
t = MeCab.Tagger()
takusan = [ 'Lots', 'Large', 'Large amount', 'Mass', 'Many', 'Lot', 'Kodai',
            'Abundant', 'Totally', 'Yutaka', 'Yutakaか', 'Yutaka富', 'Yutaka満', 'Yutaka潤', 'Yutaka饒']
#(Omitted)
def embod(text):
    global blacklist
    nodes_s = t.parseToNode(text)
    output = ""
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        if not (nodes_a[1] in ["verb", "Particle", "symbol", "助verb"] or nodes_s.surface in blacklist):
            synsets = wordnet.synsets(nodes_s.surface, lang='jpn')
            synsets_a = []
            for i in synsets:
                synsets_a += i.lemma_names("jpn")
            if len(set(takusan) & set(synsets_a)) > 0:
                random.seed(nodes_s.prev.prev.surface +nodes_s.prev.surface) #I felt that it would be better if the generated result for one input was always the same, so seed setting
                output += random.choice(["In 10,000 units","In billions","In trillions"])
            else:
                blacklist += nodes_s.surface
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

I had a feeling that the processing would take longer, so I added a blacklist to shorten the execution time. input Instead, a lot of crows gathered from somewhere. When I look at it in the daytime, the crows form a circle and fly around the tall Shibi. Especially when the sky above the gate became cloudy at sunset, it clearly looked like sesame seeds. The crow, of course, comes to beak the flesh of the dead on the gate. ――But today, I can't see any of them, probably because the time limit is late. However, in some places, I can see crow droppings clinging to white on the stone steps with long grass in the collapse. The servant placed the washed-out navy blue fusuma butt on the top of the seven stone steps, and watched the rain dimly, paying attention to the large comedones on his right cheek. .. `` **output** Instead, a lot of crows gathered in trillions from somewhere. When I look around in the daytime, the crows draw a circle with thousands of birds, snarling around the tall Shibi, and flying around. Especially when the sky above the gate became cloudy at sunset, it was clearly visible as if it had been sprinkled with sesame seeds. The crow, of course, comes to beak the flesh of the dead on the gate. ――But today, I can't see a thousand birds, probably because the time limit is late. However, in some places, I could see the crow's droppings clinging to white on the stone steps of the long grass that was about to collapse. The servant puts the washed-out navy blue sliding doors on the top of the 7,000 stone steps, and while worrying about the big comedones on his right cheek, he dimly sprinkles rain. I was looking around. `` Isn't it a pretty good feeling?

Processing of "two three people"

I wrote earlier that "I feel like I can fix it, but I'm going to stop it because it's troublesome", but I feel that it's easier than I thought, so I'll fix it.

python


#(Omitted)
        else:
            if int_flag:
                int_flag = False
                if len(kansuji) > 1:
                    if all((s in "one two three four five six seven eight nine") for s in [kansuji[0],kansuji[1]]): #If the first two letters are both 1-9, it is considered to be similar to "Nisan"
                        output += kansuji[0]
                        kansuji = kansuji[1:]
                random.seed(kansuji)
                output += int2kanji(kanji2int(kansuji) * (10 ** random.randint(2,4)))
#(Omitted)

input `Under the wide gate, there is no one but this man. However, there is one cricket in a large cylinder with the tan coating peeled off in places. As long as Rashomon is on Suzaku Avenue, there are likely to be a few more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man. **output** There is no one but this man under the gate, which is as wide as a trillion. However, a thousand crickets are gathered in a large cylinder with the tan coating peeled off in places. As long as Rashomon is on Suzaku Avenue, there are likely to be two thousand more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man.

Is it perfect?

Addition of description / fucking

Preface (long)

I've finally come ……… Probably the biggest challenge, I still don't understand how to write this No, what should I do? Well, for the time being, I'm going to try something like "add a new description" to a "word that hasn't been described yet".

↑ I wrote this sentence 3 days ago …… I was doing Hacknet if there was a gap of 3 days ……… I'm too unproductive Because I was tampering with Pointclicker's data on Hacknet while laughing like "No, it's really good ~~~~~" ... It's a terrible guy. Well, if you use ** Cabocha for a dependency analysis in 3 days, you can divide it into "sentences with a description" and "sentences without a description". ** I came up with that That's why I installed Cabocha from here for the time being ……… That Well, I'm installing and testing it now, but ** it doesn't output anything ** I failed in something, I can't help it That's why ** look for a dependency parser other than Cabocha **

This is it

COTOHA API. According to an acquaintance, it seems that this guy has a parsing function, ** I thought I'd grab the future with this **, but I don't know what it is, but "I read the terms of service" I can't click the checkbox, so I give up. It's over

When it comes to this

I'll do something about it. Let's make a plan Well, you should judge whether it is "descriptive" or "not described", and if it is not, add something new and appropriate. First of all, there must be something to say ** "words to be described" **. For the time being, let's say that ** general nouns ** (thieves, crickets, etc.) and ** self-reliant verbs ** (speaking, flying around, etc.) are "words to be described." And, ** whether the previous morpheme is a case particle or a kuten ** is used to judge whether "this word to be described" is described. I felt that this would be a good feeling, so I will do this. Let's create a function based on this.

python


#(Omitted)
def deco(text):
    nodes_s = t.parseToNode(text)
    output = ""
    count = 0
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        count += 1
        if nodes_a[:2] in [["noun", "General"], ["noun", "固有noun"], ["verb", "Independence"]] and count > 1:
            if nodes_s.prev.feature.split(",")[0] in ["Adnominal adjective"] or nodes_s.prev.feature.split(",")[1] in ["Case particles", "Kuten", "Comma", "Parallel particles"]:
                output += "Fucking big"
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

print("\n output:\n" + makuring(embod(incr(deco(inp)))))

For the time being, we have created a function that puts "fucking deca" in front of a morpheme that seems to have not been described yet. I haven't even made a distinction between verbs and nouns, but let's do it for now.

input `Under the wide gate, there is no one but this man. However, there is one cricket in a large cylinder with the tan coating peeled off in places. As long as Rashomon is on Suzaku Avenue, there are likely to be a few more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man. ``

output There is no one but this fucking big man under the gate, which is as wide as a trillion. However, a thousand crickets are gathered in a large cricket column with a lot of crickets peeled off. As long as there is a fucking big Rashomon on the fucking big Suzaku Avenue, in addition to this fucking big man, there are likely to be two thousand more people, such as the Ichimekasa and the fucking big eboshi hats that fuck the big rain. That's no one but this fucking big guy. `` Uh ~~~~~~~~~~~~ Can you go ...? No, huh ~~~~ It's still hard to judge, and I'll fix it a little.

python


def deco(text):
    nodes_s = t.parseToNode(text)
    output = ""
    count = 0
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        count += 1
        if count > 1:
            if nodes_s.prev.feature.split(",")[0] in ["Adnominal adjective"] or nodes_s.prev.feature.split(",")[1] in ["Case particles", "Kuten", "Comma", "Parallel particles"]:
                if nodes_a[:2] in [["noun", "General"], ["noun", "固有noun"]]:
                    output += "Fucking big"
                elif nodes_a[:2] in [["verb", "Independence"]]:
                    output += "Absurd"
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

For verbs, "messed up" is added, and for nouns, "fucking big" is added. I think this makes it a little easier to understand.

input `Under the wide gate, there is no one but this man. However, there is one cricket in a large cylinder with the tan coating peeled off in places. As long as Rashomon is on Suzaku Avenue, there are likely to be a few more people besides this man, such as Ichimekasa and Eboshi, who are raining. That is no one but this man. ``

output There is no one but this fucking big man under the gate, which is as wide as a trillion. However, a thousand crickets are gathered in a large cricket column with a lot of crickets peeled off. As long as the fucking big Rashomon is messed up on the fucking big Suzaku Avenue, there are likely to be two thousand more people besides this fucking big man, the Ichimekasa and the fucking big eboshi hat that mess up the fucking rain .. That's no one but this fucking big guy. ``

Goodness

Try increasing your vocabulary for the time being

One of the charms of Koshideka Rashomon is the abundance of Koshideka lyrics. Roughly categorizing the shits, ** "things attached to nouns" ** (big / huge), ** "things attached to verbs" ** (like idiots / messed up) and ** "adjectives" There are three types: "things that stick to you" ** (super-fucking). "Things attached to adjectives" are sometimes attached to shit, so it's a little special position. I think it's possible to generate it mechanically, but it's annoying, so ** I generated it manually. ** **

My vocabulary has become poor because I did it properly ... Well, let's do it with this For the time being, I will make nouns and verbs fucking

python


def deco(text):
    nodes_s = t.parseToNode(text)
    output = ""
    count = 0
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        count += 1
        if count > 1:
            if nodes_s.prev.feature.split(",")[0] in ["Adnominal adjective"] or nodes_s.prev.feature.split(",")[1] in ["Case particles", "Kuten", "Comma", "Parallel particles"]:
                random.seed(nodes_s.prev.surface + nodes_s.surface + nodes_s.next.surface) #Seed decision by referring to the front and back
                if nodes_a[:2] in [["noun", "General"], ["noun", "固有noun"]]:
                    output += random.choice(["Big","Big","Geki","巨Big","There are as many elephants","Dangerous","big","No way","Awesome","The strongest in the world"])
                elif nodes_a[:2] in [["verb", "Independence"]]:
                    output += random.choice(["Mecha Mecha","Like an idiot", "seriously", "It feels bad"])
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

Oh, and I changed the order of the functions a little

python


print("\n output:\n" + makuring(deco(embod(incr(inp)))))

input The author just wrote," The servant was waiting for the rain. " However, even if the rain stops, the servant has no idea what to do. Normally, of course, I should be able to go back to my husband's house. However, the owner gave him free time 45 days ago. As I wrote before, the town of Kyoto was declining at that time. It is nothing but the small aftermath of this decline that this servant has been given time by his master, who has been used for many years. Therefore, it is more appropriate to say, "The servant who was swallowed up by the rain was at a loss because he had nowhere to go" rather than saying, "The servant was waiting for the rain." Besides, today's sky is not a little, the servant of this Heian dynasty

output The author just wrote," The servant was really waiting for the heavy rain. " However, even if the rain really stops, the big servant can't say anything about it. Normally, of course, I should be able to return to the awesome master's house like a fool. However, the dangerous master gave him a ridiculous amount of time four thousand days ago like a fool. As I wrote before, the town of Kyoto was declining without a thousand streets at that time. It is nothing but a mess in the tremendous aftermath of this small decline that this big servant has given up a ridiculous time like a fool from his master who has been messed up for many years. So, rather than saying, "The servant was really waiting for the heavy rain," he said, "The servant who was messed up in the rain had nowhere to go, and he was really at a loss in trillions. It's more appropriate to say, "I was crazy." Besides, today's sky is not a little, and this trillion unit of the giant Heian dynasty's servant

Hmmm Is it okay (is it okay?)

Not really

Rashomon basically changes "not" to "not serious". The word False, which cannot be strengthened any more, is made big from the viewpoint of "certainty", isn't it?

python


def deco(text):
    nodes_s = t.parseToNode(text)
    output = ""
    count = 0
    while nodes_s:
        nodes_a = nodes_s.feature.split(",")
        count += 1
        if count > 1:
            if nodes_s.prev.feature.split(",")[0] in ["Adnominal adjective"] or nodes_s.prev.feature.split(",")[1] in ["Case particles", "Kuten", "Comma", "Parallel particles"]:
                random.seed(nodes_s.prev.surface + nodes_s.surface) #Seed before(Since an error occurred, refer only to prev)
                if nodes_a[:2] in [["noun", "General"], ["noun", "固有noun"]]:
                    output += random.choice(["Big","Big","Geki","巨Big","There are as many elephants","Dangerous","big","No way","Awesome","The strongest in the world"])
                elif nodes_a[:2] in [["verb", "Independence"]]:
                    output += random.choice(["Mecha Mecha","Like an idiot", "seriously", "It feels bad"])
        if nodes_a[0] == "adjective" and nodes_a[6] == "Absent":
            output += "seriously"
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output

input `The author just wrote," The servant was waiting for the rain. " However, even if the rain stops, the servant has no idea what to do. Normally, of course, I should be able to go back to my husband's house. However, the owner gave him free time 45 days ago. As I wrote before, the town of Kyoto was declining at that time. It is nothing but the small aftermath of this decline that this servant has been given time by his master, who has been used for many years. Therefore, it is more appropriate to say, "The servant who was swallowed up by the rain was at a loss because he had nowhere to go" rather than saying, "The servant was waiting for the rain." What's more, today's sky was not a little influential on this Heian dynasty's servant Sentimentalisme. The rain that has begun to fall from the time of the monkey is still inexhaustible. So, the servant tried to manage tomorrow's life no matter what, so to speak, trying to do something that couldn't be helped, while following the rambling thoughts, the sound of the rain that shook Suzaku Avenue from a while ago. I was listening without hearing. ``

** Output ** (Since I played around with the seed, the random number generated earlier has changed) `The author just wrote unpleasantly," The servant was waiting for the terrible rain and darkness. " However, even if the rain stops like a fool, a terrible servant can't say anything special about it. Normally, of course, I should be able to seriously return to the house of the giant master. However, the fierce master gave me a tremendous amount of free time 45,000 days ago. As I wrote before, the town of Kyoto was declining without a thousand streets at that time. The fact that this world's strongest servant has been messed up with a tremendous amount of time from his master, who has been used like a fool for many years, is nothing but a mess in the ridiculous aftermath of this decline. So, rather than saying "the servant was waiting for the terrible rain and mess," he said, "The servant who was messed up in the rain was really messed up, not really where he was going. It is more appropriate to say that it was unpleasant. What's more, today's sky looks a lot and influenced this ridiculous Heian dynasty's servant Sentimentalisme. The rain that started to sprinkle seriously from the ridiculous carving of the monkey is still not serious. So, the terrible servant is trying to manage tomorrow's life for the time being, no matter what he feels uncomfortable-trying to do something that can't be helped, and he feels uncomfortable with the thoughts that aren't serious. While tracing around, I was listening to the sound of rain messing around on Big Suzaku Avenue from a while ago, even if I heard it like an idiot. ``

I don't understand, but ...

Making adjectives fucking

It's getting a little spicy so I want to finish it Create a ** obiv ** function to make adjectives fucking. For the swords, use the list I just posted, and ** double the function ** to add depth to the swords. (Let's set the fucking rate to about 50% so as not to be redundant)

python


def obiv(text):
    nodes_s = t.parseToNode(text)
    output = ""
    count = 0
    while nodes_s:
        count += 0
        nodes_a = nodes_s.feature.split(",")
        if nodes_a[0] == "adjective":
            random.seed(nodes_s.surface + str(count))
            if random.random() < 0.5:
                output += random.choice(["Super","Mecha Mecha","Like an idiot","seriously","Shit","Extremely","Gachi","Nasty","To the extent that it remains in human history"])
        output += nodes_s.surface
        nodes_s = nodes_s.next
    return output
print("\n output:\n" + obiv(obiv(makuring(deco(embod(incr(inp)))))))

input `The author just wrote," The servant was waiting for the rain. " However, even if the rain stops, the servant has no idea what to do. Normally, of course, I should be able to go back to my husband's house. However, the owner gave him free time 45 days ago. As I wrote before, the town of Kyoto was declining at that time. It is nothing but the small aftermath of this decline that this servant has been given time by his master, who has been used for many years. Therefore, it is more appropriate to say, "The servant who was swallowed up by the rain was at a loss because he had nowhere to go" rather than saying, "The servant was waiting for the rain." What's more, today's sky was not a little influential on this Heian dynasty's servant Sentimentalisme. The rain that has begun to fall from the time of the monkey is still inexhaustible. So, the servant tried to manage tomorrow's life no matter what, so to speak, trying to do something that couldn't be helped, while following the rambling thoughts, the sound of the rain that shook Suzaku Avenue from a while ago. I was listening without hearing. ``

output `The author just wrote unpleasantly," The servant was waiting for a terrible rain. " However, even if the rain stops like a fool, a terrible servant can't say anything special about it. Normally, of course, I should be able to seriously return to the house of the giant master. However, the fierce master gave me a tremendous amount of free time 45,000 days ago. As I wrote before, the town of Kyoto was declining without a thousand streets at that time. The fact that this world's strongest servant has been messed up with a tremendous amount of time from his master, who has been used like a fool for many years, is nothing but a mess in this ridiculous aftermath of the decline. So, rather than saying "the servant was waiting for the terrible rain and mess," he said, "The servant who was messed up in the rain was really messed up, not really where he was going. It is more appropriate to say that it was unpleasant. What's more, today's sky looks really serious and not a little, which influenced this ridiculous Heian dynasty's servant Sentimentalisme. The rain that started to sprinkle seriously from the ridiculous carving of the monkey is still not serious. So, the terrible servant is trying to manage tomorrow's life for the time being, no matter what he feels uncomfortable-trying to do something that can't be helped, and he feels uncomfortable with the thoughts that aren't serious. While tracing around, I was listening to the sound of rain messing around on Big Suzaku Avenue from a while ago, even if I heard it like an idiot. `` Is it okay to finish it, it's getting a little spicy

Impressions

I couldn't make it so accurate ... I think I could have done something a little more advanced with Cabocha, but it was a lot of trouble ... I'd like to try again if the installation succeeds someday. I wanted a "changing fucking idiom" (eg "at subsonic speed")

reference

https://web.archive.org/web/20171212152621/http://adsmedia.hatenablog.com/entry/2016/10/20/002211 https://qiita.com/pocket_kyoto/items/1e5d464b693a8b44eda5 https://qiita.com/matsuatsu/items/fc696741a994f011f91e

[^ 1]: There is a place where two "fucking deca" are like one set, but the meaning can be understood even with "deca Rashomon", and by adding "stupid" to it, you can also make "stupid Rashomon", so separate I thought it was done.

Recommended Posts

I wanted to generate a sentence like "Fucking Deca Rashomon" (past form)
I tried to generate a random character string
I tried to make a "fucking big literary converter"
I want to generate a UUID quickly (memorandum) ~ Python ~
I tried to automatically generate a password with Python3
[Failure] I wanted to generate sentences using Flair's TextRegressor
I wanted to modify Django's admin site a bit
I want to automatically generate a modern metal band name
I made a command to generate a table comment in Django
I wanted to do it like running an AtCoder test case.
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
I wanted to convert my face photo into a Yuyushiki style.
I wanted to do something like an Elixir pipe in Python
I wanted to solve the ABC164 A ~ D problem with Python
[Django] I wanted to test when POSTing a large file [TDD]