What Is quanteda and What Is It Used For?

Updated

quanteda is an R package for managing and analyzing text quantitatively. It is designed for R users who need to apply natural language processing to texts, covering the path from documents to final analysis. If you already work in R and want a single framework for corpus management, tokenization, keyword analysis, text models, and visualization, quanteda is built for that purpose. If you do not use R, it is not a point-and-click tool, and the package requires R programming knowledge.

What quanteda actually does

The package provides functionality across the main stages of a quantitative text analysis workflow:

  • Corpus management — organizing and handling collections of documents
  • Tokens and n-grams — creating and manipulating tokens and n-grams
  • Keywords in context — exploring keywords within their surrounding text
  • Document-feature matrices — forming and manipulating sparse matrices of documents by features, plus feature co-occurrence matrices
  • Keyword analysis — analyzing keywords
  • Similarity and distance — computing feature similarities and distances
  • Dictionaries — applying content dictionaries
  • Machine learning — applying supervised and unsupervised machine learning
  • Visualization — visually representing text and text analyses

The package is created and maintained by Kenneth Benoit and Kohei Watanabe. Its creation was funded by the European Research Council grant ERC-2011-StG 283794-QUANTESS, and continued development is supported by the Quanteda Initiative CIC.

Who it is for

quanteda targets researchers, students, and other analysts who need to apply NLP to texts. The package's own framing notes that its capabilities match or exceed many end-user software applications, many of which are expensive and not open source. That makes it relevant to analysts with fewer financial resources, provided they can work in R.

The API is designed to enable powerful, efficient analysis with a minimum of steps, and the project emphasizes consistent design to lower the barriers to learning and using NLP and quantitative text analysis — even for proficient R programmers.

The quanteda family of packages

With the v3 release, quanteda completed a split into modular packages. The family includes:

Package Contains
quanteda All core natural language processing and textual data management functions
quanteda.textmodels Text models and supporting functions, namely the textmodel_*() functions (split with v2)
quanteda.textstats Statistics for textual data, namely the textstat_*() functions (split with v3)
quanteda.textplots Plots for textual data, namely the textplot_*() functions (split with v3)

Additional package releases are in progress.

What changed in version 4

quanteda 4.0 is a major release that improves functionality and performance and further improves function consistency by removing previously deprecated functions. It also includes significant new tokeniser rules, making the default tokeniser smarter, with new Unicode and ICU-compliant rules that let it work more consistently across more languages.

The project documents these changes in three places: an article about the new external pointer tokens objects, an article showing performance benchmarks for those objects alongside tokeniser improvements in v4, and the v4 changelog listing all changes, improvements, and deprecations.

When to choose it — and when not to

Choose quanteda if you work in R and want an open-source framework that spans corpus management through modeling and visualization, with a consistent API and active development. The modular package structure lets you install only the pieces you need for models, statistics, or plots.

Look elsewhere if you need a graphical, non-programming interface, or if you do not want to write R code — the package explicitly requires R programming knowledge.