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/).
Corpus
dataclass
Source code in /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 123 124 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 |
|
categories()
Yields category dictionaries
Source code in /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
has_module(module)
Returns True if this corpus has module module
, else False
Source code in /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
84 85 86 |
|
concat_corpus(corpus, date, parallel=None)
Concatenate all the vrt files in a corpus, and store it in one file.
This function replaces what the compile_corpus.xsl script does.
Source code in /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
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 |
|
create_korp_settings(korp_corpus_config_dir, vrt_directory, corpus_name)
Create the Korp 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 /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
encode_corpus(vrt_directory, 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 /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
|
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 /home/anders/projects/CorpusTools/corpustools/compile_cwb_mono.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|