trinker / qdap

Quantitative Discourse Analysis Package: Bridging the gap between qualitative data and quantitative analysis
http://cran.us.r-project.org/web/packages/qdap/index.html
175 stars 44 forks source link

Polarity score calculation #135

Closed iokat closed 11 years ago

iokat commented 11 years ago

Hello, I am playing around with the polarity function.

"affordable" is a positive word.

So, polarity("affordable") returns 1.0 Since "not" is an negation word, polarity("not affordable") returns -0.5 (since there are two words in the sentence). However, I cannot understand why ("not not affordable") returns -0.333. There are three words, only one positive. From my understanding of the equation, it should be like: (1*(-1)^2)/3=1/3.

trinker commented 11 years ago

I'm guessing you're using the CRAN version of qdap. Considerable development has been done with qdap since that release. I am waiting for slidify to be uploaded to CRAN so I can upload the reports package (which relies on slidify) and then qdap (which relies on the reports package) and qdapDictionaries.

So with this improved (unbounded) algorithm this would be your results:

> polarity("affordable")

POLARITY BY GROUP
=================

  all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all               1           1            1          NA                 NA
> polarity("not affordable")

POLARITY BY GROUP
=================

  all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all               1           2         -0.5          NA                 NA
> polarity("not not affordable")

POLARITY BY GROUP
=================

  all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all               1           3        0.333          NA                 NA

Let me know if this addresses your problem.

iokat commented 11 years ago

Yes, indeed I was using the CRAN version of qdap. Finally I managed to install the developer version. To do this I also had to install the reports package (development version as well). Now the polarity function works as you describe above. Thanks for the response! This is a great package.

trinker commented 11 years ago

I'm going to close this as the original issue was addressed. I opened a related issue #136