compile_cwb_mono
Take the "korp-ready" files in a "corpus-xxx/korp_mono" directory of a corpus, and create the binary CWB files (the files that are in data/ and registry/).
Category
dataclass
A category in a stage of a corpora. The category may exist in only the open, or the closed corpora, or both. corpus-xxx[-x-closed]/STAGE/CATEGORY
Source code in corpustools/compile_cwb_mono.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
directory(openorclosed)
The Path to the category directory in the open corpora.
Source code in corpustools/compile_cwb_mono.py
112 113 114 115 | |
Corp
dataclass
Source code in corpustools/compile_cwb_mono.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
categories(stage)
Get all categories for a stage, that is, the set of all subdirectories in both the open and closed corpora of this language. That would be all of these subdirectories: corpus-{self.lang}/{stage}/SUBDIR corpus-{self.lang}-x-closed/{stage}/SUBDIR
Source code in corpustools/compile_cwb_mono.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
Corpus
dataclass
Source code in corpustools/compile_cwb_mono.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
categories()
Yields category dictionaries
Source code in corpustools/compile_cwb_mono.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
has_module(module)
Returns True if this corpus has module module, else False
Source code in corpustools/compile_cwb_mono.py
221 222 223 | |
corpusname(lang, origs=False, openorclosed='open')
The name of a corpus directory for a given lang, whether or not it is origs, or open or closed.
Source code in corpustools/compile_cwb_mono.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
create_korp_settings(korp_config_dir, vrt_file)
Create the Korp backend corpus config-.yaml file that Korp needs, i.e. KORP_CORPUS_CONFIG_DIR/corpora/LANG_CATEGORY_DATE.yaml
Fill it with default values
Source code in corpustools/compile_cwb_mono.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
encode_corpus(vrt_file, date, lang, data_dir, registry_dir, cwb_binaries_directory)
Run the CWB tools on the given folder that contains .vrt files, to create the data/ and registry/ folder contents for a corpus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vrt_directory
|
Path
|
the output directory from the previous steps, that contains a .vrt file for a corpus. |
required |
date
|
date
|
The date that we created this corpus |
required |
lang
|
str
|
which language this corpus is in. 3-letter language code |
required |
cwb_binaries_directory
|
Path
|
path to where the CWB binaries are located |
required |
target_directory
|
Path
|
path to the directory where the final encoded corpus resides (the directory that has subfolders data/ and registry/) |
required |
Source code in corpustools/compile_cwb_mono.py
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | |
read_vrt_xml(vrt_file)
Read a (xml based) .vrt file, and return the number of sentences it contains, as well as the first and last date of the texts
Source code in corpustools/compile_cwb_mono.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |