Computer scientists at Loughborough University report the complex software, named Emotive, can quickly scan tweets to extract from each a direct expression of one of eight basic emotions -- anger, disgust, fear, happiness, sadness, surprise, shame and confusion.
It could provide the capability to identify threats like the 2011 riots in London, which were organized with the help of Twitter and other social media, they said.
The researchers said the program could geographically map the emotional mood of the nation and its reaction to big events, The Guardian reported Friday.
Public postings through Twitter and other social media can yield an accurate real-time record of how and what people are feeling, Tom Jackson, the leader of the research team, said.
"Twitter is a very concise platform through which users express how they feel about a particular event, be that a criminal act, a new government policy or even a change in the weather," he said. "Through the computer program we have created we can collate these expressions of feelings in real time, map them geographically and track how they develop."