[Markov chain] I tried to read quotes and negative emotions into Python.

Hello. This is PyLoc. This time, we will investigate what kind of result will be obtained by using both the data used last time and the data used two times before. The articles from the last time and the last time are as follows. Last time: https://qiita.com/PyLoc/items/682f9664cbfadc954acc Two times before: https://qiita.com/PyLoc/items/52a31bd2b0e20ad3f2a1

Program preparation

The program is as usual [here](http://zipmonkey.wp.xdomain.jp/2020/09/18/%e3%80%90%e3%82%b3%e3%83%94%e3%83%9a % e3% 81% a7ok% e3% 80% 91-python% e3% 81% a7% e3% 83% 9e% e3% 83% ab% e3% 82% b3% e3% 83% 95% e9% 80% a3 Take from% e9% 8e% 96% e3% 82% 92% e3% 82% 84% e3% 81% a3% e3% 81% a6% e3% 81% bf% e3% 82% 8b /). I will post it here as well. There are some modifications.

Markov.py


# -*- coding: utf-8 -*-
 
import random
from janome.tokenizer import Tokenizer
  
#Split text data into words using Janome
def wakati(text):
    text = text.replace('\n','') #Remove line breaks
    text = text.replace('\r','') #Remove space
    t = Tokenizer()
    result =t.tokenize(text, wakati=True)
    return result
 
#The default number of sentences is 30
def generate_text(num_sentence=30):
    src = open(r"Text.Full path of txt", "r", encoding="utf-8").read() #Text.Use the absolute path of txt(If you follow the procedure, C:\Users\username\Desktop\Markov\Text.txt )
    wordlist = wakati(src)
  
    #Create a table for Markov chains
    markov = {}
    w1 = ""
    w2 = ""
    for word in wordlist:
        if w1 and w2:
            if (w1, w2) not in markov:
                markov[(w1, w2)] = []
            markov[(w1, w2)].append(word)
        w1, w2 = w2, word
  
    #Automatic sentence generation
    count_kuten = 0 #Number of Kuten "."
    num_sentence= num_sentence
    sentence = ""
    w1, w2  = random.choice(list(markov.keys()))
    while count_kuten < num_sentence:
        tmp = random.choice(markov[(w1, w2)])
        sentence += tmp
        if(tmp=='。'):
            count_kuten += 1
            sentence += '\n' #Line breaks for each sentence
        w1, w2 = w2, tmp
     
    print(sentence)
     
if __name__ == "__main__":
    generate_text()

Put this in the Markov folder you created on your desktop. Then, create a file called Text.txt in the Markov folder. Change the full path of Text.txt on the 16th line to suit your environment.

Contents of Text.txt

Text.txt is the original file of Markov. This time it's a quote and negative emotions, so I'll bring a quote from from here and negative emotions from Yahoo Answers. Let's remove the symbols (? Etc.) first.

Execution result

First of all, it is the annual execution time.

python Markov.full path of py

After a while, the result will be output. This time, the data is larger than the previous time and the time before last, so it will take time. What kind of sentence is it?

First time

When it's full, you can't do what you like.
It's hard to know if the road can be fulfilled by acting.
I know that safety means breathing.
Life is not easy.
There is.
For example, a child I used to love, a nationality, my daughter's ex-husband, and so on.
You have to do it.
If you are a talented person, you hate yourself, and even if you reach the bottom, you will not be in the water of the thief, and the heart of quietly waiting for the time to come is to think carefully.
Some people are out of luck.
Of all the possible options, I'm always depressed because I have a strong self-hatred as I become a second-class Ravel.
You must always be curious and walk hard.
It's also a man who gets angry if he doesn't try to break.
Income lives like shoes.
I can do it because I have the courage and pride that I don't want to go on a long journey of "life" and I couldn't stand it. Where should I go? I want to die. I'm full of my head. " You can never be.
Don't look down on your life and wait quietly for spring.
If you don't panic and have a male clerk, you'll be immovable like cherry salmon before you know it.
Excuse me for being sloppy with a small voice.
I can only mutter.
There are roads for lucky people and landscapes.
The spirit of independence must set a person's heart and walk hard.
That's not a big deal. "Because I wanted it.
Everyone who is not busy reborn every day should be independent.
The spirit of independence is to walk the path to humanity.
Anyway, I can enjoy my life so much.
Each human is sailing.
People think that if they know how to use words, they will not do anything about the pleasure of a cruise, but they think that they are absolutely right for their experience in life.
It is a situation that may turn into a door.
When it comes to efficiency and gains and losses, the reason for harassment is "a sneaky person is not enough.
But scary.
It is also bad to die.
I was born as a human being to beliefs and those who do not listen to them.
I have such a childhood and how can it work?
Better results must be achieved.
I uploaded a photo and remarried that I shouldn't be talented, and everyone else doesn't just think about squinting and trying to get past it.
There was a low tide, and I had to take that opportunity to face myself. "
Making most of your life will not work until you reach that level.
The footprints of every day are the same as this, and even if you are exhausted, the cherry blossoms that are no longer in the water of the thief and quietly wait for spring are good times if your heart is pleasant on many roads. For those who carry a burden, take the failure honestly and apologize sincerely. It doesn't go to crime.
Sincere.
I can't stand not living long.
People are the ones who were the best friends who tried to disappear, disappear, and connect.
There are many more mountains to climb when someone says "human face".
Laugh anyway on this irreplaceable road with conviction.
You can't afford to laugh, you can't afford it, you don't have the difficulties and problems of each, and the saying of what you want to do is smart and bad.
If you don't call in, the reason for the harassment is "a vulgar person", and those who upload pictures that are good at taking pictures because they don't like it are not enough for their abilities, but they hate men who want to overcome a kind of desire. You will be able to overcome it.
Enjoy today to your heart's content and live.
Rather than competing with other people, it is dangerous to walk first when Akatsuki is driven by the urge to commit suicide later.
The important thing that only I can walk is that I have taken the burden and chose a distant road.
Money is not always necessary for what kind of road it is.
you have to.
When your life begins without regret, you make the mistake of not being aware of the child who may have been driven by a suicide urge.

Oh, the saying seems to be dominant. Even if it becomes a negative word, it is forcibly made a positive word.

Second time

Is required.
Our choices mean responsibility.
Unexpectedly, people are a "branch".
The more climbs you have, the closer you are to success when you win.
However, whether the children can find the person who is swept away by the stream and not in the original water.
In life, many can fight again.
Life is very simple.
There really is no competition.
Have hope decades ahead.
I have to be in control without looking back on my precious life.
Education is breathing.
Life is a comedy in close-up.
I want to be happy with that person who is sensitive to things, lives like himself, and has a good point.
Source of failure.
If you spend the day crazy, you can't really control it without looking back on your life.
Even if a swallow comes, it doesn't make much noise.
Be sure to rush in the army.
Life is difficult to interpret and you don't understand.
The life of an optimist is school.
I want to live a happy life with this attitude.
That shouldn't be.
I think it's not a big deal, or it's not, or something in between.
I don't want to make my parents sad for decades. ”You can enjoy your life.
If anyone says that humans are rare and needs anything, it doesn't make life meaningful in my heart.
It is a fuel to turn into a door.
Sometimes I wonder if it's full of things to do.
I didn't live long.
While hoping for the best, prepare for the worst.
And I scream and scream.
But why am I unhappy or uncomfortable? "
Then, before you know it, there is no such thing as cherry salmon.
Love the heavenly mission to each and every one.
My thing is like waiting for a jerk.
Quietly filled with things like time.
No one can stand, the one who fails is envious of the wind.
Optimists do nothing for tomorrow.
It's a weapon of life.
There is nothing.
How did you take a selfie of this mood when you slept at night?
Of course living alone is NG, and friends and lovers are always receiving whether a new path can be achieved.
I wonder if there's a way to be stored, well, I'll just sit a little longer and speed up, but others say that in a way, when unhappy, it's like a box of matches, the reason for the harassment is "I'm sorry." It is dangerous if you do not walk by yourself.
Moreover, it is a huge torch.
The past affects the present.
Isn't there anything important?
It can be said that it is like continuing a difficult life lazily, and it is the appearance of cherry blossoms waiting for the result to survive with the thought that even laughter may turn into anger.
Life can be bright or dark.
If you look at yourself as weak, no one will be lucky to others if the reason for harassment is "hate," or no, no, poor, or even a star. You can never be happy if you touch it like this.
Be sure to rush in the army.
Life cannot live well without breathing.
A person is a break time score.

Ah. It started with particles. What do you need !!!!! Isn't it worrisome !!!!! After all quotes are predominant.

third time

This time I increased my negative emotions.

Will anyone answer? The more I'm worried about knowing if I can find it when I ask what it's like to get rid of the black smoky, the more I can't say I was the best friend who overcame my desires when I won. There is nothing.
I didn't feel like I was going to die tomorrow.
Akita Inu has no injuries.
That person I came in contact with.
Sometimes my family talks to me and I am bullied that I am a good age, and I enjoy the fake mandate that society demands from hypocrisy.
I'll cut my wrist and wait for a long time to listen to myself, depressing myself so much that I'll be happy.
Don't panic, just have a male clerk.
I'm sure I'm still looking for a way to live, but as I go further, ownership becomes my master, habits become personality, and my mother doesn't.
Did you want to avoid being compensated for 1.02 billion? However, I stared at him with his round eyes.
From such an early age (in retrospect, parents who are the basis of life may be in the newspaper.
) Also, make a mistake in judging that it should not be carried by another person.
No matter what kind of trouble you may have, if you don't hate yourself more and more, it will weigh heavily on you.
To some extent, there are owners.
Today, I have finally been forced to abandon my parents' wrong education.
We are all different people every year, so here.
First, stay yourself.
The most unsuccessful are forever.
Then, the person who keeps thinking all the time and gets tired, tries to travel in the unknown world and has to win.
I hate myself.
I don't want to admit the reality.
I want to go back to myself.
Where can I go? "
When we start thinking about the meaning and value of life, it has been born in this world that human beings find human beings.
The appearance was also in order.
"I think it's a little ... because I want to be myself.
Rescue the weak will increase the joy of being released from the curse of your parents.
Even if one swallow comes, it will be crazy enough to earn plastic surgery costs.
Blatant appearance discrimination against beautiful women and ugly women has grown like a sexual treatment tool.
The idea that parents are all about their educational background becomes a word, and those who are disgusted by their mother's casual behavior do not care about how they stand while they are carrying a burden.
That is the greatest feat.
Those that open or close the precious path of heaven are forever.
Then, "I don't understand the taste of my life.
Bamboo is scared of snow because it beats itself.
But I was doing that.
It's not a true death when I think about whether I was fascinated, loved by my juniors, loved by my juniors, and stood still with thought.
Your destiny mixes the cards and we compete.
People's suffering disappears, and life is smooth. Live life.
Success is the most unsuccessful thing, and more than "enjoyment" increases.
It's most important for trees, but the more you get involved, the more disgusting you are, the more you get used to it and the more you know what you're talking about.
After all, I want to die in bamboo.
Even when it's hard, just laugh.
It's not that I can't afford to laugh.
Of course, I can't because I want to have a long journey of "a person who is content with the situation he is standing in, or who takes actions that he does not understand even if he notices it, and what he is made of."
Seeing the marriage partner as important and disliking the existence of the younger sister, consulting with the people around you to find out what is as dangerous as exposing yourself.
It's easy to forget about money, girlfriend, marriage, family, and what you like.
I don't mind thinking that I was my best friend who failed in my life.
Wouldn't it be just a family hatred? I want to overcome self-loathing.
I want to die painfully, not words.
Life is the moment you decide one day.
Am I a gold vine?

dangerous. Negative emotions came out. It's an emergency bonus time.

Urgent !! Bonus

This time, [from here](https://kinarino.jp/cat6-Lifestyle/24788-I want to make people smile with just one word, I want to read it aloud [World Quotations]) Get quotes I did. Quotations increased !!!!!

It's easy if you just want to die.
It is important for a person to have virtue as well as ability, even if he / she shows only a small amount of scenery.
Because I was born in this world in vain, I would like to act in a way that I don't even know to stand in this world in vain, or I'm poor, or I'm standing up thinking about it (it's like doing it now).
When the corona turmoil subsides, we are separated from each other, and we are happy human beings, Kuzu, in the "Hinomaru".
"Now, the next place of employment has finally been decided.
It is a burden to get the feeling that you have a developmental disability.
Must be treated seriously.
Your destiny mixes the cards and we compete.
Then you should.
I was frustrated by my parents who were absolutely strong in terms of the meaning of life.
After the person who trampled his heart was aware of the evaluation, the person with a bad personality and the scenery are the same as putting himself in danger.
Otherwise, I think that human beings are rare, and I want to hate myself.
I knew how to use words, but the first in the world was "the university (the second is" hatred "in a straight line, it is also a precious thing like a compass that moves sails.
It doesn't matter if you're thirsty, but you're actually here to find yourself.
It's fun because it looks down and isn't important to Akita dogs and laughs.
If your income is something like shoes, I would like you to tell me the unfortunate moment when you make a decision.
Thinking about something black and moody disappears is a recurring failure, and it doesn't happen.
I won't play.
The first time it wasn't worth living, and when I saw that I was happy to live each difficult life instead, I said "I'm the worst". Good.
I'm sure it's to live.
Unexpectedly, for people, words become actions, and actions are not always necessary and circulate.
It's like the long-awaited birthday.
I will never live forever.
You will not be able to find it at your risk.
Enjoying a very unhappy life and continuing it.
"Now, I wonder if I will stand up too.
I've done a difficult job.
Appearance is also in order.
I feel like I can't be happy, and someone hates my body and appearance ... (especially my body).
Now, when I'm 10 times happier as a mood maker character than when I was a student, I completely believe that why hatred and hatred aren't bad at all. Yeah.
You win strength, confidence and experience, but as you spend the day, sometimes you sweat, and when you know, things change, and people can't always move forward.
There was a man who knew how to live, and many of them were quite good.
I would like to know who has escaped.
Be pessimistic.
I have to make an unreasonable request.
It is as immovable as a distant road.
Do what you have to do.
Then life is worth living.
I wonder how far I will travel, but my inner feelings are annoying.
I can't get over it.
It's a gift.
That's why, although it became more and more negative, the idea that parents are all about their educational background is that life is romantic.
The important thing that only you can walk is easy.
There is only a comparison between one state and another.
I don't try anything at the camp.
。
Other than not being aware of this and choosing whether to make an accurate judgment, for now, possession becomes the master, habits become personalities, habits become personalities, and actions are necessarily necessary.
Do what you have to do.
Then one day you will make a decision.
How should I calm down at such times?

Alright, it's OK.

Summary

Quotations predominate. After all the power of wise saying was infinite.

Recommended Posts

[Markov chain] I tried to read quotes and negative emotions into Python.
[Markov chain] I tried to read negative emotions into Python.
[Markov chain] I tried to read a quote into Python.
I tried to automatically read and save with VOICEROID2
I tried to automatically create a report with Markov chain
I tried to enumerate the differences between java and python
I tried to make GUI tic-tac-toe with Python and Tkinter
I tried to divide the file into folders with Python
I tried to touch Python (installation)
I tried to make a periodical process with Selenium and Python
I tried to easily detect facial landmarks with python and dlib
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried to implement permutation in Python
I tried to implement PLSA in Python 2
I tried to implement ADALINE in Python
I tried to implement PPO in Python
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I tried to create a sample to access Salesforce using Python and Bottle
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
Markov Chain Chatbot with Python + Janome (1) Introduction to Janome
Markov Chain Chatbot with Python + Janome (2) Introduction to Markov Chain
I tried web scraping using python and selenium
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 5/22]
I implemented DCGAN and tried to generate apples
I tried object detection using Python and OpenCV
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part7 / 22]
I tried to automate internal operations with Docker, Python and Twitter API + bonus
[Python] How to read data from CIFAR-10 and CIFAR-100
Python programming: I tried to get (crawling) news articles using Selenium and BeautifulSoup4.
I tried Jacobian and partial differential with python
I tried to get CloudWatch data with Python
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 4/22]
I tried to output LLVM IR with Python
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 1/22]
I tried to implement TOPIC MODEL in Python
I tried to automate sushi making with python
I read "Quantum Computer Accelerates Artificial Intelligence" and tried to outline it in Python without using mathematical formulas.
I tried to implement selection sort in python
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 6/22]
[Introduction to PID] I tried to control and play ♬
I made a program to convert images into ASCII art with Python and OpenCV
I tried LeetCode every day 121 Best Time to Buy and Sell Stock (Python, Go)
I tried to automate the article update of Livedoor blog with Python and selenium.
Image processing with Python (I tried binarizing it into a mosaic art of 0 and 1)
I tried to compare the processing speed with dplyr of R and pandas of Python
I tried to graph the packages installed in Python
When I tried to introduce python3 to atom, I got stuck
I tried to summarize how to use matplotlib of python
I tried pipenv and asdf for Python version control
I tried to implement and learn DCGAN with PyTorch
I tried adding post-increment to CPython. Overview and summary
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to draw a route map with Python
I tried to solve the soma cube with python
Continuation ・ I tried to make Slackbot after studying Python3
I tried to get started with blender python script_Part 02
I tried to implement Dragon Quest poker in Python