bind_ngrams | R Documentation |
Usually ngrams are identified and modified by probabilistic collocation extraction, but in certain situations one might want to fix specific word combinations before further processing of the text independent of collocation statistics such as PMI.
bind_ngrams(string, ngrams, replacement = "_", case_insensitive = TRUE)
string |
A character vector in which blanks of ngrams shall be replaced. |
ngrams |
Character vector of known ngrams. Please note that ngrams in the |
replacement |
A fixed pattern that shall replace blanks in ngrams. By default a dash "_". |
case_insensitive |
By default TRUE. Note that case is only used for matching (see ngram parameter) |
The string
with modified ngrams.
bind_ngrams(c("The United Nations are an important organization.", "They are concerned, e.g., with sustainable development and climate change.") , ngrams = c("United Nations", "CLIMATE CHANGE")) # [1] "The United_Nations are an important organization." # [2] "They are concerned, e.g., with sustainable development and CLIMATE_CHANGE."
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.