background preloader

Twitter sentiment analysis using Python and NLTK

Twitter sentiment analysis using Python and NLTK
This post describes the implementation of sentiment analysis of tweets using Python and the natural language toolkit NLTK. The post also describes the internals of NLTK related to this implementation. Background The purpose of the implementation is to be able to automatically classify a tweet as a positive or negative tweet sentiment wise. The classifier needs to be trained and to do that, we need a list of manually classified tweets. Positive tweets: I love this car.This view is amazing.I feel great this morning.I am so excited about the concert.He is my best friend. Negative tweets: I do not like this car.This view is horrible.I feel tired this morning.I am not looking forward to the concert.He is my enemy. In the full implementation, I use about 600 positive tweets and 600 negative tweets to train the classifier. Next is a test set so we can assess the exactitude of the trained classifier. Test tweets: Implementation The following list contains the positive tweets: Classifier Classify Voilà.

The Python “with” Statement by Example Python’s with statement was first introduced five years ago, in Python 2.5. It’s handy when you have two related operations which you’d like to execute as a pair, with a block of code in between. The classic example is opening a file, manipulating the file, then closing it: with open('output.txt', 'w') as f: f.write('Hi there!') The above with statement will automatically close the file after the nested block of code. Here’s another example. This code sample uses a Context object (“cairo context”) to draw six rectangles, each with a different rotation. cr.translate(68, 68) for i in xrange(6): cr.save() cr.rotate(2 * math.pi * i / 6) cr.rectangle(-25, -60, 50, 40) cr.stroke() cr.restore() That’s a fairly simple example, but for larger scripts, it can become cumbersome to keep track of which save goes with which restore, and to keep them correctly matched. By themselves, pycairo’s save and restore methods do not support the with statement, so we’ll have to add the support on our own.

20 Tools & Converters for HTML to RSS Conversions Do you have a static HTML website, but you want to either turn this content into an RSS Feed or add an RSS feed to your web site? Then this is the list that will make you very happy. This is the ultimate list of free tools to turn any static web page into an XML RSS feed. These tools are very useful to both web savvy users as well as the non-geek user who has no idea how to read or use HTML. So look below and find the best HTML to RSS feed conversion too to take virtually any web page and convert it into a fully formed and fully coded RSS feed. Please let us know about any HTML to RSS conversion tools that we may have missed. The RSS Wizard This is a program that will allow you to generate an RSS 2.0 feed from any type of HTML document. DapperDapper allows anyone to create Dapps that track the content of any website. Feed43Your favorite site doesn’t provide news feeds? FeedityCreate RSS for ANY web page! Feed Fire RSS Builder

13 cours en ligne gratuits sur l’Open Data Belle initiative du Portail européen des données qui propose depuis mars 2016, une série de 13 cours en ligne d’autoformation sur l’Open Data (données ouvertes) : Programme e-learning du Portail Européen des Données, une séquence de formation ouverte et à distance (FOAD) lancée dans le cadre de l’Open Data Day le 5 mars 2016. Ces 13 modules en ligne en accès libre permettent d’appréhender les différentes facettes de l’Open Data via des textes informatifs, des infographies, des vidéos, des images et des QCM récapitulatifs. Les différents cours peuvent être suivis étape par étape ou indépendamment les uns des autres. Ces modules proposent aussi la découverte d’outils et d’une méthodologie éprouvée. Cours 1 – L’open data, c’est quoi ?Cours 2 – Générer de la valeur à partir de l’open dataCours 3 – L’open data. Licence : Contrat spécifique : merci de prendre contactGéographie : Europe Tags: autoformation, cours, Europe, formation, open data, outil en ligne, pédagogie, univers libre

BeginnersGuide/Programmers This is a Wiki page. Users with edit rights can edit it. You are, therefore, free to (in fact, encouraged to) add details of material that other Python users will find useful. It is not an advertising page and is here to serve the whole Python community. A beginner-friendly Python tutorial that starts with the absolute basics but also covers more advanced stuff like Python software deployment.

Related: