get_cbow_matrix: Get CBOW Matrix.

Description Usage Arguments Examples

View source: R/RcppExports.R View source: R/cbow.R

Description

Get matrix with moving windows. Negative integer values indicate absence of a token at the respective position.

Usage

1
2
get_cbow_matrix(corpus, p_attribute, registry = Sys.getenv("CORPUS_REGISTRY"),
  matrix, window)

Arguments

corpus

a CWB corpus

p_attribute

a positional attribute

registry

the registry directory

matrix

a matrix

window

window size

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
registry <- if (!check_pkg_registry_files()) use_tmp_registry() else get_pkg_registry()

m <- get_region_matrix(
  corpus = "REUTERS", s_attribute = "places",
  strucs = 0L:5L, registry = registry
  )
windowsize <- 3L
m2 <- get_cbow_matrix(
  corpus = "REUTERS", p_attribute = "word",
  registry = registry, matrix = m, window = windowsize
  )
colnames(m2) <- c(-windowsize:-1, "node", 1:windowsize)

RcppCWB documentation built on Oct. 22, 2018, 5:08 p.m.