Comments (6)
Please provide a reproducible example.
from sentimentr.
Hi,
require(sentimentr)
require(qdap)
Texts
mytext <- c(
"hopefully wallet will comeback",
"excelente",
"duplicate photo finder",
"Thanks Staff!",
"limit your sentence"
)
Polarity table
set.seed(10)
key <- data.frame(
words = c("excelente","limit","duplicate photo finder","wallet will comeback","thanks"),
polarity = c(1,-1,-1,-1,1),
stringsAsFactors = FALSE
)
mykey <- as_key(key)
striptext=function(x){
x=removePunctuation(stripWhitespace(tolower(x))) }
text=as.character(striptext(mytext))
text=replace_number(text)
text=replace_emoticon(text,emoticon_dt = sentimentr::emoticons)
text=replace_grade(text, grade_dt = sentimentr::grades)
Sentimentr polarity
Sentir=sentiment_by(text,mykey,valence_shifters_dt = valence_shifters_table,by=NULL,
amplifier.weight = 3, n.before = 5, n.after = 3
,question.weight = 2, but.weight = 0.85, missing_value = 0)
Qdap Polarity
QDAPoutput=counts(polarity(striptext(mytext),polarity.frame = mykey,
constrain = F,negators = qdapDictionaries::negation.words,
amplifiers = qdapDictionaries::amplification.words,
deamplifiers = qdapDictionaries::deamplification.words,
question.weight = 3, amplifier.weight = 2,
n.before = 5, n.after = 3))[, "polarity"]
Final output
outp=cbind(Sentir,QDAPoutput)
from sentimentr.
If u check the final output "outp", Sentimentr is not scoring but Qdap does.
from sentimentr.
I believe you need to name the argument to sentiment_by
as the second argument to this function is not the polarity table as you assume, polarity_dt =mykey
from sentimentr.
Hi .. i changed it to Sentiment . its working .. Thanks..
But it shows this warning :
Warning message:
In [.data.table
(dat[, :=
(indx, wc < 1), by = c("id", "sentences", :
with=FALSE ignored, it isn't needed when using :=. See ?':=' for examples.
from sentimentr.
You need the latest version from github. A change in data.table. If you don't feel like updating the warning message can be ignored.
from sentimentr.
Related Issues (20)
- Any hint why the two emoji approaches are different and in what circumstance which one is better?! HOT 1
- Amplifiers
- polarity_dt requires words with spaces to work HOT 1
- Sentimentr split words when there is an accented character HOT 5
- Totally different results in Qdap polarity and sentiment r HOT 4
- Changing polarity of words in the dictionary HOT 2
- Question about 'highlight' HOT 1
- how to calculate sum of sentiment? HOT 1
- Question about how the dictionary was built HOT 1
- .mygsub is slow HOT 8
- Transparency for lexicon::hash_sentiment_jockers_rinker HOT 1
- What is the theoretical range for the "sentiment" variable? HOT 1
- I wonder why this sentence is recognized as positive HOT 2
- Polarity categorization? HOT 1
- relabel "black" and "white" as neutral sentiments (black is currently negative; white is labeled positive)
- Overall positive and negative scores given a piece of text
- Positive and Negative Sentiment based on German Language text HOT 1
- how to get pos, neg, neu other than ave_sentiment ?
- plot.sentiment_by ordered fix?
- N-CSR SIC code error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentimentr.