Skip to content

leeshuheng/cnSentimentR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cnSentimentR

Analyse sentiment of Chinese text.

An R package.


devtools::install_github("leeshuheng/cnSentimentR")

## Example of file train_set.csv ====
## "sentiment","content"
## 1,你是个好人
## 0,你是个混蛋
## Example End ======================
train.set <- read.csv("./train_set.csv", header = T, sep = ",", stringsAsFactors = F)

train.set <- train.set[,c("sentiment", "content")]

library(cnSentimentR)

train.set <- cnsr.prepare(train.set)

fit <- cnsr.train(train.set)

# test.set <- read.csv("./test_set.csv", header = T, sep = ",", stringsAsFactors = F)

# test.set <- cnsr.prepare(test.set)

test.set <- train.set[sample(1:nrow(train.set), 100, replace = F),]

test.set <- cnsr.predict(fit, test.set)

cnsr.topic.word(test.set)
cnsr.topic.word(test.set, topicn = 5, topn = 15)

cnsr.keyword(test.set)
cnsr.keyword(test.set, topn = 20)

About

Analyse sentiment of Chinese text.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages