import_dictionary | R Documentation |
To use a dictionary in this package, it needs to be a data.frame with a 'string' column.
Also, if a string in the dictionary is a multitoken string, it needs to be wrapped in
quotes ("like this") or angle brackets (<like this>). Otherwise, spaces will be considered
as OR operators (see query_syntax
). This function helps prepare dictionaries as such.
It can take either a quanteda dictionary2 class, or any data.frame type dictionary where each row
holds a dictionary term.
import_dictionary(
dict,
auto_quote = T,
string_alias = c("query", "word", "term", "text")
)
dict |
A data.frame where each row is a dictionary term or a quanteda dictionary2 class object. |
auto_quote |
If TRUE (default), ensures multitoken terms are quoted |
string_alias |
If dict is a data.frame and doesn't have a column called "string", check these aliases to rename a column to "string". (If your dict doesn't have a column with any of these column names, just specify the name here) |
A dictionary in data.frame form, ready to be used in the dict_ functions.
d = data.frame(term = c('good','not good'), label=c('positive','negative'))
import_dictionary(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.