I tried to judge Tsundere with Naive Bayes

Introduction

This is a demo.

input=>Hey what! ?? I'm surprised ...
category: tsundere

input=>I love you I love you so much.
category: not_tsundere

input=>...... Don't touch it casually, stupid.
category: tsundere

input=>person love! I like humans! I love you!
category: not_tsundere

Good ...

What i did

In the case of normal spam judgment

It trains the computer to learn spam and non-spam text, respectively, to determine if the newly entered text is spam. spam.png ...boring

In the case of tsundere judgment

Trains the computer to learn tsundere text and non-tsundere text, respectively, to determine if the newly entered text is tsundere. tsundere.png

pleasant! !!

Data preparation

Of course, learning data is required for learning. I have to somehow prepare a text full of tsundere. This time I used twitter to collect the data. We get tweets from accounts like "Tsundere bot" and use them as learning data.

code

The code can be found on GitHub. See the README for details on how to use it. I used the code of Naive Bayes from katryo's article.

It requires python-twitter (which can be installed with pip) to work. You also need to issue the key for the twitter application and the yahoo morphological analysis application ID. You can get each below.

https://dev.twitter.com/ https://e.developer.yahoo.co.jp/register

Please select "Client Side" when issuing the Yahoo application ID. Paste each issued ID into settings.cfg and enter the appropriate accounts `true_accounts``` and ` You can use it by setting it to false_accounts```.

Since 200 tweets are acquired for each account and learned, the more accounts you specify, the longer it will take to learn. Determine the number of accounts to specify appropriately by looking at the trade-off between time and accuracy.

Finally

You can make your own learning device by learning different data. In addition to the tsundere judgment, it may be interesting to try the yandere judgment and the handsome judgment.

Recommended Posts

I tried to judge Tsundere with Naive Bayes
I tried to classify Mr. Habu and Mr. Habu with natural language processing × naive Bayes classifier
I tried to implement Autoencoder with TensorFlow
I tried to visualize AutoEncoder with TensorFlow
I tried to get started with Hy
I tried to implement CVAE with PyTorch
I tried to solve TSP with QAOA
I tried to predict next year with AI
I tried to detect Mario with pytorch + yolov3
I tried to implement reading Dataset with PyTorch
I tried to use lightGBM, xgboost with Boruta
I tried to learn logical operations with TF Learn
I tried to move GAN (mnist) with keras
I tried to save the data with discord
I tried to detect motion quickly with OpenCV
I tried to integrate with Keras in TFv1.1
I tried to get CloudWatch data with Python
I tried to output LLVM IR with Python
I tried to debug.
I tried to detect an object with M2Det!
I tried to automate sushi making with python
I tried to predict Titanic survival with PyCaret
I tried to paste
I tried to operate Linux with Discord Bot
I tried to start Jupyter with Amazon lightsail
I tried to move machine learning (ObjectDetection) with TouchDesigner
I tried to extract features with SIFT of OpenCV
I tried to move Faster R-CNN quickly with pytorch
I tried to read and save automatically with VOICEROID2 2
I tried to implement and learn DCGAN with PyTorch
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
I tried to automatically read and save with VOICEROID2
I tried to get started with blender python script_Part 02
I tried to generate ObjectId (primary key) with pymongo
I tried to implement an artificial perceptron with python
I tried to build ML Pipeline with Cloud Composer
I tried to uncover our darkness with Chatwork API
I tried to automatically generate a password with Python3
[Introduction to Pytorch] I tried categorizing Cifar10 with VGG16 ♬
I tried to solve the problem with Python Vol.1
I tried to analyze J League data with Python
I tried to implement Grad-CAM with keras and tensorflow
I tried to make an OCR application with PySimpleGUI
I tried to implement SSD with PyTorch now (Dataset)
I tried to interpolate Mask R-CNN with Optical Flow
I tried to step through Bayesian optimization. (With examples)
I tried to find an alternating series with tensorflow
[Introduction to AWS] I tried playing with voice-text conversion ♪
I tried to solve AOJ's number theory with Python
I tried fp-growth with python
I tried scraping with Python
I tried Learning-to-Rank with Elasticsearch!
I tried to organize SVM.
I tried clustering with PyCaret
I tried to implement PCANet
I tried to reintroduce Linux
I tried to introduce Pylint