# find contexts of immigration
context_immigration <- get_context(x = cr_sample_corpus,
target = 'immigration',
window = 6,
valuetype = "fixed",
case_insensitive = TRUE,
hard_cut = FALSE, verbose = FALSE)
# find local vocab (use it to define the candidate of nearest neighbors)
local_vocab <- get_local_vocab(context_immigration$context, pre_trained = cr_glove_subset)
set.seed(42L)
nns_immigration <- bootstrap_nns(context = context_immigration$context,
pre_trained = cr_glove_subset,
transform_matrix = cr_transform,
transform = TRUE,
candidates = local_vocab,
bootstrap = TRUE,
num_bootstraps = 100,
confidence_level = 0.95,
N = 50,
norm = "l2")
head(nns_immigration)
Run the code above in your browser using DataLab