Twitter sentiment analysis using Python and NLTK
laurentluce.com
laurentluce.com
>>> from pattern.en import sentiment
>>> print sentiment(
>>> "The movie attempts to be surreal by incorporating various time paradoxes,"
>>> "but it's presented in such a ridiculous way it's seriously boring.")
(-0.34, 1.0)You can grab our sample set here: https://github.com/downloads/Tawlk/synt/sample_data.bz2
And check out the project here: http://github.com/Tawlk/synt
It also ships with a full CLI interface if you just want to play with it without getting knee deep into the code.
Also if you want to to see a stripped down stand-alone code sample that steps you through the process I made this gist:
https://gist.github.com/1266556
Enjoy :)
Good encouragement for me to better document synt.
Think of it like leveler tool used in construction. Nothing is ever _perfectly_ level. It is either tilting one way or the other, but there is an acceptable range people will generally call 'level'. Neutral is the same.
If the classifier rates something something as 0.001 then that is probably safe to call it 'neutral'. It would be up to the application to decide on a 'neutral range'. You could for instance just flag anything between -0.2..0.2 as 'neutral'. It is good to define functions like these last so you can adjust the range manually until you have reduced false positives to a minimum with your particular data set.