quanteda Basics
Learn how to implement basic NLP tasks with quanteda.
We'll cover the following...
We compared tm
, tidytext
, and quanteda
for a brief overview of how the different packages implemented text mining and natural language processing tasks. Here is the code presented in that lesson:
Press + to interact
# install.packages("quanteda")# install.packages("readtext")library(quanteda, quietly = TRUE)library(readtext)textDF <- readtext(file = "data/mws*txt", docvarsfrom = "filenames")quantCorpus <- corpus(textDF)tokens(quantCorpus)
In the code above, quanteda
commands are used:
Line 7:
readtext
is used to read text files in thedata
directory with names beginning withmws
. This produces adata.frame
.docvarsfrom
saves the file names as thedoc id
.Line 9:
corpus
converts thedata.frame
into aquanteda
corpus.Line 11:
tokens
is used to tokenize the corpus. ...
Access this course and 1400+ top-rated courses and projects.