Sentiment Analysis of Social Media: A New Pulse for Urban Security in Bogotá

Sentiment Analysis of Social Network Content to Characterize the Perception of Security

2020-12-07
Luisa Fernanda Chaparro, Cristian Pulido, Jorge Rudas, Ana Maria Reyes, Jorge Victorino, Luz Ángela Narváez, Francisco Gómez, Darwin Martínez
Summary
Problem
Method
Results
Takeaways
Abstract

This paper presents an automated framework for quantifying the Perception of Security (PoS) in Bogotá by performing sentiment analysis on georeferenced Spanish tweets. Using a dataset of 26,000 tweets, the study compares rule-based (lexicon) and supervised machine learning approaches, identifying Multinomial Naive Bayes with TF-IDF vectorization as a high-performing method for real-time security monitoring.

TL;DR

Researchers at the Universidad Nacional de Colombia have developed a system to measure the "Perception of Security" (PoS) in Bogotá by analyzing 26,000 tweets. Moving beyond slow, expensive physical surveys, they demonstrated that supervised machine learning—specifically Multinomial Naive Bayes with TF-IDF—can effectively track the emotional state of a city in real-time, even within the linguistic complexities of Spanish.

Problem & Motivation: The Failure of Static Surveys

Understanding the fear of crime is as critical for urban planning as understanding crime itself. Traditionally, this has been measured through surveys. However, the authors argue that surveys are:

  • Costly and Time-Consuming: They cannot be performed daily.
  • Delayed: By the time results are processed, the public mood may have shifted.
  • Fragmented: They only reach a small sample of the population.

The challenge in moving this to social media lies in the language. Spanish is rich in colloquialisms and "noise." Most sentiment analysis tools are optimized for English, leaving Spanish-speaking cities like Bogotá without specialized toolsets for quantifying public safety sentiment.

Methodology: Rules vs. Learning

The study compared two distinct technical paths to process tweets filtered for security-related keywords (e.g., robo, asalto, arma):

1. The Rule-Based Approach (Lexicon)

This method uses ML-Senticon, a multilingual lemma-level lexicon. It counts positive and negative words to calculate a "Polarity Score." While straightforward, it lacks context—it doesn't understand irony or how neighboring words change a sentiment's meaning.

2. The Supervised Learning Pipeline

The authors utilized a gold-standard dataset labeled by 10 experts. They processed the text through:

  • Pre-processing: Stemming, removing stop words, and normalizing Spanish punctuation (like ¡ and ¿).
  • Feature Extraction: Comparing Bag of Words (BOW) vs. TF-IDF (Term Frequency-Inverse Document Frequency).
  • Classification: Testing Logistic Regression, Naive Bayes, and SGD.

Overall Architecture Fig 1: The proposed workflow from data acquisition to final sentiment classification.

Experimental Insights

The results provide a clear hierarchy of performance. Rule-based models were found to be insufficient for the nuances of security-related speech in Bogotá.

Key findings from the supervised models:

  • TF-IDF is essential: It proved more effective than simple word counts (BOW) because it highlights the "importance" of rare, high-impact security terms.
  • Multinomial Naive Bayes (MNB): Achieved the highest Precision, making it the best candidate if the goal is to minimize false alarms in security reporting.
  • SGD Classifier: Showed the best F1-Score, suggesting it is the most robust when balancing sensitivity (Recall) and accuracy.

Experimental Results Fig 2: Comparison of classifiers. Note the stability of Logistic Regression and the precision peaks of MNB.

Critical Analysis & Future Outlook

This work represents a vital shift toward Algorithmic Governance in Latin America. By treating Twitter as a "distributed sensor," the city can detect spikes in fear or frustration immediately after specific incidents.

Limitations: The authors acknowledge that current Spanish lexicons are "poorly developed." Additionally, using simple ML models like Naive Bayes may limit the capture of complex semantic structures compared to modern Large Language Models (LLMs) like BERT.

The Takeaway: The path to a safer city involves listening to its digital heartbeat. This study proves that even with classic machine learning, we can bridge the gap between subjective human feeling and objective data analysis. The next evolution will likely involve LIME (Local Interpretable Model-agnostic Explanations) to help policy makers understand why a model flagged a specific neighborhood as feeling "insecure."

Find Similar Papers

Try Our Examples

  • Search for recent papers using deep learning models (like BERT or RoBERTa) specifically fine-tuned for Colombian Spanish sentiment analysis in urban security contexts.
  • What are the primary challenges documented in literature when using the ML-Senticon lexicon for Spanish dialect-specific sentiment tasks compared to modern word embeddings?
  • How have other major metropolitan areas integrated real-time social media sentiment analysis into their "Smart City" or public safety decision-support systems?
Contents
Sentiment Analysis of Social Media: A New Pulse for Urban Security in Bogotá
1. TL;DR
2. Problem & Motivation: The Failure of Static Surveys
3. Methodology: Rules vs. Learning
3.1. 1. The Rule-Based Approach (Lexicon)
3.2. 2. The Supervised Learning Pipeline
4. Experimental Insights
5. Critical Analysis & Future Outlook