Get size and corpus positions corresponding to the results of a query.
cqi_dump_subcorpus(subcorpus, first=0, last=cqi_subcorpus_size(subcorpus)-1)
cqi_subcorpus_size(subcorpus)
cqi_drop_subcorpus(subcorpus)
(string) qualified name of a subcorpus.
(integer) first index. Optional: default is 0.
(integer) last index. Optional: default is size-1
.
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.
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.
# 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