Get Attribute Size (of Positional/Structural Attribute).
Use cl_attribute_size
to get the total number of values of a
positional attribute (param attribute_type
= "p"), or structural
attribute (param attribute_type
= "s"). Note that indices are
zero-based, i.e. the maximum position of a positional / structural
attribute is attribute size minus 1 (see examples).
cl_attribute_size(corpus, attribute, attribute_type, registry = Sys.getenv("CORPUS_REGISTRY"))
corpus |
name of a CWB corpus (upper case) |
attribute |
name of a p- or s-attribute |
attribute_type |
either "p" or "s", for structural/positional attribute |
registry |
path to the registry directory, defaults to the value of the environment variable CORPUS_REGISTRY |
registry <- if (!check_pkg_registry_files()) use_tmp_registry() else get_pkg_registry() Sys.setenv(CORPUS_REGISTRY = registry) token_no <- cl_attribute_size("REUTERS", attribute = "word", attribute_type = "p") corpus_positions <- seq.int(from = 0, to = token_no - 1) cl_cpos2id("REUTERS", "word", cpos = corpus_positions) places_no <- cl_attribute_size("REUTERS", attribute = "places", attribute_type = "s") strucs <- seq.int(from = 0, to = places_no - 1) cl_struc2str("REUTERS", "places", struc = strucs)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.