Learn R Programming

rcqp (version 0.5)

cqi_id2cpos: Convert the ID of an item

Description

Associate an item's ID to other parameters.

Usage

cqi_id2cpos(attribute, id)
	cqi_id2freq(attribute, ids)
	cqi_id2str(attribute, ids)
	cqi_str2id(attribute, strs)

Arguments

attribute

(string) the qualified name of an attribute.

id

(integer) a single value

ids

(integer vector)

strs

(character vector)

Value

The cqi_id2cpos, cqi_id2freq, cqi_str2id functions return an integer. The cqi_id2str function returns a string.

Details

These functions take as argument the ID of a positional attribute item and associate corresponding parameters such as the corpus position, the frequency or the string it represents.

The cqi_str2id function does the opposite: it associates the ID to a given positional parameter.

References

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

See Also

cqi_alg2cpos cqi_cpos2alg, cqi_cpos2id, cqi_cpos2lbound, cqi_cpos2rbound, cqi_cpos2str, cqi_cpos2struc, 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,1]

# # cqi_id2cpos
pids <- unique(cqi_cpos2id("DICKENS.pos", cpos))
ppos <- cqi_id2cpos("DICKENS.pos", pids[1])
ppos[1:50]

wids <- unique(cqi_cpos2id("DICKENS.word", cpos))
wpos <- cqi_id2cpos("DICKENS.word", wids[1])
wpos[1:50]

lids <- unique(cqi_cpos2id("DICKENS.lemma", cpos))
lpos <- cqi_id2cpos("DICKENS.lemma", lids[1])
lpos[1:50]

# # cqi_str2id and cqi_id2str
pid <- cqi_str2id("DICKENS.pos", "JJ")
cqi_id2str("DICKENS.pos", pid)

wid <- cqi_str2id("DICKENS.word", "easiest")
cqi_id2str("DICKENS.word", wid)

lid <- cqi_str2id("DICKENS.lemma", "easy")
cqi_id2str("DICKENS.lemma", lid)

# # cqi_id2freq
# Take the 20 first positions
cpos <- cqi_dump_subcorpus("DICKENS:Foo")[1:20,1]

pids <- unique(cqi_cpos2id("DICKENS.pos", cpos))
cqi_id2freq("DICKENS.pos", pids)

wids <- unique(cqi_cpos2id("DICKENS.word", cpos))
cqi_id2freq("DICKENS.word", wids)

lids <- unique(cqi_cpos2id("DICKENS.lemma", cpos))
cqi_id2freq("DICKENS.lemma", lids)
# }

Run the code above in your browser using DataLab