1 of 7

Introduction to Natural Language Processing for Social Scientists

Marcel Tkacik

Link to the presentation: https://www.marceltkacik.me/teaching/text-for-social-science

2 of 7

Introduction

  • As Jackson et al. (2021) note: “language offers a unique window into psychology”
  • NLP paradigms may be uniquely suited to resolve problems associated with the generalizability of psychological findings because they sample from real-life conversations (now since January 2021 we can use Twitter again)!
  • There is such a large amount of unstructured text around us that statistical power is usually not an issue. It is also very often unobstrusive measure
  • Recent advances in machine learning now allow us to perform sophisticated analysis of text, even look for the meaning
  • Text analysis (NLP) is not going to replace the methods we currently use in social science but it can very usefully complement our toolbox. It’s arguably as useful as Likert scales and experiments

3 of 7

Role of Machine Learning (ML) in the advances of NLP

  • I wouldn’t be standing here if the advent of ML didn’t happen
  • Otherwise we would still only be counting words (LIWC)
  • ML, especially supervised ML, allows us to train models on one set of data (it learns the relationships between target and feature) and then transfer this knowledge by performing out-of-sample forecast for data where the target values are not known
  • This is called transfer learning
  • For example you can give the students sample of social media texts to rate on positive/negative scale (sentiment), train ML model on it and then use it to predict sentiment of different social media texts on Twitter

4 of 7

Content

  • We will cover 3 use cases in Jackson et al. (2021) and dive a bit into them

0. Sometimes counting words is helpful, preprocessing

  1. Detecting and predicting sentiment and emotions
  2. Modeling latent topics of books, social conversations, journal articles
  3. Finding meaning of words with word embeddings (plus live demonstration)

5 of 7

The signal and the noise: How do we deal with noise in the text data?

  • We want to find signal in the data - something that can predict variable we are interested in
  • In most applications, content words are words that we are interested in (adjectives, nouns).
  • Function words such as pronouns and many basic verbs are often only causing noise in the data and don’t help anything
  • To keep only words that we are interested in we use preprocessing methods
  • Preprocessing has multiple steps, such as removing the words that are misspeled and lemmatizing the rest of the words (do, doing both become “do”)
  • Corpus = collection of text (document), corpora = collection of corpuses

6 of 7

Word clouds – global warming and covid, Twitter

Taken from Jackson (2021)

7 of 7

Concern about collective threats on Twitter

  • Conservatives seem to be more concerned with threats that are coming from intent and are local
  • Liberals from threats that are coming from extent/omission and are global
  • Which threats are people in different US states more concerned with?
  • The higher the coefficient, the more conservative state tweet is from