Description Usage Arguments Value Author(s) References See Also Examples
Preprocess text.
1 | cnsr.prepare(data, seg = NULL)
|
data |
A data.frame. It must contain a column 'content' that is chinese context. |
seg |
A segment word machine. If it is 'NULL', the function use 'jiebaR' |
Return a data.frame.
Shao Dan Lee [aut, cre]
URL: https://github.com/leeshuheng/cnSentimentR
cnsr.predict,cnsr.train,cnsr.topic.word,cnsr.keyword
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | devtools::install_github("leeshuheng/cnSentimentR")
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.keyword(test.set)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.