Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lixy529/sentiment
情感分析
https://github.com/lixy529/sentiment
Last synced: 27 days ago
JSON representation
情感分析
- Host: GitHub
- URL: https://github.com/lixy529/sentiment
- Owner: lixy529
- Created: 2018-04-02T13:22:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-28T03:24:44.000Z (over 6 years ago)
- Last Synced: 2024-05-22T15:31:47.822Z (7 months ago)
- Language: Go
- Size: 3.98 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-go-quant - sentiment - 情感分析, 这个公司要倒闭 (Golang / Sentiment Intensity Analyzer)
README
sentiment
======一个golang的编写的情感分析小程序,以学习为目的,仅供大家学习。
首先通过train进行训练,然后通过训练的结果进行对文本的是正负面概率的判断
install
-------go get https://github.com/lixy529/sentiment
示例
-------
```
dictPath := "./dict"
mSentiment := NewSentiment(dictPath)
// 初始化
err := mSentiment.Init()
if err != nil {
t.Errorf("init err: %s", err.Error())
return
}text := "这个公司要倒闭"
sentiType, scores := mSentiment.CalcSemti(text)
if sentiType == S_NEGATIVE {
fmt.Println("===>负面<===")
} else if sentiType == S_POSITIVE {
fmt.Println("===>正面<===")
} else {
fmt.Println("===>中立<===")
}// 反初始化
mSentiment.UnInit()
```