British scientists have developed a computer program they say can map the mood of the nation using Twitter.
Named Emotive, it works by accessing the emotional content of postings on the social networking site.
The team, from Loughborough University, say it can scan up to 2,000 tweets a second and rate them for expressions of one of eight human emotions.
They claim Emotive could help calm civil unrest and identify early threats to public safety.
More than 500 million people across the world use Twitter, and more than 340 million tweets are posted daily.
The team, from the university's new Centre for Information Management, say the system can extract a direct expression of anger, disgust, fear, happiness, sadness, surprise, shame and confusion from each tweet.
The academics said that using the Emotive software to geographically evaluate any mass mood could help police to track potential criminal behaviour or threats to public safety.
It may be able to guide national policy on the best way to react to major incidents, they added.
'Sadness and disgust'
Prof Tom Jackson, who led the research team, said that public postings through social media gave a very accurate real-time record of how and what people were feeling.
"Following the murder of solider Lee Rigby in Woolwich there was an outpouring of sadness and disgust through Twitter," he said.
"Across the country people expressed their emotions at this unprovoked attack, with some using the incident to incite racial hatred against Muslims.
"Two days after his murder his family appealed for calm, stating that their son would not have wanted his name to be used as an excuse to carry out attacks against others.
"This appeal had an almost immediate effect, leading to an outpour of positive sentiment."
Prof Jackson added: "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.
"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."
Dr Ann O'Brien, who was part of the team that created the study for emotions used by the programme, said it could chart the strength of feeling expressed in both ordinary language and in slang.
"For any incident we can view how reactions grow and diminish over time," she said.
The system is currently only being used to analyse tweets in the UK, but the researchers said it could easily be scaled up to monitor tweets globally.