Learn R Programming

rcqp (version 0.5)

cqi_dump_subcorpus: Handle subcorpora

Description

Get size and corpus positions corresponding to the results of a query.

Usage

cqi_dump_subcorpus(subcorpus, first=0, last=cqi_subcorpus_size(subcorpus)-1)
	cqi_subcorpus_size(subcorpus)
	cqi_drop_subcorpus(subcorpus)

Arguments

subcorpus

(string) qualified name of a subcorpus.

first

(integer) first index. Optional: default is 0.

last

(integer) last index. Optional: default is size-1.

Value

cqi_subcorpus_size returns an integer which is the number of matches in the specified subcorpus.

cqi_dump_subcorpus returns a matrix with four columns corresponding to the match, matchend, target, and keyword fields respectively. Each row corresponds to a query match. The number of rows is last-first+1. This is the size of the subcorpus if the first and last arguments are not specified.

cqi_drop_subcorpus does not return anything.

Details

A subcorpus is typically the result of a previous query (see the cqi_query function). The qualified name of the subcorpus is of the form name_of_corpus:name_of_subcorpus, for instance "DICKENS:A". The name of the subcorpus is declared in the second argument of the cqi_query function.

The cqi_dump_subcorpus function builds a two-dimension array (a matrix) of corpus positions corresponding to the results of a query.

The cqi_drop_subcorpus function frees the memory allocated to a subcorpus.

References

http://cwb.sourceforge.net/documentation.php

See Also

cqi_query, cqi_list_corpora, cqi_list_subcorpora.

Examples

Run this code
# NOT RUN {
cqi_query("DICKENS","Foo","\"interesting\";")
cqi_subcorpus_size("DICKENS:Foo")
cqi_dump_subcorpus("DICKENS:Foo")
cqi_dump_subcorpus("DICKENS:Foo",4,10)
# }

Run the code above in your browser using DataLab