Walter commited on
Commit
39714e2
·
1 Parent(s): 10e7304

Initial push from clean repo

Browse files
.gitattributes CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ *.txt filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ dataset_info:
3
+ features:
4
+ - name: text
5
+ dtype: string
6
+ language_bcp47:
7
+ - zh-Hant-HK
8
+ - yue-Hant-HK
9
+ license: cc-by-4.0
10
+ pretty_name: Hong Kong content-based (Cantonese & Traditional Chinese) text corpus
11
+ ---
12
+
13
+ # Dataset Card for `hk_content_corpus`
14
+
15
+ ## Dataset Description
16
+
17
+ This dataset contains eight cleaned source-specific corpora of Hong Kong Cantonese and Traditional Chinese text, crawled from public websites and platforms.
18
+ Each file stores plain UTF-8 text, where **each record occupies one line**, and **blank lines serve as separators**.
19
+ This dataset is also available at Zenodo: https://doi.org/10.5281/zenodo.16882352
20
+ We only change file extension from .corpus to .txt here for HuggingFace's dataset viewer function
21
+
22
+ ### Files
23
+
24
+ | Filename | Description | SHA256 checksum |
25
+ |--------------------------------------------|------------------------------------|--------------------------------------------------------------------|
26
+ | `appledaily_article_dedup.txt` | Apple Daily news articles | `0b6ad22b7a73230fd0e44af904c0cff1773cc871417f6ad3af11a783564bca15` |
27
+ | `hkcitizenmedia_article_dedup.txt` | HK Citizen Media articles | `373a5b369d5e402e58760861e2bff2e618e7ee7fd4494988a39be1156f9dba84` |
28
+ | `hkcnews_article_dedup.txt` | Hong Kong Citizen News | `67f909cfaf7d7a67df1dc79448f24622ec525a31b73b2e3293fbaad147470e69` |
29
+ | `inmedia_article_dedup.txt` | InMedia.hk articles | `135251f3e8ba7587018b7b2814b9ea5bbebf69c98adca73d3ea4c9f9b5571957` |
30
+ | `lihkg_posts_dedup_demoji_128.txt` | Lihkg forum posts (emoji removed) | `8e5e6de9c219aeccdaf13e9162b00cce2eeb7f595023a7bf19d4b5660395a3ee` |
31
+ | `openrice_review_dedup_demoji.txt` | OpenRice user reviews | `dd5835a7effe49bb96a31e0c0eab43dea17ef23b3e1d9cefdc186aca276897ce` |
32
+ | `thestandnews_article_dedup.txt` | Stand News articles | `847ef0f5809481caf4bf21100e4b34207513d724dafb9f42b162ef49079e7dba` |
33
+ | `wiki_hk.txt` | Wikipedia (zh-hk) | `bd33008802797b33df8484cf1113be6a0b38547fe13515f5c4edbf4ccad270db` |
34
+
35
+ ## Intended Uses
36
+
37
+ - Language model pretraining and finetuning
38
+ - Hong Kong Cantonese/Traditional Chinese linguistic modeling
39
+ - Downstream tasks such as classification or generation
40
+
41
+ NOTE: HKNSL became effective since 2020-6-30, which can create bias on user content created afterwards. Those portion of data should be used with caution.
appledaily_article_dedup.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b6ad22b7a73230fd0e44af904c0cff1773cc871417f6ad3af11a783564bca15
3
+ size 3143931888
dataset.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+
3
+ _DESCRIPTION = "Cleaned Hong Kong Cantonese / Traditional Chinese corpora from multiple sources."
4
+ _HOMEPAGE = "https://huggingface.co/datasets/SolarisCipher/hk_content_corpus_script"
5
+ _CORPUS_FILES = {
6
+ "appledaily_article": "appledaily_article_dedup.txt",
7
+ "hkcitizenmedia_article": "hkcitizenmedia_article_dedup.txt",
8
+ "hkcnews_article": "hkcnews_article_dedup.txt",
9
+ "inmedia_article": "inmedia_article_dedup.txt",
10
+ "lihkg_posts": "lihkg_posts_dedup_demoji_128.txt",
11
+ "openrice_review": "openrice_review_dedup_demoji.txt",
12
+ "thestandnews_article": "thestandnews_article_dedup.txt",
13
+ "wiki_hk": "wiki_hk.txt",
14
+ }
15
+
16
+ class HKContentCorpus(datasets.GeneratorBasedBuilder):
17
+
18
+ def _info(self):
19
+ return datasets.DatasetInfo(
20
+ description=_DESCRIPTION,
21
+ features=datasets.Features({"text": datasets.Value("string")}),
22
+ supervised_keys=None,
23
+ homepage=_HOMEPAGE,
24
+ citation="",
25
+ )
26
+
27
+ def _split_generators(self, dl_manager):
28
+ return [
29
+ datasets.SplitGenerator(
30
+ name=split_name,
31
+ gen_kwargs={"filepath": filepath},
32
+ )
33
+ for split_name, filepath in _CORPUS_FILES.items()
34
+ ]
35
+
36
+ def _generate_examples(self, filepath):
37
+ with open(filepath, encoding="utf-8") as f:
38
+ buffer = []
39
+ example_id = 0
40
+ for line in f:
41
+ line = line.strip()
42
+ if line:
43
+ buffer.append(line)
44
+ else:
45
+ if buffer:
46
+ yield example_id, {"text": "\n".join(buffer)}
47
+ example_id += 1
48
+ buffer = []
49
+ if buffer:
50
+ yield example_id, {"text": "\n".join(buffer)}
hkcitizenmedia_article_dedup.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:373a5b369d5e402e58760861e2bff2e618e7ee7fd4494988a39be1156f9dba84
3
+ size 1957068
hkcnews_article_dedup.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67f909cfaf7d7a67df1dc79448f24622ec525a31b73b2e3293fbaad147470e69
3
+ size 81680237
inmedia_article_dedup.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:135251f3e8ba7587018b7b2814b9ea5bbebf69c98adca73d3ea4c9f9b5571957
3
+ size 340775109
lihkg_posts_dedup_demoji_128.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e5e6de9c219aeccdaf13e9162b00cce2eeb7f595023a7bf19d4b5660395a3ee
3
+ size 3131803511
openrice_review_dedup_demoji.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd5835a7effe49bb96a31e0c0eab43dea17ef23b3e1d9cefdc186aca276897ce
3
+ size 1572247635
thestandnews_article_dedup.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:847ef0f5809481caf4bf21100e4b34207513d724dafb9f42b162ef49079e7dba
3
+ size 220252263
wiki_hk.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd33008802797b33df8484cf1113be6a0b38547fe13515f5c4edbf4ccad270db
3
+ size 1653596553