Simple sentiment analysis using regular expression: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 47: Line 47:


== 輸入文字範例3 ==
== 輸入文字範例3 ==
「不」、「愉快」相隔幾字
<pre>
<pre>
與 pokeman 的冒險,會有不少的爭執、不愉快
與 pokeman 的冒險,會有不少的爭執、不愉快
Line 59: Line 61:
# 正面情緒 (positive sentiment)  
# 正面情緒 (positive sentiment)  
#* 方式: 搜尋包含「愉快」但是前面不包含「不」或「沒」字  
#* 方式: 搜尋包含「愉快」但是前面不包含「不」或「沒」字  
#* 搜尋: 搜尋: {{kbd | key =<nowiki>^((?![不|沒]).)+(愉快)</nowiki>}} ([https://regex101.com/r/ABzfEj/1 線上測試])
#* 搜尋: 搜尋: {{kbd | key =<nowiki>^((?![不|沒]).)+(愉快)</nowiki>}} 或 {{kbd | key =<nowiki>^([^不|沒])+(愉快)</nowiki>}} ([https://regex101.com/r/ABzfEj/1 線上測試])
# 負面情緒 (negative sentiment)
# 負面情緒 (negative sentiment)
#* 方式: 搜尋包含「愉快」但是前面包含「不」或「沒」字  
#* 方式: 搜尋包含「愉快」但是前面包含「不」或「沒」字  
Line 77: Line 79:
* 以標點符號當作斷點  
* 以標點符號當作斷點  


延伸閱讀
== 延伸閱讀 ==
* [https://en.wikipedia.org/wiki/Sentiment_analysis Sentiment analysis - Wikipedia]
* [https://en.wikipedia.org/wiki/Emotion_classification Emotion classification - Wikipedia]
* [http://www.rexegg.com/regex-lookarounds.html Lookahead and Lookbehind Tutorial—Tips &Tricks]
* [http://www.rexegg.com/regex-lookarounds.html Lookahead and Lookbehind Tutorial—Tips &Tricks]
* [http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis Sentiment Analysis | AlchemyAPI]
* [http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis Sentiment Analysis | AlchemyAPI]


[[Category:Regular expression]] [[Category:Software]] [[Category:Programming]] [[Category:Data Science]] [[Category:Search]] [[Category:String manipulation]]
[[Category:Regular expression]] [[Category:Software]] [[Category:Programming]] [[Category:Data Science]] [[Category:Search]] [[Category:String manipulation]]
Anonymous user

Navigation menu