An R interface to a fast java implementation of the Aho-Corasick exact string search algorithm.
This package is in a very early stage of development. Important changes are expected in future versions.
if(!any(rownames(installed.packages()) == "devtools")) { install.packages("devtools") } devtools::install_github("jullybobble/rahocorasick")
library(rahocorasick) dictionary <- list(one = 1, two = 2, three = 3) trie <- ac_build_list(dictionary)
text_1 <- "one apple" hit_1 <- ac_search(text_1, trie)[[1]] hit_1 ac_are_boundary_chars(text_1, hit_1$begin, hit_1$end)
text_2 <- "a twoonie in my pocket" hit_2 <- ac_search(text_2, trie)[[1]] hit_2 ac_are_boundary_chars(text_2, hit_2$begin, hit_2$end)
text_3 <- "nothing left" ac_build_and_search_list(c(text_1, text_2, text_3), dictionary)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.