twpipeline 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79331304e3921fe1d8dcbd3b47154688dfcbea28315e5e4f90a4f8c8cde3f2be
4
- data.tar.gz: f4d2e3acc42108b52edce6f74a98683f1fb27aeeaabee6a8adfb48a3a52fb0fd
3
+ metadata.gz: f24118623822939d57bdc8a7b515b1bb1139fbb6c102e67c718e077a95cba1fe
4
+ data.tar.gz: 622560ebd6a290848e1c16396891d4015770ee5d69e5c997022932ff61d66bf9
5
5
  SHA512:
6
- metadata.gz: bc121f3c3ec181db6939aaf78b758d17c50d3882eb1150a877988cd24576596d7387716fc358b0946a2d1a57e2817d4141ccbc080f915f274de4ee4daf2232a4
7
- data.tar.gz: e59bfc90d8989ca058e222f0d1f3bbcfb391644809bb7fadbb0bd867b438ba675098d057b43fdfa9cc98370c598596d7b97527e91891be03694a525d5ddabbe2
6
+ metadata.gz: 704f2157e61db5ba0bb92a16f0d5eb54b6db6d82a6318202970a9f4331912bfa22a8eaf4d96e0193c70f04f75642581784d3d89b851206054017739df2317010
7
+ data.tar.gz: 107eac81f38b2aabe71ec5d70bb59439b5d21a6c94e1c9e161bea8087d2996bb66cc3bf4490f9671e57a5d619230632729a56de72c6e0b36b80a0aba09ed5920
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 — 2026-12-07
4
+
5
+ - Requires twfilter 0.2. twfilter 0.2.0 removed `TWFilter::Checks::Erhua.tailed`; 0.1.0 called it
6
+ at startup and stopped with `NoMethodError`.
7
+ - The 0.1.0 entry and gem description claimed more than the code does: `07_dedup` counts
8
+ boilerplate types in its summary but flags no record; no stage computes
9
+ dispersion-corrected frequency (`TWPipeline::Frequency` is not called by any stage);
10
+ `03_segment` keeps only four document fields and `01_ingest` discards excluded and residue
11
+ documents, so `--drop` is not the only thing that removes data; `09_count` runs several
12
+ sorts at once, each bounded by `sort -S`, so its peak memory can exceed `--memory`. The
13
+ description now states what 0.1.1 does.
14
+
3
15
  ## 0.1.0 — 2026-08-03
4
16
 
5
17
  First release.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Den Patin
3
+ Copyright (c) 2026 Den Patin 丁丹旭 <hi@dpat.in>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,236 +1,389 @@
1
- # twpipeline
2
-
3
- Corpus construction for Taiwan Mandarin. Nine stages, one JSONL record contract,
4
- `stdin` → `stdout`. Every stage is independently runnable and independently
5
- verifiable. No record is ever discarded silently: rejection sets `ok: false` and
6
- appends a typed finding; `--drop` is what removes it.
7
-
8
- Linguistic decisions live in [twfilter](https://github.com/taiwan-corpora/twfilter); this repository is the
9
- execution layer — sources, parallelism, external sorting, measurement.
10
-
11
- For corpus linguists and dataset engineers who need Taiwan Mandarin
12
- (`cmn-Hant-TW`) material with verifiable provenance. In: a web crawl or any
13
- JSONL of documents. Out: filtered sentence types, word segmentation, n-gram and
14
- frequency tables with per-host counting and a publication floor — the process
15
- behind [twngrams](https://huggingface.co/datasets/taiwan-corpora/twngrams).
16
- Single machine, no cluster: the full HPLT Taiwan slice (2.0 M documents)
17
- builds in under two hours on a laptop.
18
-
19
- ## Pipeline
20
-
21
- ```mermaid
22
- flowchart TD
23
- subgraph acquire["acquisition"]
24
- S1["<b>01_ingest</b> — source adapter<br/>HPLT gate: <code>.tw</code> ∪ <code>html_lang ∈ zh-TW</code> ∪ allowlist<br/>hard exclusion: <code>.cn .hk .mo .sg .my</code><br/><code>--host-cap N</code> bounds per-host concentration"]
25
- end
26
-
27
- subgraph shape["orthographic normalization — mandatory for publishable text"]
28
- S2["<b>02_normalize</b> — MOE 《重訂標點符號手冊》<br/>“ ” → 「 」 · → ‧ … → …… — → ──<br/>fullwidth Latin → ASCII, invisibles stripped"]
29
- S3["<b>03_segment</b> — sentence boundaries<br/>terminators <code>[。!?…;]+[」』)》〉]*</code>, <code>、</code> is not a boundary<br/>shape: han ∈ [6, 60], han ratio ≥ 0.65"]
30
- end
31
-
32
- subgraph origin["origin filter — mandatory"]
33
- S4["<b>04_script</b> — character inventory<br/>MOE 常用 4 808 / 次常用 6 343 / 罕用 18 356 + 12 exceptions<br/>OpenCC STCharacters ∖ TSCharacters round-trip<br/>converted orthography 裏着衞爲説麽…"]
34
- S5["<b>05_lexicon</b> — lexical origin<br/>149 hard + 38 soft mainland pairs, corpus-verified<br/>written Cantonese, Hong Kong and Singapore forms, foreign-topic tag, erhua two-window rule<br/>literary-Chinese density > 0.05 with ≥ 2 hits and ≥ 8 han"]
35
- end
36
-
37
- subgraph corpus["corpus hygiene — optional, source-dependent"]
38
- S6["<b>06_evidence</b> — block judgment<br/>window 300 sentences; reject block if any member fails<br/>require ≥ 1.0 Taiwan evidence per 100 sentences"]
39
- S7["<b>07_dedup</b> — exact type dedup<br/>SHA-256 → 62-bit fingerprint<br/>flags types occurring on ≥ 5 distinct hosts as boilerplate"]
40
- end
41
-
42
- subgraph measure["measurement"]
43
- S8["<b>08_tokenize</b> — Viterbi over a unigram cost model<br/>EM re-estimation, max word length 8"]
44
- S9["<b>09_count</b> — n-gram counting by external sort<br/><code>sort -S … --parallel …</code> ∘ <code>uniq -c</code><br/>frequency floor for publication (Google Ngram rule)"]
45
- end
46
-
47
- S1 --> S2 --> S3 --> S4 --> S5 --> S6 --> S7 --> S8 --> S9
48
- S9 --> OUT["frequency, dispersion (DP),<br/>collocations (G², logDice)"]
49
-
50
- classDef must fill:#0b3d2e,stroke:#0b3d2e,color:#fff
51
- classDef may fill:#3d3a0b,stroke:#3d3a0b,color:#fff
52
- class S2,S3,S4,S5 must
53
- class S6,S7 may
54
- ```
55
-
56
- Green stages are mandatory for any Taiwan Mandarin corpus. Amber stages depend
57
- on the source: block judgment assumes documents are topically coherent, type
58
- deduplication assumes the source is web-scale.
1
+ # twpipeline · 臺灣華語語料庫建置流程
59
2
 
60
- ## Record contract
3
+ Corpus construction for Taiwanese Mandarin\* (臺灣華語, `cmn-Hant-TW`): nine stages that turn a
4
+ web crawl into checked, deduplicated, word-segmented sentences and n-gram count tables. Each stage
5
+ reads JSONL on `stdin` and writes JSONL on `stdout`. It built the
6
+ [twngrams](https://huggingface.co/datasets/taiwan-corpora/twngrams) dataset.
61
7
 
62
- One JSON object per line. Stages add fields; they never remove them.
8
+ 臺灣華語語料庫的建置流程:九個步驟,把網路爬蟲資料變成檢查過、去掉重複、斷好詞的句子,還有 n-gram
9
+ 次數表。每個步驟都從 `stdin` 讀 JSONL,再往 `stdout` 寫 JSONL。
10
+ [twngrams](https://huggingface.co/datasets/taiwan-corpora/twngrams) 資料集就是用它建出來的。
63
11
 
64
- | field | stage | meaning |
65
- | --- | --- | --- |
66
- | `id`, `source` | 01 | stable identity |
67
- | `url`, `host`, `gate` | 01 | provenance and the gate that admitted it |
68
- | `register`, `doc_score` | 01 | HPLT web-register argmax, mean segment score |
69
- | `text` | 01–02 | document text, then punctuation-normalized |
70
- | `doc`, `index`, `han` | 03 | parent document, ordinal, han count |
71
- | `tier` | 04 | 0 常用, 1 次常用, 2 罕用 |
72
- | `evidence` | 06 | Taiwan evidence count over the block |
73
- | `tokens` | 08 | word segmentation |
74
- | `ok`, `findings[]` | all | verdict and every reason for it |
12
+ **English** · [中文](#中文)
75
13
 
76
- A finding is `{check, code, severity, detail}` with `severity ∈ {reject, mark}`.
14
+ ## English
77
15
 
78
- ## Install
16
+ The language checks (character inventory, lexical origin, punctuation, sentence shape, Taiwan
17
+ evidence) come from [twfilter](https://github.com/taiwan-corpora/twfilter). twpipeline does the
18
+ rest: it reads the source, runs the checks in parallel, removes repeated sentences, segments words
19
+ and counts n-grams by external sort. One machine, no cluster, no database.
79
20
 
80
- Ruby ≥ 3.4. The only runtime dependency is
81
- [twfilter](https://rubygems.org/gems/twfilter), pulled from RubyGems:
21
+ ### Install
82
22
 
83
23
  ```bash
84
- bundle install
85
- bin/twpipeline stages
24
+ gem install twpipeline
86
25
  ```
87
26
 
88
- External sorting uses `gsort` (GNU coreutils) when installed and the system
89
- `sort` otherwise; both understand `-S` and `--parallel`. Override with
90
- `TWP_SORT`.
27
+ Ruby 3.4 or later. Runtime dependencies: twfilter 0.2 and fiddle. External
28
+ programs: `sort`, `uniq`, `sed`, `awk` and `cut` for counting, `zstd` for `.zst` input.
29
+ `09_count` uses GNU `gsort` when it is on the `PATH` and the system `sort` otherwise; `TWP_SORT`
30
+ names another.
31
+
32
+ ### Stages
33
+
34
+ | stage | does | adds |
35
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `01_ingest` | Reads HPLT documents and keeps those that pass the [source gate](#source-gate-hplt) | `id`, `source`, `url`, `host`, `gate`, `crawl`, `html_lang`, `lang`, `lang_prob`, `doc_score`, `register`, `text`, `ok`, `findings` |
37
+ | `02_normalize` | Normalizes punctuation to the Ministry of Education's 《重訂標點符號手冊》 | `normalized` |
38
+ | `03_segment` | Splits each document into sentences and checks their shape: Han character count and share | one record per sentence: `id` (`<document>#<n>`), `doc`, `index`, `han` |
39
+ | `04_script` | Checks characters: simplified, outside the Ministry's charts, or forms that conversion from simplified produces and Taiwan does not use (裏, 着, 爲) | `tier` |
40
+ | `05_lexicon` | Checks vocabulary: words of China and other regions, written Cantonese, erhua, literary Chinese | — |
41
+ | `06_evidence` | Judges blocks of up to 300 consecutive sentences of one document | `evidence` |
42
+ | `07_dedup` | Keeps the first occurrence of each exact sentence | — |
43
+ | `08_tokenize` | Segments words by Viterbi over a unigram cost model | `tokens` |
44
+ | `09_count` | Counts n-grams of tokens or characters by external sort | TSV tables |
45
+
46
+ **06_evidence.** A block fails as a whole: with `contaminated_block` when any of its sentences
47
+ was already rejected, with `no_taiwan_evidence` when it has fewer than one Taiwan evidence hit
48
+ (`TWFilter::Evidence`) per 100 sentences. Blocks follow the `doc` field (`--group`) and hold at
49
+ most `--block` sentences (default 300). Rejected sentences reach this stage only if the earlier
50
+ stages ran without `--drop`.
51
+
52
+ **07_dedup.** The fingerprint is SHA-256 of the text, cut to 62 bits. Later copies get the
53
+ finding `duplicate`. The summary line also counts the sentence types seen on `--ubiquity` or more
54
+ hosts (default 5); those records are not marked.
55
+
56
+ **08_tokenize.** Needs a vocabulary: `--vocabulary` or `TWP_VOCABULARY` names a JSON file whose
57
+ `words` key holds a list of words or an object keyed by word. Before segmenting, the stage
58
+ estimates word and character costs from the first 200,000 input lines in two rounds of
59
+ re-segmentation. Words are at most 8 characters long; any single character can stand alone. Only
60
+ runs of Han characters in U+3400–U+9FFF are segmented; everything else, punctuation included, is
61
+ left out of `tokens`.
62
+
63
+ **09_count.** Writes one `<unit>_<n>gram.tsv` per order in `--orders` (default `1,2,3,4`) to
64
+ `--out` (default `$TWP_WORK/counts`). Each row is `count<TAB>n-gram`, most frequent first; rows
65
+ below `--floor` (default 1) are left out. Token n-grams are joined with a space. `--unit char`
66
+ counts the characters of `text` instead of `tokens`. `--once-per host` counts each n-gram once
67
+ per distinct `host` (falling back to `doc`, then `id`) instead of once per occurrence.
68
+ `--parts FIELD` writes `count<TAB>n-gram<TAB>part` rows instead, with the floor applied to each
69
+ part's count. The stage prints one summary line on `stdout`.
70
+
71
+ ### Records
72
+
73
+ One JSON object per line. A finding is `{check, code, severity, detail}` with `severity` either
74
+ `reject` or `mark`; one `reject` sets `ok: false`. Stages add fields and remove none, with one
75
+ exception: `03_segment` turns each document into sentence records that keep only `source`,
76
+ `host`, `gate` and `register` from the document.
77
+
78
+ Rejected records stay in the stream with `ok: false`; `--drop` removes them as the stage writes.
79
+ `01_ingest` is the exception: it discards excluded hosts, residue (unless `--residue` names a
80
+ file for it) and documents past `--host-cap`.
81
+
82
+ `07_dedup`, `08_tokenize` and `09_count` do not read `ok`: a rejected record counts as seen, gets
83
+ tokens and is counted. Remove rejected records before these stages, as the commands below do.
84
+
85
+ ### Usage
86
+
87
+ The twngrams tables were built in three steps:
88
+
89
+ ```bash
90
+ twpipeline 01_ingest --input cmn_Hant/7_1.jsonl.zst --residue residue.jsonl > kept.jsonl
91
+ twpipeline run --from 02_normalize --to 07_dedup --drop --out staged < kept.jsonl
92
+ twpipeline run --from 08_tokenize --to 09_count --vocabulary vocabulary.json \
93
+ --orders 1,2,3,4 --floor 40 --once-per host --out ngrams < staged/07_dedup.jsonl
94
+ ```
91
95
 
92
- ## Usage
96
+ `run` executes the stages from `--from` to `--to` (default: all nine) in order, reads the first
97
+ stage's input from `stdin` and writes each stage's output to `<out>/<stage>.jsonl` (default
98
+ `$TWP_WORK/run`). Within `run`, `--out` is also the directory of the count tables. Staged runs
99
+ are faster than a shell pipe of stages, where every stage waits for the slowest one.
93
100
 
94
101
  ```bash
95
- twpipeline run --source hplt --input cmn_Hant/7_1.jsonl.zst --cores 16 --memory 8G
96
- cat raw.jsonl | twpipeline 04_script | twpipeline 05_lexicon > checked.jsonl
102
+ twpipeline 04_script < sentences.jsonl | twpipeline lexicon > checked.jsonl
97
103
  echo '這個政策有沒有經過評估?' | twpipeline check
98
- twpipeline run --from 03_segment --to 07_dedup --drop --policy publishable
99
- twpipeline resources
100
104
  twpipeline stages
105
+ twpipeline resources --cores 8 --memory 16G
101
106
  ```
102
107
 
103
- `--policy corpus` (default) keeps everything Taiwan-attested. `--policy
104
- publishable` restricts to MOE 常用 4 808, rejects soft mainland markers, and
105
- enforces the strict MOE punctuation inventory — the boundary of what may reach a
106
- commercial learner product.
107
-
108
- ## Resources
109
-
110
- Cores and memory are read from `--cores` / `--memory`, then `TWP_CORES` /
111
- `TWP_MEMORY`, then autodetection (all cores, half of physical memory).
112
- `--ask` prompts interactively.
113
-
114
- Streaming stages fork `cores` workers per chunk; chunk size is bounded by bytes
115
- (`memory / 32`, capped at 1 GiB, overridable with `TWP_CHUNK_BYTES`), not by
116
- line count, so a source of 12 KiB documents and a source of 40-byte sentences
117
- both stay within the same envelope. Counting never holds a hash table: keys go
118
- through `sort -S <memory> --parallel <cores>`, so peak resident size is set by
119
- the flag, not by the corpus.
120
-
121
- Every stage writes one line to `work/benchmarks.jsonl` — wall time, CPU seconds,
122
- mean cores used, peak RSS, and the stage's own counters. The work directory
123
- defaults to `../work` beside the checkout; override with `TWP_WORK`. See
124
- [BENCHMARKS.md](BENCHMARKS.md).
125
-
126
- ## Findings
127
-
128
- Measured on HPLT 3.0 `cmn_Hant`, quality bins 7–10 (4 116 754 documents). The
129
- admission gate kept 2 001 161 documents: 541 467 by `.tw` host, 1 459 694 by
130
- `html_lang`. All of them were carried through stages 02–07 in 28 minutes
131
- (twfilter 0.1.0, the published tables):
132
-
133
- | stage | in | out | lost |
134
- | --- | ---: | ---: | ---: |
135
- | 03_segment | 2 001 161 docs | 37 772 352 sentences | — |
136
- | 04_script | 37 772 352 | 37 122 017 | 1.72 % |
137
- | 05_lexicon | 37 122 017 | 36 455 533 | 1.80 % |
138
- | 06_evidence | 36 455 533 | 29 089 952 | 20.20 % |
139
- | 07_dedup | 29 089 952 | **12 339 761 types** | **57.58 %** |
140
-
141
- Three results worth stating plainly.
142
-
143
- **Deduplication dominates every linguistic filter.** More than half of all
144
- segmented sentences are exact repeats of another sentence — an order of magnitude
145
- more than the three origin filters remove between them. HPLT deduplicates
146
- documents, not sentences, and the Taiwanese long tail is largely search-optimized
147
- loan and hotel templates. Without stage 07 an n-gram table over this material
148
- measures template frequency, not language.
149
-
150
- A stratified 279 198-document sample drawn from the head of each bin file put
151
- duplication at 71.0 % and evidence loss at 5.6 %; the true figures are 57.6 % and
152
- 20.2 %. Documents cluster by host inside a bin file, so a head sample overstates
153
- local repetition and understates topical variety. Sample to find the shape of a
154
- problem; measure on everything before publishing a number.
155
-
156
- **The two gates differ, but less than a head sample suggests.** Unique
157
- Taiwan-attested types produced per admitted document:
158
-
159
- | gate | documents | unique types | types per document |
160
- | --- | ---: | ---: | ---: |
161
- | `.tw` host | 541 467 | 4 230 061 | **7.81** |
162
- | `html_lang` on a generic TLD | 1 459 694 | 8 109 700 | **5.56** |
163
-
164
- A 1.41× gradient, not the 2.4× the sample showed. The `html_lang` gate supplies
165
- 65.7 % of the final corpus at about two thirds of the per-document yield — worth keeping,
166
- not worth trusting blindly. The `gate` field is preserved on every record, so
167
- restricting to `.tw` afterwards costs nothing and remains available as a
168
- higher-precision subset.
169
-
170
- **Boilerplate is sub-sentential, so no amount of sentence deduplication removes
171
- it.** The phrase 提供相關細節的諮詢服務 occurs 263 210 times in the deduplicated
172
- corpus, inside 263 210 *distinct* sentences, across 222 900 documents — but only
173
- **1 948 hosts**. Sentence dedup cannot see it (every string differs), per-document
174
- counting cannot see it (every document differs), and `--host-cap` cannot see it
175
- (the network spans 11 691 throwaway domains, none of them large). 貸款 comes out
176
- as the 7th most frequent word in Taiwan Mandarin, which is false.
177
-
178
- The fix is to change what a count means. `--once-per host` counts each n-gram
179
- once per host instead of once per occurrence, so a frequency list measures *how
180
- many independent sites use a phrase* rather than *how many times a template was
181
- published*. On the phrase above that is a 135-fold correction. For web-derived
182
- frequency this is the correct semantics regardless of spam: a generated page is
183
- not an independent act of authorship.
184
-
185
- Occurrence counting remains the default, because for an edited corpus — statutes,
186
- news, dictionaries — repetition is evidence rather than noise.
187
-
188
- Measured effect on the full corpus. 貸款 falls from rank 7 to rank **1 299**;
189
- 借錢, 包養, 二胎 and 信貸 drop below the 40-host floor and disappear entirely. The
190
- 1-gram list becomes 的 是 有 一 在 了 我 會 也 要 不 個, the 4-gram list 越來越多,
191
- 這是一個, 最重要的是, 更重要的是. In the run where both semantics were built,
192
- published rows fell by 7 % at order 1 and 28 % at order 4.
193
-
194
- **Known residual.** Eleven of the top hundred 4-grams are fragments of one
195
- string: `讓人們盡情分享,將這個世界變得更開闊,聯繫更緊密` — the Chinese Facebook
196
- tagline, carried by the social-plugin embed on roughly 3 900 hosts, about once
197
- per host, so per-host counting cannot suppress it: those hosts really are
198
- independent. This is third-party embedded interface text, a
199
- different problem from spam, and it needs either HTML-level boilerplate stripping
200
- upstream or an explicit stoplist. It contaminates 0.03 % of sentences but a
201
- visible share of the 4-gram head.
202
-
203
- The surviving corpus spans 149 022 hosts: top 10 hold 8.8 % of sentences, top 100
204
- 20.8 %, top 1000 46.3 %, top 10 000 82.8 %. Diffuse enough to be a corpus rather
205
- than a scrape of a few sites, but the single largest host is `chinatimes.com` at
206
- 411 005 sentences — 3.3 % of everything, one newspaper. Concentration of one
207
- rightsholder's expression, not total size, is what has drawn takedowns against
208
- comparable datasets; cap per host before publishing anything that carries text.
209
-
210
- ## Layout
211
-
212
- ```text
213
- lib/twpipeline/
214
- resources.rb cores and memory resolution
215
- parallel.rb fork-based map, byte-bounded streaming
216
- sorting.rb external sort, tally with a frequency floor
217
- jsonl.rb record contract
218
- bench.rb measurement, appended to work/benchmarks.jsonl
219
- rusage.rb getrusage(2) via Fiddle
220
- segmenter.rb Viterbi, EM re-estimation
221
- frequency.rb deviation of proportions
222
- stage.rb Stage, MapStage, registry
223
- stages/ the nine stages
224
- sources/ source adapters
225
- tools/
226
- regression.rb twfilter against every reference corpus
108
+ A stage can be named without its number (`lexicon` is `05_lexicon`). `check` normalizes the
109
+ punctuation of each input line, runs every twfilter check on it and prints the report as JSON.
110
+
111
+ `--policy` sets the twfilter policy for `03_segment` to `06_evidence` and `check`:
112
+
113
+ - `corpus` (default): sentences of 6–60 Han characters, at least 65 % of them Han;
114
+ - `publishable`: 6–40 Han characters, at least 70 % Han, only the 4,808 characters of the
115
+ 常用 chart, strict punctuation, and soft lexical markers and foreign topics rejected;
116
+ - `permissive`: no shape limits.
117
+
118
+ | option | stages | meaning |
119
+ | --------------------------------------------------------------------------------------- | -------------- | ---------------------------------------------------------------------- |
120
+ | `--cores N`, `--memory SIZE`, `--ask` | all | [resources](#resources) |
121
+ | `--policy NAME` | 03–06, `check` | `corpus`, `publishable` or `permissive` |
122
+ | `--drop` | 02–08 | remove rejected records instead of marking them |
123
+ | `--source NAME` | 01 | source adapter; `hplt` is the only one |
124
+ | `--input PATH` | 01 | read this file instead of `stdin`; `.zst` is read through `zstd -dc` |
125
+ | `--residue PATH` | 01 | write the documents that failed the gate to this file |
126
+ | `--allowlist PATH` | 01 | hosts admitted by name, one per line |
127
+ | `--host-cap N` | 01 | at most N documents per host, counted in input order, residue included |
128
+ | `--group FIELD`, `--block N` | 06 | block key (default `doc`) and size (default 300) |
129
+ | `--ubiquity N` | 07 | host count that makes a type boilerplate in the summary (default 5) |
130
+ | `--vocabulary PATH` | 08 | segmentation vocabulary (required) |
131
+ | `--orders LIST`, `--unit token\|char`, `--floor N`, `--once-per FIELD`, `--parts FIELD` | 09 | see [09_count](#stages) |
132
+ | `--out PATH` | `run`, 09 | output directory |
133
+ | `--from STAGE`, `--to STAGE` | `run` | first and last stage |
134
+ | `--quiet` | all | no measurement line on `stderr` |
135
+
136
+ ### Source gate (HPLT)
137
+
138
+ `01_ingest` reads HPLT JSONL. The host is the hostname of the `u` field without a leading `www.`.
139
+ The first rule that matches decides:
140
+
141
+ 1. no host, or a host under `.cn`, `.hk`, `.mo`, `.sg` or `.my`: discarded;
142
+ 2. a host under `.tw`: kept, `gate: "tld"`;
143
+ 3. a host listed in the `--allowlist` file: kept, `gate: "allowlist"`;
144
+ 4. an `html_lang` tag `zh-TW` or `zh-Hant-TW`, in any case: kept, `gate: "html_lang"`
145
+ (`zh_TW` and plain `zh-Hant` do not match);
146
+ 5. anything else: residue, `gate: "residue"`.
147
+
148
+ `register` is the HPLT web-register label with the highest score, `doc_score` the mean of
149
+ `doc_scores`. `data/hplt/taiwan_domains.txt` is an empty allowlist.
150
+ `data/hplt/taiwan_domains.candidates.txt` lists 300 hosts that passed automatic checks and were
151
+ left out, most of them localized product pages of international vendors;
152
+ [data/hplt/README.md](data/hplt/README.md) explains how they were chosen.
153
+
154
+ ### Resources
155
+
156
+ Cores and memory come from `--cores` and `--memory` (`512M`, `8G`, …), then `TWP_CORES` and
157
+ `TWP_MEMORY`, then the machine: all cores and half of physical memory. `--ask` prompts for both;
158
+ `twpipeline resources` prints the result.
159
+
160
+ Stages 02–05 and 08 read their input in chunks of `memory / 32` bytes (at most 1 GiB; override
161
+ with `TWP_CHUNK_BYTES`) and fork one worker per core for each chunk; output keeps the input
162
+ order. `06_evidence` forks per 20,000 blocks. `01_ingest`, `07_dedup` and `09_count` run in one
163
+ process; `07_dedup` keeps a fingerprint and up to `--ubiquity` hosts per sentence type in memory.
164
+
165
+ `09_count` runs `sort` with `LC_ALL=C`, `-S` at 80 % of `--memory`, `--parallel` at `--cores`
166
+ and temporary files in `$TWP_WORK/tmp`. It runs one sort pipeline per order at the same time,
167
+ each with two sorts, so its peak memory can reach several times `--memory`: give this stage a
168
+ smaller `--memory`, or count one order at a time.
169
+
170
+ Every stage appends one JSON line to `$TWP_WORK/benchmarks.jsonl` (or `TWP_BENCHMARKS`): wall
171
+ time, CPU seconds, mean cores used, peak resident size and the stage's own counters. The same
172
+ line goes to `stderr` unless `--quiet`. Peak resident size comes from `getrusage(2)`: the
173
+ process's own high-water mark since it started plus that of its largest child.
174
+
175
+ `TWP_WORK` defaults to a `work` directory beside the twpipeline directory, which for an installed
176
+ gem is inside the gem repository. Set it.
177
+
178
+ ### Counting once per host
179
+
180
+ Web text repeats templates below the sentence level, so a phrase can recur in thousands of
181
+ sentences that all differ and that deduplication keeps. `--once-per host` counts how many sites
182
+ use an n-gram, not how many times it was published. In the twngrams build it moved 貸款 from
183
+ rank 7 to rank 1,299 among single words (see the
184
+ [dataset card](https://huggingface.co/datasets/taiwan-corpora/twngrams)). Occurrence counting
185
+ stays the default: in edited text such as statutes or news, repetition is evidence.
186
+
187
+ ### Development
188
+
189
+ ```bash
190
+ bundle install
191
+ bundle exec rake
227
192
  ```
228
193
 
229
- ## Tests
194
+ Runs RSpec and `rbs -I sig validate`. The specs carry no corpus data; the counting specs need
195
+ `sort`.
196
+
197
+ Developed and maintained in Taipei, Taiwan by Den Patin 丁丹旭 (<hi@dpat.in>), independent researcher, linguist and software engineer.
198
+
199
+ ### License
200
+
201
+ MIT; see [LICENSE](LICENSE).
202
+
203
+ ## 中文
204
+
205
+ 用字、詞彙來源、標點、句子形狀跟臺灣特徵詞這些語言判斷,都交給
206
+ [twfilter](https://github.com/taiwan-corpora/twfilter)。twpipeline 負責其他的工作:讀來源資料、平行
207
+ 執行這些檢查、去掉重複的句子、斷詞,再用外部排序算 n-gram 的次數。一台機器就能跑,不需要叢集,也不用
208
+ 資料庫。
209
+
210
+ ### 安裝
230
211
 
231
212
  ```bash
213
+ gem install twpipeline
214
+ ```
215
+
216
+ 需要 Ruby 3.4 以上。相依套件是 twfilter 0.2 跟 fiddle。另外會用到幾個外部程式:計數要
217
+ `sort`、`uniq`、`sed`、`awk`、`cut`,讀 `.zst` 檔要 `zstd`。`09_count` 在 `PATH` 裡找得到 GNU 的
218
+ `gsort` 就用它,找不到就用系統的 `sort`;也可以用 `TWP_SORT` 指定別的程式。
219
+
220
+ ### 九個步驟
221
+
222
+ | 步驟 | 做什麼 | 新增的欄位 |
223
+ | -------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
224
+ | `01_ingest` | 讀 HPLT 文件,只留下通過[來源篩選](#來源篩選hplt)的 | `id`、`source`、`url`、`host`、`gate`、`crawl`、`html_lang`、`lang`、`lang_prob`、`doc_score`、`register`、`text`、`ok`、`findings` |
225
+ | `02_normalize` | 照教育部《重訂標點符號手冊》統一標點 | `normalized` |
226
+ | `03_segment` | 把文件切成句子,檢查句子的形狀:漢字數跟漢字比例 | 一個句子一筆紀錄:`id`(`<文件>#<n>`)、`doc`、`index`、`han` |
227
+ | `04_script` | 檢查用字:簡體字、教育部字表以外的字,還有簡轉繁常出現、臺灣不用的寫法(裏、着、爲) | `tier` |
228
+ | `05_lexicon` | 檢查用詞:中國跟其他地區的用語、粵語書面語、兒化、文言 | — |
229
+ | `06_evidence` | 把同一篇文件裡最多 300 個連續的句子當成一個區塊來判斷 | `evidence` |
230
+ | `07_dedup` | 完全相同的句子只留第一次出現的 | — |
231
+ | `08_tokenize` | 用 unigram 成本模型跟 Viterbi 演算法斷詞 | `tokens` |
232
+ | `09_count` | 用外部排序算詞或字的 n-gram 次數 | TSV 表 |
233
+
234
+ **06_evidence**:區塊是整個一起過或一起不過。區塊裡只要有一個句子已經被判不合格,整個區塊就是
235
+ `contaminated_block`;每 100 個句子找不到 1 個臺灣特徵詞(`TWFilter::Evidence`),就是
236
+ `no_taiwan_evidence`。區塊依 `doc` 欄位來分(`--group`),最多 `--block` 個句子(預設 300)。前面的
237
+ 步驟要是用了 `--drop`,不合格的句子早就拿掉了,這一步就看不到。
238
+
239
+ **07_dedup**:指紋是句子的 SHA-256 取 62 位元。後面再出現的相同句子會加上 `duplicate`。摘要那一行
240
+ 也會算出有幾種句子出現在 `--ubiquity` 個以上(預設 5 個)不同的網站,但不會在這些紀錄上做記號。
241
+
242
+ **08_tokenize**:要先準備詞表。用 `--vocabulary` 或 `TWP_VOCABULARY` 指定一個 JSON 檔,裡面的
243
+ `words` 可以是詞的陣列,也可以是用詞當鍵的物件。斷詞前,會先拿輸入的前 200,000 行重新斷兩輪,估出每個
244
+ 詞跟每個字的成本。詞最長 8 個字,任何一個字都可以自己成詞。只有 U+3400–U+9FFF 範圍裡連續的漢字會拿去
245
+ 斷詞,其他東西(包括標點)都不會出現在 `tokens` 裡。
246
+
247
+ **09_count**:`--orders`(預設 `1,2,3,4`)的每一個長度各寫一個 `<unit>_<n>gram.tsv` 到 `--out`
248
+ (預設 `$TWP_WORK/counts`)。每一行是 `次數<TAB>n-gram`,次數多的排前面,低於 `--floor`(預設 1)的
249
+ 不寫。詞的 n-gram 用空格連起來。`--unit char` 改算 `text` 裡的字,不算 `tokens`。`--once-per host`
250
+ 讓每個 n-gram 在同一個 `host` 只算一次(沒有這個欄位就看 `doc`,再沒有就看 `id`),而不是出現幾次算幾
251
+ 次。`--parts FIELD` 會改寫成 `次數<TAB>n-gram<TAB>分組` 的格式,門檻套用在每個分組自己的次數上。這一步
252
+ 在 `stdout` 只輸出一行摘要。
253
+
254
+ ### 紀錄格式
255
+
256
+ 每行一個 JSON 物件。finding 的格式是 `{check, code, severity, detail}`,`severity` 是 `reject` 或
257
+ `mark`;只要有一個 `reject`,`ok` 就是 `false`。每個步驟都只加欄位、不刪欄位,只有一個例外:
258
+ `03_segment` 把一篇文件拆成好幾筆句子紀錄,從文件只帶過來 `source`、`host`、`gate` 跟 `register`。
259
+
260
+ 不合格的紀錄會留在資料裡,標成 `ok: false`;加上 `--drop`,那一步寫出資料時就直接拿掉。`01_ingest`
261
+ 例外:被排除的網域、沒通過篩選的文件(除非用 `--residue` 另外存一個檔),還有超過 `--host-cap` 的文
262
+ 件,都會直接丟掉。
263
+
264
+ `07_dedup`、`08_tokenize` 跟 `09_count` 不看 `ok`:不合格的紀錄一樣算「看過」、一樣斷詞、一樣算進次
265
+ 數。所以在跑這三步以前,要先把不合格的紀錄拿掉,像下面的指令這樣。
266
+
267
+ ### 用法
268
+
269
+ twngrams 的次數表是分三段建出來的:
270
+
271
+ ```bash
272
+ twpipeline 01_ingest --input cmn_Hant/7_1.jsonl.zst --residue residue.jsonl > kept.jsonl
273
+ twpipeline run --from 02_normalize --to 07_dedup --drop --out staged < kept.jsonl
274
+ twpipeline run --from 08_tokenize --to 09_count --vocabulary vocabulary.json \
275
+ --orders 1,2,3,4 --floor 40 --once-per host --out ngrams < staged/07_dedup.jsonl
276
+ ```
277
+
278
+ `run` 會依序執行 `--from` 到 `--to` 的步驟(預設九個全跑),第一步從 `stdin` 讀,每一步的輸出寫到
279
+ `<out>/<步驟>.jsonl`(預設 `$TWP_WORK/run`)。在 `run` 裡,次數表也寫到 `--out` 這個目錄。這樣分段跑
280
+ 比用 shell 管線把步驟串起來快,因為串起來的話,每一步都要等最慢的那一步。
281
+
282
+ ```bash
283
+ twpipeline 04_script < sentences.jsonl | twpipeline lexicon > checked.jsonl
284
+ echo '這個政策有沒有經過評估?' | twpipeline check
285
+ twpipeline stages
286
+ twpipeline resources --cores 8 --memory 16G
287
+ ```
288
+
289
+ 步驟名稱可以不寫編號(`lexicon` 就是 `05_lexicon`)。`check` 會先統一每一行的標點,再跑 twfilter 的
290
+ 全部檢查,把結果用 JSON 印出來。
291
+
292
+ `--policy` 設定 `03_segment` 到 `06_evidence` 跟 `check` 用的 twfilter 標準:
293
+
294
+ - `corpus`(預設):句子有 6–60 個漢字,漢字至少占 65 %;
295
+ - `publishable`:6–40 個漢字,漢字至少占 70 %,只能用常用字表的 4,808 個字,標點要完全合乎規範,
296
+ 另外也會把有爭議的詞跟外地主題判成不合格;
297
+ - `permissive`:不限制句子形狀。
298
+
299
+ | 選項 | 步驟 | 說明 |
300
+ | --------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------------- |
301
+ | `--cores N`、`--memory SIZE`、`--ask` | 全部 | 見[運算資源](#運算資源) |
302
+ | `--policy NAME` | 03–06、`check` | `corpus`、`publishable` 或 `permissive` |
303
+ | `--drop` | 02–08 | 直接拿掉不合格的紀錄,不只做記號 |
304
+ | `--source NAME` | 01 | 來源轉接器;目前只有 `hplt` |
305
+ | `--input PATH` | 01 | 改讀這個檔,不讀 `stdin`;`.zst` 會透過 `zstd -dc` 讀 |
306
+ | `--residue PATH` | 01 | 沒通過篩選的文件寫到這個檔 |
307
+ | `--allowlist PATH` | 01 | 直接放行的網站,一行一個 |
308
+ | `--host-cap N` | 01 | 每個網站最多 N 篇,依輸入順序計算,沒通過篩選的也算 |
309
+ | `--group FIELD`、`--block N` | 06 | 區塊依哪個欄位分(預設 `doc`)跟區塊大小(預設 300) |
310
+ | `--ubiquity N` | 07 | 摘要裡出現在幾個網站以上就算樣板句(預設 5) |
311
+ | `--vocabulary PATH` | 08 | 斷詞用的詞表(必填) |
312
+ | `--orders LIST`、`--unit token\|char`、`--floor N`、`--once-per FIELD`、`--parts FIELD` | 09 | 見 [09_count](#九個步驟) |
313
+ | `--out PATH` | `run`、09 | 輸出目錄 |
314
+ | `--from STAGE`、`--to STAGE` | `run` | 第一步跟最後一步 |
315
+ | `--quiet` | 全部 | 不在 `stderr` 輸出量測結果 |
316
+
317
+ ### 來源篩選(HPLT)
318
+
319
+ `01_ingest` 讀 HPLT 的 JSONL。網站(host)取 `u` 欄位網址的主機名稱,去掉開頭的 `www.`。由上往下,
320
+ 第一條符合的規則決定結果:
321
+
322
+ 1. 沒有主機名稱,或是 `.cn`、`.hk`、`.mo`、`.sg`、`.my` 底下的網站:丟掉;
323
+ 2. `.tw` 底下的網站:留下,`gate: "tld"`;
324
+ 3. 列在 `--allowlist` 檔裡的網站:留下,`gate: "allowlist"`;
325
+ 4. `html_lang` 有 `zh-TW` 或 `zh-Hant-TW`(不分大小寫):留下,`gate: "html_lang"`(`zh_TW` 跟單獨的
326
+ `zh-Hant` 不算);
327
+ 5. 其他:沒通過篩選,`gate: "residue"`。
328
+
329
+ `register` 是 HPLT 網頁類型分數最高的標籤,`doc_score` 是 `doc_scores` 的平均。
330
+ `data/hplt/taiwan_domains.txt` 是空的放行清單。`data/hplt/taiwan_domains.candidates.txt` 列了 300 個
331
+ 通過自動檢查、但最後沒有採用的網站,大多是國際廠商的在地化產品頁;怎麼挑出來的,寫在
332
+ [data/hplt/README.md](data/hplt/README.md)。
333
+
334
+ ### 運算資源
335
+
336
+ 核心數跟記憶體依序看 `--cores`、`--memory`(`512M`、`8G`……),再看 `TWP_CORES`、`TWP_MEMORY`,都沒
337
+ 有就用整台機器:全部的核心、一半的實體記憶體。`--ask` 會互動詢問這兩個值;`twpipeline resources` 會印
338
+ 出最後的設定。
339
+
340
+ 02–05 跟 08 這幾步會把輸入切成每塊 `memory / 32` 位元組(最多 1 GiB,可以用 `TWP_CHUNK_BYTES` 改),
341
+ 每一塊都 fork 出跟核心數一樣多的 worker 來處理;輸出順序跟輸入一樣。`06_evidence` 每 20,000 個區塊
342
+ fork 一次。`01_ingest`、`07_dedup` 跟 `09_count` 都在單一行程裡跑;`07_dedup` 會在記憶體裡替每一種句子
343
+ 記一個指紋,跟最多 `--ubiquity` 個網站。
344
+
345
+ `09_count` 執行 `sort` 時用 `LC_ALL=C`,`-S` 設成 `--memory` 的 80 %,`--parallel` 設成 `--cores`,
346
+ 暫存檔放在 `$TWP_WORK/tmp`。每個 n-gram 長度各有一條排序管線同時在跑,每條裡有兩個 `sort`,所以這一步
347
+ 用到的記憶體可能是 `--memory` 的好幾倍:跑這一步時把 `--memory` 設小一點,或是一次只算一個長度。
348
+
349
+ 每一步都會在 `$TWP_WORK/benchmarks.jsonl`(或 `TWP_BENCHMARKS`)加一行 JSON:實際耗時、CPU 秒數、平均
350
+ 用了幾個核心、記憶體用量高峰,還有這一步自己的計數。沒加 `--quiet` 的話,同一行也會印到 `stderr`。記
351
+ 憶體高峰來自 `getrusage(2)`:是這個行程從啟動以來自己的最高值,加上用量最大的子行程的最高值。
352
+
353
+ `TWP_WORK` 預設是 twpipeline 目錄旁邊的 `work` 目錄;如果是裝好的 gem,這個位置會在 gem 的安裝目錄裡。
354
+ 請自己設定。
355
+
356
+ ### 每個網站只算一次
357
+
358
+ 網路文字的樣板常常比一句話還短,同一個片語可能出現在幾千個彼此都不一樣的句子裡,去掉重複也拿不掉。
359
+ `--once-per host` 算的是有幾個網站用了這個 n-gram,不是它被發布了幾次。在 twngrams 裡,「貸款」在單詞
360
+ 排名從第 7 名掉到第 1,299 名(見[資料集說明](https://huggingface.co/datasets/taiwan-corpora/twngrams))。
361
+ 預設還是照出現次數算:法規、新聞這類編輯過的文字,重複出現本身就是證據。
362
+
363
+ ### 開發
364
+
365
+ ```bash
366
+ bundle install
232
367
  bundle exec rake
233
368
  ```
234
369
 
235
- RSpec suite plus RBS signature validation. Fixtures carry no corpus material;
236
- the suite needs no data and no credentials.
370
+ 會跑 RSpec 跟 `rbs -I sig validate`。測試不含任何語料;計數的測試需要 `sort`。
371
+
372
+ 由 Den Patin 丁丹旭(<hi@dpat.in>)在臺灣臺北開發與維護。獨立研究者,做語言學跟軟體工程。
373
+
374
+ ### 授權條款
375
+
376
+ MIT,詳見 [LICENSE](LICENSE)。
377
+
378
+ \* _Taiwanese Mandarin_ (臺灣華語; BCP 47 `cmn-Hant-TW`) denotes the variety of
379
+ Mandarin in general use in Taiwan, as produced by its native and near-native
380
+ speakers, together with the lexical, phonological and morphosyntactic properties
381
+ that distinguish it from the codified standard of the ROC Ministry of Education
382
+ (標準國語, Standard Guoyu) and from PRC Putonghua (普通話). The term follows Her
383
+ (2009) and the naming of the Corpus of Contemporary Taiwanese Mandarin
384
+ (臺灣華語文語料庫, National Academy for Educational Research); much of the phonetic
385
+ literature calls the same variety _Taiwan Mandarin_. It is not 臺灣國語, the
386
+ Hokkien-accented sociolect of that variety, nor Taiwanese Hokkien (臺語).
387
+ Her, One-Soon 何萬順 (2009). 語言與族群認同:從台灣外省族群的母語與台灣華語談起
388
+ [Language and group identity: On Taiwan Mainlanders' mother tongues and Taiwan
389
+ Mandarin]. _Language and Linguistics_ 10(2), 375–419.
data/data/hplt/README.md CHANGED
@@ -8,13 +8,13 @@
8
8
  3.0 `cmn_Hant` bins 7–10. A host qualified on: ≥ 5 documents sampled, zero
9
9
  origin-filter rejections, and ≥ 1.0 Taiwan evidence per 100 han characters.
10
10
 
11
- The list is published as *candidates*, not as an allowlist, because its
11
+ The list is published as _candidates_, not as an allowlist, because its
12
12
  precision is poor for the intended purpose. Ranked by evidence density, the top
13
13
  of the list is `downloadcenter.intel.com`, `powerapps.microsoft.com`,
14
14
  `developer.microsoft.com`, `dvdvideosoft.com`, `veed.io` — localized zh-TW
15
15
  product pages. They pass every origin test because localization vendors use
16
16
  correct Taiwanese IT vocabulary, but they are `production: translated`, not
17
- native Taiwan Mandarin. Admitting them would reintroduce exactly the
17
+ native Taiwanese Mandarin. Admitting them would reintroduce exactly the
18
18
  translationese the provenance axes exist to exclude.
19
19
 
20
20
  The 300 hosts would have added 2 812 of 859 049 sampled documents — 0.3 % more
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TWPipeline
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/twpipeline.rb CHANGED
@@ -50,7 +50,7 @@ module TWPipeline
50
50
  TWFilter::Checks::Lexicon.foreign_topics
51
51
  TWFilter::Checks::Lexicon.cantonese_chars
52
52
  TWFilter::Checks::Erhua.headed
53
- TWFilter::Checks::Erhua.tailed
53
+ TWFilter::Checks::Erhua.offender("兒")
54
54
  TWFilter::Checks::Wenyan.markers
55
55
  TWFilter::Evidence.terms
56
56
  self
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twpipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Den Patin
7
+ - Den Patin 丁丹旭
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
@@ -27,16 +27,16 @@ dependencies:
27
27
  name: twfilter
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.1'
32
+ version: '0.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.1'
39
+ version: '0.2'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rake
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -79,11 +79,11 @@ dependencies:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '3.13'
82
- description: 'Nine JSONL stages from a raw web crawl to dispersion-corrected frequency
83
- and n-gram tables: source gating, Taiwan-standard punctuation normalization, sentence
84
- segmentation, character-inventory and lexical-origin filtering, block-level evidence
85
- judgment, type deduplication, Viterbi word segmentation and external-sort counting.
86
- Resource-bounded by declared cores and memory.'
82
+ description: 'Nine JSONL stages from an HPLT web crawl to n-gram count tables: source
83
+ gating, Taiwan-standard punctuation normalization, sentence segmentation, character-inventory
84
+ and lexical-origin filtering through twfilter, block-level evidence judgment, exact
85
+ sentence deduplication, Viterbi word segmentation and external-sort counting. Worker
86
+ count and buffer sizes follow the declared cores and memory.'
87
87
  email: hi@dpat.in
88
88
  executables:
89
89
  - twpipeline
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 4.0.17
146
+ rubygems_version: 4.0.20
147
147
  specification_version: 4
148
- summary: Corpus construction pipeline for Taiwan Mandarin
148
+ summary: Corpus construction pipeline for Taiwanese Mandarin
149
149
  test_files: []