Datasets:

ArXiv:
License:
HoneyTian commited on
Commit
585fe1b
1 Parent(s): bd8c85d
README.md CHANGED
@@ -71,6 +71,47 @@ https://opus.nlpl.eu/
71
 
72
 
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ### 参考来源
75
  <details>
76
  <summary>参考的数据来源,展开查看</summary>
 
71
 
72
 
73
 
74
+ ### 各数据集文本长度信息
75
+
76
+ amazon_reviews_multi
77
+
78
+ ```text
79
+ 语种数量:
80
+ ja: 199797
81
+ en: 199426
82
+ de: 199141
83
+ fr: 198272
84
+ es: 198264
85
+ zh-cn: 196260
86
+ ```
87
+
88
+ ![amazon_reviews_multi_text_length.jpg](docs/picture/amazon_reviews_multi_text_length.jpg)
89
+
90
+ ```text
91
+ 文本长度:
92
+ 10-20: 1369
93
+ 20-30: 115334
94
+ 30-40: 105600
95
+ 40-50: 85175
96
+ 50-60: 71594
97
+ 60-70: 61376
98
+ 70-80: 54223
99
+ 80-90: 48242
100
+ 90-100: 44592
101
+ 100-110: 45839
102
+ 110-120: 48721
103
+ 120-130: 47604
104
+ 130-140: 43195
105
+ 140-150: 37601
106
+ 150-160: 32483
107
+ 160-170: 28876
108
+ 170-180: 25260
109
+ 180-190: 22971
110
+ 190-200: 20743
111
+ 200-210: 250362
112
+ ```
113
+
114
+
115
  ### 参考来源
116
  <details>
117
  <summary>参考的数据来源,展开查看</summary>
examples/amazon_reviews_multi_text_length.jpg ADDED

Git LFS Details

  • SHA256: 82ff0108b6ce611a2eb0077c119120fe51fb24225f883439ce670e22548e4320
  • Pointer size: 130 Bytes
  • Size of remote file: 17.3 kB
examples/make_subset_details.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ import argparse
4
+ from collections import Counter
5
+
6
+ from datasets import load_dataset, DownloadMode
7
+ import matplotlib.pyplot as plt
8
+ from tqdm import tqdm
9
+
10
+ from project_settings import project_path
11
+
12
+
13
+ def get_args():
14
+ parser = argparse.ArgumentParser()
15
+ parser.add_argument("--dataset_name", default="amazon_reviews_multi", type=str)
16
+ parser.add_argument(
17
+ "--dataset_cache_dir",
18
+ default=(project_path / "hub_datasets").as_posix(),
19
+ type=str
20
+ )
21
+ args = parser.parse_args()
22
+ return args
23
+
24
+
25
+ def main():
26
+ args = get_args()
27
+
28
+ dataset = load_dataset(
29
+ "../language_identification.py",
30
+ name="amazon_reviews_multi",
31
+ split="train",
32
+ cache_dir=args.dataset_cache_dir,
33
+ # download_mode=DownloadMode.FORCE_REDOWNLOAD
34
+ )
35
+
36
+ counter1 = Counter()
37
+ counter2 = Counter()
38
+ for sample in tqdm(dataset):
39
+ text = sample["text"]
40
+ language = sample["language"]
41
+
42
+ text_length = len(text)
43
+ text_length_round = int(text_length / 10) * 10
44
+ text_length_round = 200 if text_length_round > 200 else text_length_round
45
+
46
+ counter1.update([language])
47
+ counter2.update([text_length_round])
48
+
49
+ print("语种数量:")
50
+ for k, v in counter1.most_common():
51
+ print("{}: {}".format(k, v))
52
+
53
+ print("文本长度:")
54
+ counter2 = list(sorted(counter2.items(), key=lambda x: x[0]))
55
+ x = [item[0] for item in counter2]
56
+ y = [item[1] for item in counter2]
57
+
58
+ for k, v in counter2:
59
+ text_length_range = "{}-{}".format(k, k+10)
60
+ print("{}: {}".format(text_length_range, v))
61
+
62
+ plt.plot(x, y)
63
+ plt.savefig("{}_text_length.jpg".format(args.dataset_name))
64
+ plt.show()
65
+
66
+ return
67
+
68
+
69
+ if __name__ == "__main__":
70
+ main()
requirements.txt CHANGED
@@ -5,3 +5,4 @@ tqdm==4.66.1
5
  pandas==2.0.3
6
  xlrd==1.2.0
7
  openpyxl==3.0.9
 
 
5
  pandas==2.0.3
6
  xlrd==1.2.0
7
  openpyxl==3.0.9
8
+ matplotlib==3.7.5