FM indices can be stored on disk and loaded into memory again in order to avoid re-computing the index every time a new R session is opened.
Value
For fm_index_load
, a FM Index object that can be passed to fm_index_locate()
for
finding matches in the corpus.
For fm_index_save
, no return value. Called for side-effects.
See also
Other FM Index functions:
fm_index_create()
,
fm_index_locate()
Examples
data("state")
index_1 <- fm_index_create(state.name, case_sensitive = FALSE)
tmp_path <- tempfile()
fm_index_save(index_1, tmp_path)
index_2 <- fm_index_load(tmp_path)
identical(
fm_index_locate("new", index_1),
fm_index_locate("new", index_2)
)
#> [1] TRUE