Learn R Programming

rcqp (version 0.5)

cqi_cpos2id: Convert a corpus position

Description

Associate a corpus position to other parameters.

Usage

cqi_cpos2id(attribute, cpos)
	cqi_cpos2lbound(attribute, cpos)
	cqi_cpos2rbound(attribute, cpos)
	cqi_cpos2str(attribute, cpos)
	cqi_cpos2alg(attribute, cpos)
	cqi_cpos2struc(attribute, cpos)
	cqi_alg2cpos(attribute, alg)

Arguments

attribute

(string) the qualified name of an attribute.

cpos

(integer vector) a list of corpus positions

alg

(integer) an alignment ID

Value

cqi_cpos2str returns a vector of strings.

The cqi_alg2cpos function returns a 4-elements vector representing the start and end positions of an alignment in the source corpus and the start and end positions in the target corpus.

The other functions return a vector of integers representing corpus positions.

Details

The cqi_cpos2id and cqi_cpos2str functions apply to positional attributes.

The cqi_cpos2lbound, cqi_cpos2rbound and cqi_cpos2struc functions apply to structural attributes.

The cqi_alg2cpos function applies to alignment attributes (in the case of aligned corpora).

References

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

See Also

cqi_id2cpos, cqi_id2freq, cqi_id2str, cqi_regex2id, cqi_str2id, cqi_struc2cpos, cqi_struc2str.

Examples

Run this code
# NOT RUN {
cqi_query("DICKENS","Foo","\"eas(y|ier|iest)\";")
cpos <- cqi_dump_subcorpus("DICKENS:Foo")[1:20,1]

cqi_cpos2id("DICKENS.pos", cpos)
cqi_cpos2str("DICKENS.pos", cpos)
cqi_cpos2id("DICKENS.word", cpos)
cqi_cpos2str("DICKENS.word", cpos)
cqi_cpos2id("DICKENS.lemma", cpos)
cqi_cpos2str("DICKENS.lemma", cpos)

cqi_query("DICKENS","Foo","\"interesting\";")
cpos <- cqi_dump_subcorpus("DICKENS:Foo",1,10)[,1]

# Expects structural attributes
cqi_cpos2lbound("DICKENS.chapter", cpos)
cqi_cpos2rbound("DICKENS.chapter", cpos)

cqi_cpos2struc("DICKENS.chapter", cpos)
# }

Run the code above in your browser using DataLab