That’s it. You’ve got the code, all you need is a girlfriend.

The net effect is to detect new tweets from a particular blogger and issue a warning if they are judged to be negative (mobile notifications, email notifications, automatic tweets like the one above, etc.).

Project Address:

Github.com/DIYgod/Weib… Negative tweets in the form of RSS feeds

Github.com/DIYgod/Text… Analyze the emotional value of a sentence

Usage:

Negative micro-blog RSS is used in conjunction with IFTTT. Specific Settings are shown in the figure below. If there is new content in THE RSS, the behavior is to send a micro-blog notification (it can also be changed to mobile phone notification or email notification, etc.).

 

Here’s how I developed it.

A, participles

It couldn’t do it by itself, so we looked for off-the-shelf solutions and found the following:

Stutter Chinese word segmentation

Hit Language Technology Platform cloud

Sina Cloud Chinese word segmentation

Iflytek language cloud

Tencent Wen Zhi

Except Tencent Wenzhi, all of them are free or open source. After a simple comparison, I chose Iflytek, which is also used by Hammer Big Bang.

Two, emotional analysis

The key lies in the dictionary, which is also available:

Chinese Emotional Polarity Dictionary NTUSD

Dalian Institute of Technology emotion Vocabulary ontology database

Dalian Institute of Technology’s ontology database has labeled more than 20,000 words, including information about their parts of speech, emotional categories, emotional intensity and polarity, like the following:

It looked good, so I chose this one.

Download the dictionary as an Excel spreadsheet, save it as a CSV format, and then import it into the mongodb database.

mongoimport -d emotion -c emo --type csv --headerline --file emotion.csvCopy the code

Three, emotional value calculation

The words to be analyzed are processed by word segmentation, and then the emotional value of each word is added up to get the emotional value of a microblog.

There’s actually a lot of algorithmic work to do here, but for simplicity, I’m just summing it up.

After writing, I found that the effect was very poor. The reason was that there were too few words in the dictionary, so many sentences could not be judged at all.

 

Finally abandoned all the above things, direct use of Tencent wenzhi fee service…

4. Apply it to Weibo

The principle of capturing microblog content is very simple. The microblog show of Sina Weibo can be accessed without login. You can get the microblog content directly by using node.js to parse the page.

Then calculate the emotional value of the micro-blog content and output the negative micro-blog into RSS.

Five, monitoring,

Output into RSS, monitoring is also easy, among which IFTTT effect is the best, when the detection of new content in RSS, can trigger mobile phone notification, email notification, send a micro blog and other behaviors.

 

Above, in fact, the biggest problem or: I lack a girlfriend.