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 at Loughborough University's new Centre for Information Management who developed the program have said it could be possible to use the complex software, named the Emotive program, to geographically map the emotional mood of the nation and its reaction to big events.

More than 500 million people across the world use Twitter as the communication tool of choice, and over 340 million tweets are posted daily.

It is a form of social media that, like others such as Facebook and messenger systems, was criticised for aiding rioters in organising the unrest that swept the UK in the summer of 2011.

Academics said using the Emotive software to geographically evaluate any mass mood could help police 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, not least because it can analyse up to 2,000 tweets a second.

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,' Jackson 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.”

Academics said Emotive has been extensively tested and evaluated. 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 the social-media sphere.

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.