cqp_query: Execute CQP Query and Retrieve Results.

Description Usage Arguments Details Author(s) References Examples

View source: R/RcppExports.R View source: R/cqp.R

Description

Using CQP queries requires a two-step procedure: At first, you execute a query using cqp_query. Then, cqp_dump_subcorpus will return a matrix with the regions of the matches for the query.

Usage

1
2
3
4
5
6
7
cqp_query(corpus, query, subcorpus = "QUERY")

cqp_dump_subcorpus(corpus, subcorpus = "QUERY")

cqp_subcorpus_size(corpus, subcorpus = "QUERY")

cqp_list_subcorpora(corpus)

Arguments

corpus

a CWB corpus

query

a CQP query

subcorpus

subcorpus name

Details

The cqp_query function executes a CQP query. The cqp_subcorpus_size function returns the number of matches for the CQP query. The cqp_dump_subcorpus function will return a two-column matrix with the left and right corpus positions of the matches for the CQP query.

Author(s)

Andreas Blaette, Bernard Desgraupes, Sylvain Loiseau

References

Evert, S. 2005. The CQP Query Language Tutorial. Available online at http://cwb.sourceforge.net/files/CWB_Encoding_Tutorial.pdf

Examples

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

if (!cqp_is_initialized()){
  cqp_initialize(registry = registry)
} else {
  if (cqp_get_registry() != registry) cqp_reset_registry(registry)
}
cqp_query(corpus = "REUTERS", query = '"oil";')
cqp_subcorpus_size("REUTERS")
cqp_dump_subcorpus("REUTERS")

cqp_query(corpus = "REUTERS", query = '"crude" "oil";')
cqp_subcorpus_size("REUTERS", subcorpus = "QUERY")
cqp_dump_subcorpus("REUTERS")

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