1. The Text-Package: An R-Package for Analyzing and Visualizing Human Language Using Natural Language Processing and Transformers.
- Author
-
Kjell, Oscar, Giorgi, Salvatore, and Schwartz, H. Andrew
- Abstract
The language that individuals use for expressing themselves contains rich psychological information. Recent significant advances in Natural Language Processing (NLP) and Deep Learning (DL), namely transformers, have resulted in large performance gains in tasks related to understanding natural language. However, these state-of-the-art methods have not yet been made easily accessible for psychology researchers, nor designed to be optimal for human-level analyses. This tutorial introduces text (https://r-text.org/), a new R-package for analyzing and visualizing human language using transformers, the latest techniques from NLP and DL. The text-package is both a modular solution for accessing state-of-the-art language models and an end-to-end solution catered for human-level analyses. Hence, text provides user-friendly functions tailored to test hypotheses in social sciences for both relatively small and large data sets. The tutorial describes methods for analyzing text, providing functions with reliable defaults that can be used off-the-shelf as well as providing a framework for the advanced users to build on for novel pipelines. The reader learns about three core methods: (1) textEmbed(): to transform text to modern transformer-based word embeddings; (2) textTrain() and textPredict(): to train predictive models with embeddings as input, and use the models to predict from; (3) textSimilarity() and textDistance(): to compute semantic similarity/distance scores between texts. The reader also learns about two extended methods: (1) textProjection()/textProjectionPlot() and (2) textCentrality()/textCentralityPlot(): to examine and visualize text within the embedding space. Natural language is the fundamental way individuals communicate their thoughts and emotions to others. Recent advances in Artificial Intelligence (AI), referred to as transformers, have resulted in large increases in performance at most tasks related to understanding natural language. This tutorial introduces how to use these state-of-the-art AI techniques in both custom research analyses as well as in completely end-to-end analytic processes. We describe text, a software package which provides transformer-based techniques intended to be easily accessible for social scientists. The text-package is open-source, written for the statistical programming language R, and it is free to use or alter. It comprises user-friendly functions to transform text to numeric representations, that are used for examining their relationship to other variables or for visualizing statistically significant features of texts. Transformers can facilitate analyses of natural language for gaining psychological insights with unprecedented accuracy and provide a more detailed understanding of the human condition. [ABSTRACT FROM AUTHOR]
- Published
- 2023
- Full Text
- View/download PDF