|
41 | 41 | .Call(`_RcppCWB_cwb_version`) |
42 | 42 | } |
43 | 43 |
|
44 | | -.p_attr_default <- function() { |
| 44 | +#' Get default p-attribute |
| 45 | +#' |
| 46 | +#' Usually the default p-attribute will be "word". Use this function to avoid |
| 47 | +#' a hard-coded solution. Extracts the default attribute defined in the CWB |
| 48 | +#' source code. |
| 49 | +#' |
| 50 | +#' @rdname p_attr_default |
| 51 | +#' @return A length-one `character` vector. |
| 52 | +#' @export |
| 53 | +p_attr_default <- function() { |
45 | 54 | .Call(`_RcppCWB_p_attr_default`) |
46 | 55 | } |
47 | 56 |
|
48 | | -.s_attr <- function(corpus, s_attribute, registry) { |
49 | | - .Call(`_RcppCWB__s_attr`, corpus, s_attribute, registry) |
| 57 | +#' @param corpus ID of a CWB corpus (length-one `character` vector). |
| 58 | +#' @param s_attribute A structural attribute (length-one `character` vector). |
| 59 | +#' @param registry Registry directory. |
| 60 | +#' @rdname cl_rework |
| 61 | +#' @export |
| 62 | +s_attr <- function(corpus, s_attribute, registry) { |
| 63 | + .Call(`_RcppCWB_s_attr`, corpus, s_attribute, registry) |
50 | 64 | } |
51 | 65 |
|
52 | | -.p_attr <- function(corpus, p_attribute, registry) { |
53 | | - .Call(`_RcppCWB__p_attr`, corpus, p_attribute, registry) |
| 66 | +#' @param p_attribute A positional attribute (length-one `character` vector). |
| 67 | +#' @rdname cl_rework |
| 68 | +#' @export |
| 69 | +p_attr <- function(corpus, p_attribute, registry) { |
| 70 | + .Call(`_RcppCWB_p_attr`, corpus, p_attribute, registry) |
54 | 71 | } |
55 | 72 |
|
56 | | -.cl_attribute_size <- function(corpus, attribute, attribute_type, registry) { |
57 | | - .Call(`_RcppCWB__cl_attribute_size`, corpus, attribute, attribute_type, registry) |
| 73 | +#' @param attribute Either a positional, or a structural attribute. |
| 74 | +#' @param attribute_type Either "p" (positional attribute) or "s" (structural attribute). |
| 75 | +#' @rdname cl_functions |
| 76 | +attribute_size <- function(corpus, attribute, attribute_type, registry) { |
| 77 | + .Call(`_RcppCWB_attribute_size`, corpus, attribute, attribute_type, registry) |
58 | 78 | } |
59 | 79 |
|
60 | | -.p_attr_size <- function(p_attr) { |
61 | | - .Call(`_RcppCWB__p_attr_size`, p_attr) |
| 80 | +#' @param p_attr A `externalptr` referencing a p-attribute. |
| 81 | +#' @rdname cl_rework |
| 82 | +#' @export |
| 83 | +p_attr_size <- function(p_attr) { |
| 84 | + .Call(`_RcppCWB_p_attr_size`, p_attr) |
62 | 85 | } |
63 | 86 |
|
64 | | -.s_attr_size <- function(s_attr) { |
65 | | - .Call(`_RcppCWB__s_attr_size`, s_attr) |
| 87 | +#' @param s_attr A `externalptr` referencing a p-attribute. |
| 88 | +#' @rdname cl_rework |
| 89 | +#' @export |
| 90 | +s_attr_size <- function(s_attr) { |
| 91 | + .Call(`_RcppCWB_s_attr_size`, s_attr) |
66 | 92 | } |
67 | 93 |
|
68 | | -.p_attr_lexicon_size <- function(p_attr) { |
69 | | - .Call(`_RcppCWB__lexicon_size`, p_attr) |
| 94 | +#' @rdname cl_rework |
| 95 | +#' @export |
| 96 | +p_attr_lexicon_size <- function(p_attr) { |
| 97 | + .Call(`_RcppCWB_p_attr_lexicon_size`, p_attr) |
70 | 98 | } |
71 | 99 |
|
72 | 100 | .cl_lexicon_size <- function(corpus, p_attribute, registry) { |
|
77 | 105 | .Call(`_RcppCWB__cl_cpos2struc`, corpus, s_attribute, cpos, registry) |
78 | 106 | } |
79 | 107 |
|
80 | | -.cpos_to_struc <- function(s_attr, cpos) { |
81 | | - .Call(`_RcppCWB__cpos_to_struc`, s_attr, cpos) |
| 108 | +#' @param cpos An `integer` vector of corpus positions. |
| 109 | +#' @rdname cl_rework |
| 110 | +#' @export |
| 111 | +cpos_to_struc <- function(s_attr, cpos) { |
| 112 | + .Call(`_RcppCWB_cpos_to_struc`, s_attr, cpos) |
82 | 113 | } |
83 | 114 |
|
84 | | -.cl_cpos2str <- function(corpus, p_attribute, registry, cpos) { |
85 | | - .Call(`_RcppCWB__cl_cpos2str`, corpus, p_attribute, registry, cpos) |
| 115 | +#' Rcpp wrappers for CWB Corpus Library functions |
| 116 | +#' |
| 117 | +#' @param corpus The ID of a CWB corpus. |
| 118 | +#' @param p_attribute A positional attribute. |
| 119 | +#' @param registry Path to the corpus registry. |
| 120 | +#' @param cpos An integer vector of corpus positions. |
| 121 | +#' @rdname cl_functions |
| 122 | +cpos2str <- function(corpus, p_attribute, registry, cpos) { |
| 123 | + .Call(`_RcppCWB_cpos2str`, corpus, p_attribute, registry, cpos) |
86 | 124 | } |
87 | 125 |
|
88 | | -.cpos_to_str <- function(p_attr, cpos) { |
89 | | - .Call(`_RcppCWB__cpos_to_str`, p_attr, cpos) |
| 126 | +#' @rdname cl_rework |
| 127 | +#' @export |
| 128 | +cpos_to_str <- function(p_attr, cpos) { |
| 129 | + .Call(`_RcppCWB_cpos_to_str`, p_attr, cpos) |
90 | 130 | } |
91 | 131 |
|
92 | | -.cl_cpos2id <- function(corpus, p_attribute, registry, cpos) { |
93 | | - .Call(`_RcppCWB__cl_cpos2id`, corpus, p_attribute, registry, cpos) |
| 132 | +#' @rdname cl_functions |
| 133 | +cpos2id <- function(corpus, p_attribute, registry, cpos) { |
| 134 | + .Call(`_RcppCWB_cpos2id`, corpus, p_attribute, registry, cpos) |
94 | 135 | } |
95 | 136 |
|
96 | | -.cpos_to_id <- function(p_attr, cpos) { |
97 | | - .Call(`_RcppCWB__cpos_to_id`, p_attr, cpos) |
| 137 | +#' @rdname cl_rework |
| 138 | +#' @export |
| 139 | +cpos_to_id <- function(p_attr, cpos) { |
| 140 | + .Call(`_RcppCWB_cpos_to_id`, p_attr, cpos) |
98 | 141 | } |
99 | 142 |
|
100 | | -.cl_struc2cpos <- function(corpus, s_attribute, registry, struc) { |
101 | | - .Call(`_RcppCWB__cl_struc2cpos`, corpus, s_attribute, registry, struc) |
| 143 | +#' @param s_attribute A structural attribute. |
| 144 | +#' @param struc An integer value with struc. |
| 145 | +#' @rdname cl_functions |
| 146 | +struc2cpos <- function(corpus, s_attribute, registry, struc) { |
| 147 | + .Call(`_RcppCWB_struc2cpos`, corpus, s_attribute, registry, struc) |
102 | 148 | } |
103 | 149 |
|
104 | | -.struc_to_cpos <- function(s_attr, struc) { |
105 | | - .Call(`_RcppCWB__struc_to_cpos`, s_attr, struc) |
| 150 | +#' @param struc A length-one `integer` vector with a struc. |
| 151 | +#' @rdname cl_rework |
| 152 | +#' @export |
| 153 | +struc_to_cpos <- function(s_attr, struc) { |
| 154 | + .Call(`_RcppCWB_struc_to_cpos`, s_attr, struc) |
106 | 155 | } |
107 | 156 |
|
108 | | -.cl_id2str <- function(corpus, p_attribute, registry, id) { |
109 | | - .Call(`_RcppCWB__cl_id2str`, corpus, p_attribute, registry, id) |
| 157 | +#' @param id An `integer` vector with token ids. |
| 158 | +#' @rdname cl_functions |
| 159 | +id2str <- function(corpus, p_attribute, registry, id) { |
| 160 | + .Call(`_RcppCWB_id2str`, corpus, p_attribute, registry, id) |
110 | 161 | } |
111 | 162 |
|
112 | 163 | .cl_struc2str <- function(corpus, s_attribute, struc, registry) { |
113 | 164 | .Call(`_RcppCWB__cl_struc2str`, corpus, s_attribute, struc, registry) |
114 | 165 | } |
115 | 166 |
|
116 | | -.struc_to_str <- function(s_attr, struc) { |
117 | | - .Call(`_RcppCWB__struc_to_str`, s_attr, struc) |
| 167 | +#' @rdname cl_rework |
| 168 | +#' @export |
| 169 | +struc_to_str <- function(s_attr, struc) { |
| 170 | + .Call(`_RcppCWB_struc_to_str`, s_attr, struc) |
118 | 171 | } |
119 | 172 |
|
120 | 173 | .cl_regex2id <- function(corpus, p_attribute, regex, registry) { |
121 | 174 | .Call(`_RcppCWB__cl_regex2id`, corpus, p_attribute, regex, registry) |
122 | 175 | } |
123 | 176 |
|
124 | | -.regex_to_id <- function(p_attr, regex) { |
125 | | - .Call(`_RcppCWB__regex_to_id`, p_attr, regex) |
| 177 | +#' @param regex A regular expression. |
| 178 | +#' @rdname cl_rework |
| 179 | +#' @export |
| 180 | +regex_to_id <- function(p_attr, regex) { |
| 181 | + .Call(`_RcppCWB_regex_to_id`, p_attr, regex) |
126 | 182 | } |
127 | 183 |
|
128 | 184 | .cl_str2id <- function(corpus, p_attribute, str, registry) { |
129 | 185 | .Call(`_RcppCWB__cl_str2id`, corpus, p_attribute, str, registry) |
130 | 186 | } |
131 | 187 |
|
132 | | -.str_to_id <- function(p_attr, str) { |
133 | | - .Call(`_RcppCWB__str_to_id`, p_attr, str) |
| 188 | +#' @param str A `character` vector. |
| 189 | +#' @rdname cl_rework |
| 190 | +#' @export |
| 191 | +str_to_id <- function(p_attr, str) { |
| 192 | + .Call(`_RcppCWB_str_to_id`, p_attr, str) |
134 | 193 | } |
135 | 194 |
|
136 | 195 | .cl_id2freq <- function(corpus, p_attribute, id, registry) { |
137 | 196 | .Call(`_RcppCWB__cl_id2freq`, corpus, p_attribute, id, registry) |
138 | 197 | } |
139 | 198 |
|
140 | | -.id_to_freq <- function(p_attr, id) { |
141 | | - .Call(`_RcppCWB__id_to_freq`, p_attr, id) |
| 199 | +#' @param id An `integer` vector with token ids. |
| 200 | +#' @rdname cl_rework |
| 201 | +#' @export |
| 202 | +id_to_freq <- function(p_attr, id) { |
| 203 | + .Call(`_RcppCWB_id_to_freq`, p_attr, id) |
142 | 204 | } |
143 | 205 |
|
144 | 206 | .cl_id2cpos <- function(corpus, p_attribute, id, registry) { |
145 | 207 | .Call(`_RcppCWB__cl_id2cpos`, corpus, p_attribute, id, registry) |
146 | 208 | } |
147 | 209 |
|
148 | | -.id_to_cpos <- function(p_attr, id) { |
149 | | - .Call(`_RcppCWB__id_to_cpos`, p_attr, id) |
| 210 | +#' @rdname cl_rework |
| 211 | +#' @export |
| 212 | +id_to_cpos <- function(p_attr, id) { |
| 213 | + .Call(`_RcppCWB_id_to_cpos`, p_attr, id) |
150 | 214 | } |
151 | 215 |
|
152 | 216 | .cl_cpos2lbound <- function(corpus, s_attribute, cpos, registry) { |
153 | 217 | .Call(`_RcppCWB__cl_cpos2lbound`, corpus, s_attribute, cpos, registry) |
154 | 218 | } |
155 | 219 |
|
156 | | -.cpos_to_lbound <- function(s_attr, cpos) { |
157 | | - .Call(`_RcppCWB__cpos_to_lbound`, s_attr, cpos) |
| 220 | +#' @rdname cl_rework |
| 221 | +#' @export |
| 222 | +cpos_to_lbound <- function(s_attr, cpos) { |
| 223 | + .Call(`_RcppCWB_cpos_to_lbound`, s_attr, cpos) |
158 | 224 | } |
159 | 225 |
|
160 | 226 | .cl_cpos2rbound <- function(corpus, s_attribute, cpos, registry) { |
161 | 227 | .Call(`_RcppCWB__cl_cpos2rbound`, corpus, s_attribute, cpos, registry) |
162 | 228 | } |
163 | 229 |
|
164 | | -.cpos_to_rbound <- function(s_attr, cpos) { |
165 | | - .Call(`_RcppCWB__cpos_to_rbound`, s_attr, cpos) |
| 230 | +#' @rdname cl_rework |
| 231 | +#' @export |
| 232 | +cpos_to_rbound <- function(s_attr, cpos) { |
| 233 | + .Call(`_RcppCWB_cpos_to_rbound`, s_attr, cpos) |
166 | 234 | } |
167 | 235 |
|
168 | 236 | .cl_find_corpus <- function(corpus, registry) { |
|
0 commit comments