s_attr_is_descendent {RcppCWB} | R Documentation |
Explore XML structure of CWB corpus
Description
The data format of the Corpus Workbench (CWB) allows nested XML as import data. Auxiliary functions assist detecting whether two structural attributes are nested or at the same level (i.e. defining the same regions).
Usage
s_attr_is_descendent(
x,
y,
corpus,
registry = Sys.getenv("CORPUS_REGISTRY"),
sample = NULL
)
s_attr_is_sibling(x, y, corpus, registry = Sys.getenv("CORPUS_REGISTRY"))
s_attr_relationship(x, y, corpus, registry = Sys.getenv("CORPUS_REGISTRY"))
Arguments
x |
A structural attribute, stated as length-one |
y |
Another structural attribute, stated as length-one |
corpus |
A corpus ID (length-one |
registry |
The directory with the registry file for the corpus. |
sample |
An |
Details
s_attr_is_descendent()
will evaluate whether s_attribute x
is
a child of s_attribute y
. The return value is TRUE
(a single logical
value) if all regions defined by x
are within the regions defined by y
.
If not, FALSE
is returned. The return values is also FALSE
if all regions
of x
and y
are idential. Attributes will be siblings in this case,
and not in an ancestor-sibling relationship.
s_attr_is_sibling()
will test whether the regions defined for
structural attribute x
and structural attribute y
are identical. If
yes, TRUE
is returned, assuming that both attributes are at the same
level (siblings). If not, FALSE
is returned.
s_attr_relationship()
will return 0
if s-attributes x
and y
are siblings in the sense that they define identical regions. The return
value is 0
if x
is an ancestor of y
and 1
if x
is a descencdent
of y
.
Examples
s_attr_is_descendent("id", "places", corpus = "REUTERS", registry = get_tmp_registry())
s_attr_is_sibling(x = "id", y = "places", corpus = "REUTERS", registry = get_tmp_registry())
s_attr_is_sibling(x = "id", y = "places", corpus = "REUTERS", registry = get_tmp_registry())