A new computer program could help to calm civil unrest and identify early threats to public safety by analysing postings on Twitter and assessing public mood, academics have said.

The system can analyse up to 2,000 tweets a second to extract from each a direct expression of one of eight basic emotions: anger, disgust, fear, happiness, sadness, surprise, shame and confusion.

The team who developed the program at Loughborough University's new centre for information management said it could be possible to use the complex software, named Emotive, to geographically map the emotional mood of the nation and its reaction to big events.

Twitter has hundreds of millions of users around the world and, along with Facebook and BlackBerry Messenger, was criticised for aiding rioters in organising the unrest that swept England in the summer of 2011.

Academics said using Emotive to geographically evaluate the mass mood could help police to track potential criminal behaviour or threats to public safety, and may be able to guide national policy on the best way to react to major incidents.

Professor Tom Jackson, who led the research team, said: "Following the murder of soldier Lee Rigby in Woolwich there was an outpouring of sadness and disgust through Twitter.

"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."

He said that public postings through social media give a very accurate real-time record of how and what people are feeling.

"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."

Dr Ann O'Brien was part of the research team that created the ontology, or structural model, used by Emotive.

She said: "The ontology we created takes the eight emotions and gives them a rich linguistic context so that we can chart the strength of emotions expressed in ordinary language and also in slang. For any incident we can view how reactions grow and diminish over time."

The system is currently only being used to analyse tweets in the UK, but it can easily be scaled up to monitor tweets globally, of which there are 10,000 a second.

The team has already secured further funding that will enable researchers to develop another prototype system that can automatically detect events, analyse emotions and extract more summary details of importance from social media.

It is also hoped academics can explore the possibility of predicting personality profiles from the natural language used on Twitter and similar social streams.

The Emotive project was funded by the Engineering and Physical Sciences Research Council and the Defence Science and Technology Laboratory.