# Building a dictionary from Shakespeare's "Much Ado About Nothing"
dict <- dictionary(much_ado)
length(dict)
query(dict, "leonato") # TRUE
query(dict, c("thy", "thou")) # c(TRUE, TRUE)
query(dict, "smartphones") # FALSE
# Getting list of words as regular character vector
words <- as.character(dict)
head(words)
# Building a dictionary from a list of words
dict <- as_dictionary(c("i", "the", "a"))
Run the code above in your browser using DataLab