25 March 2014, Proceedings of the National Academy of Sciences: Kramer, Facebook Core Data Science Team, et al: Experimental evidence of massive-scale emotional contagion through social networks (PDF)
How Researchers Classified Facebook Posts as 'Happy' or 'Sad'
By Elizabeth Dwoskin
Jun 30, 2014
How did the researchers who manipulated  Facebook's news feed to show users more happy or sad content decide which posts to display?
They used a common text-analysis software program called Linguistic Inquiry and Word Count, or LIWC2007.  The software is a dictionary of more than 4,500 words and word stems that helps researchers mine and analyze emotions in text.
Posts were determined to be positive or negative if they contained at least one word LIWC classifies as positive or negative, according to the paper. 
For example, LIWC categorizes "cried" as sadness, one of several negative emotions. Words like annoyed fall into the anger category. Words like "maybe, perhaps, or guess," indicate that the person is tentative.
The software analyzes parts of speech to assess the context in which a word is used. Designers of similar software packages say they "train" the software to resolve ambiguity by reviewing hundreds of thousands of sentences.
Companies and researchers increasingly use software like LIWC to analyze the huge volume of content on social media. Marketers want to know what users are saying about their brands. Academics mine social media content to study behavioral and social trends.
According to the LIWC site, the software was developed in the early 1990s. It is based on decades of research that found that people's physical and mental health can be predicted by the words they use. Researchers have also found that the act of writing can influence people's emotional state.
You can score your own emotions using LIWC's software. The company offers a free tool  on its site where anyone can plug in their Twitter handle and see their emotional score. Based on the 911 most recent words used, LIWC says my emotional style is "worried" and my social style is "arrogant."