
That’s it, after the code is written, all that’s left is a girlfriend.
The final effect is to detect the new Weibo posted by a certain Weibo blogger, and if it is judged to be negative, it will issue a warning (mobile phone notification, email notification, automatically post a Weibo like the picture above, etc.).
Project address
https://github.com/DIYgod/Weibo2RSS Weibo that outputs negative emotions in the form of RSS
https://github.com/DIYgod/Text2Emotion Analyze the emotional value of a sentence
How to use
Negative emotion Weibo RSS is used in conjunction with IFTTT. The specific settings are as shown below. The condition is that new content appears in RSS and the behavior is to send a Weibo notification (it can also be changed to a mobile notification or email notification, etc.).

Development process
Below is my development process.
1. Participles
I couldn’t do this myself, so I had to look for ready-made solutions, and found the following:
Stuttering Chinese word segmentation
Harbin Institute of Technology Language Technology Platform Cloud
Sina Cloud Chinese Segmentation
Except for Tencent Wenzhi, all others are free or open source. After a simple comparison, I chose iFlytek, which is also used by Smartisan Big Bang.
2. Sentiment Analysis
The key lies in the dictionary, which can also be found ready-made:
Chinese Emotional Polarity Dictionary NTUSD
[Dalian University of Technology Emotional Vocabulary Ontology Library](http://Dalian University of Technology Emotional Vocabulary Ontology Library)
The ontology library of Dalian University of Technology has annotated more than 20,000 words, including information such as part-of-speech types, emotional categories, emotional intensity and polarity of these words, as follows:

It looked good, so I chose this one.
The dictionary is downloaded as an excel table. Save it in csv format and then import it into the mongodb database.
mongoimport -d emotion -c emo --type csv --headerline --file emotion.csv
3. Emotion value calculation
By segmenting the words to be analyzed and adding up the emotional value of each word, you can get the emotional value of a Weibo post.
There is actually a lot of algorithmic work that can be done here, but for simplicity, I just added up.
Then after writing it, I found that the effect was very poor. The reason was that the dictionary contained too little content and many words were missing, so many sentences could not be judged at all.
Finally, I discarded all the above and directly used Tencent Wenzhi’s paid services…
4. Apply to Weibo
The principle of grabbing Weibo content is very simple. Sina Weibo’s [Weibo Show] (http://service.weibo.com/widget/widget_blog.php?uid=3306934123) can be accessed without logging in. You can directly use Node.js to parse the page to get the Weibo content.
Then calculate the sentiment value of the Weibo content and output the negative sentiment Weibo into RSS.
5. Monitoring
Outputting it as RSS makes monitoring easier. Among them, IFTTT has the best effect. When new content in RSS is detected, it can trigger mobile phone notifications, email notifications, and post a Weibo.
Above all, the biggest problem is actually: I don’t have a girlfriend.