Datasets:

ArXiv:
License:
HoneyTian commited on
Commit
91ebc59
1 Parent(s): 3def8ee
README.md CHANGED
@@ -3,6 +3,9 @@ license: apache-2.0
3
  ---
4
  ## 语种识别
5
 
 
 
 
6
 
7
 
8
  ### 数据来源
@@ -75,6 +78,8 @@ https://opus.nlpl.eu/
75
 
76
  #### amazon_reviews_multi
77
 
 
 
78
  ```text
79
  语种数量:
80
  ja: 199797
@@ -85,6 +90,28 @@ es: 198264
85
  zh-cn: 196260
86
  ```
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  ```text
89
  文本长度:
90
  10-20: 1369
@@ -114,6 +141,152 @@ zh-cn: 196260
114
  ![amazon_reviews_multi_text_length.jpg](docs/picture/amazon_reviews_multi_text_length.jpg)
115
 
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  ### 参考来源
118
  <details>
119
  <summary>参考的数据来源,展开查看</summary>
 
3
  ---
4
  ## 语种识别
5
 
6
+ Tips:
7
+ * 语种 zh 代表是中文, 可能是简体, 也可能是繁体. 语种 zh-cn 则代表是简体中文, zh-tw 代表繁体中文.
8
+
9
 
10
 
11
  ### 数据来源
 
78
 
79
  #### amazon_reviews_multi
80
 
81
+ 以下都是 train 训练集的信息
82
+
83
  ```text
84
  语种数量:
85
  ja: 199797
 
90
  zh-cn: 196260
91
  ```
92
 
93
+ 样本示例:
94
+ | 数据 | 语种 | 样本 |
95
+ | :---: | :---: | :---: |
96
+ | amazon_reviews_multi | de | Armband ist leider nach 1 Jahr kaputt gegangen |
97
+ | amazon_reviews_multi | de | In der Lieferung war nur Ein Akku! |
98
+ | amazon_reviews_multi | de | Ein Stern, weil gar keine geht nicht. Es handelt sich um gebraucht Waren, die Stein haben so ein Belag drauf, wo man sich dabei denken kann, dass jemand schon die benutzt und nicht Mal richtig gewaschen. Bei ein paar ist die Qualität Mangelhaft, siehe Bild. Ein habe ich ausprobiert, richtig gewaschen, dann verfärbt sich..... Wärme halt nicht lange. Deswegen wird es zurückgeschickt. |
99
+ | amazon_reviews_multi | en | Arrived broken. Manufacturer defect. Two of the legs of the base were not completely formed, so there was no way to insert the casters. I unpackaged the entire chair and hardware before noticing this. So, I'll spend twice the amount of time boxing up the whole useless thing and send it back with a 1-star review of part of a chair I never got to sit in. I will go so far as to include a picture of what their injection molding and quality assurance process missed though. I will be hesitant to buy again. It makes me wonder if there aren't missing structures and supports that don't impede the assembly process. |
100
+ | amazon_reviews_multi | en | the cabinet dot were all detached from backing... got me |
101
+ | amazon_reviews_multi | en | I received my first order of this product and it was broke so I ordered it again. The second one was broke in more places than the first. I can't blame the shipping process as it's shrink wrapped and boxed. |
102
+ | amazon_reviews_multi | es | Nada bueno se me fue ka pantalla en menos de 8 meses y no he recibido respuesta del fabricante |
103
+ | amazon_reviews_multi | es | Horrible, nos tuvimos que comprar otro porque ni nosotros que sabemos inglés, ni un informático, después de una hora fue capaz de instalarlo |
104
+ | amazon_reviews_multi | es | Te obligan a comprar dos unidades y te llega solo una y no hay forma de reclamar, una autentica estafa, no compreis!! |
105
+ | amazon_reviews_multi | fr | A déconseiller - Article n'a fonctionné qu'une fois - Je ne recommande pas du tout ce produit - Je l'ai jeté ... |
106
+ | amazon_reviews_multi | fr | Si vous voulez être déçu achetez le produit ! Au bout de 3 utilisation ne fonctionne plus.. Je ne recommande pas du tout sauf si vous voulez acheter un thermomètre quelques jours après avoir acheté celui ci ! |
107
+ | amazon_reviews_multi | fr | Écran de mauvaise qualité, car il s'use en peu de temps et croche. Dommage j'aimais bien car peu de traces de doigts. |
108
+ | amazon_reviews_multi | ja | 普段使いとバイクに乗るときのブーツ兼用として購入しました。見た目や履き心地は良いです。 しかし、2ヶ月履いたらゴム底が削れて無くなりました。また、バイクのシフトペダルとの摩擦で表皮が剥がれ、本革でないことが露呈しました。ちなみに防水とも書いていますが、雨の日は内部に水が染みます。 安くて見た目も良く、履きやすかったのですが、耐久性のなさ、本革でも防水でも無かったことが残念です。結局、本革の防水ブーツを買い直しました。 |
109
+ | amazon_reviews_multi | ja | 十分な在庫を用意できない販売元も悪いですが、Amazonやら楽⚪︎が転売を認めちゃってるのが結果的に転売の後押しになっちゃってるんだよなぁ… Amazonもここぞとばかりに抱き合わせ販売しまくるし… それを恥ずかしいと思えなくなったら動物と同じですよ、最大手さん。 |
110
+ | amazon_reviews_multi | ja | 見た目はかなりおしゃれで気に入りました。2、3回持ち歩いた後いつも通りゼンマイを巻いていたら突然空回り。 針の調整はできるけど、つまみをあげても下げてもゼンマイを巻くことができず。 時計屋に持って行って中を開けてもらったら、中のケースと外側の規格がそもそも合っていないため、固定されず、一度ズレると噛み合わなくなるんだそう。 返品して交換した方がいいと言われましたが、保証書付いてないし、 クーリングオフ期間もとっくに過ぎています。 アンティーク感覚で家で放置するならおススメですが、 本来の用途としては全く使えません。 ご注意を。 |
111
+ | amazon_reviews_multi | zh-cn | 本人账号被盗,资金被江西(杨建)挪用,请亚马逊尽快查实,将本人的200元资金退回。本人已于2017年11月30日提交退货申请,为何到2018年了还是没解决?亚马逊是什么情况?请给本人一个合理解释。 |
112
+ | amazon_reviews_multi | zh-cn | 这简直就是太差了!出版社怎么就能出版吗?我以为是百度摘录呢!这到底是哪个鱼目混珠的教授啊?!能给点干货吗?!总算应验了一句话,一本书哪怕只有一句花你感到有意义也算是本好书。哇为了找这本书哪怕一句不是废话的句子都费了我整整一天时间。。 |
113
+ | amazon_reviews_multi | zh-cn | 购买页面显示1~2日发货,付款之后显示半个月后送达,实际收到商品距离下单日期已经一个多月。 无力吐槽,一星是给商品的。 |
114
+
115
  ```text
116
  文本长度:
117
  10-20: 1369
 
141
  ![amazon_reviews_multi_text_length.jpg](docs/picture/amazon_reviews_multi_text_length.jpg)
142
 
143
 
144
+
145
+ #### bucc2018
146
+
147
+ 以下都是 train 训练集的信息
148
+
149
+ ```text
150
+ 语种数量:
151
+ en: 935829
152
+ ru: 459415
153
+ de: 412895
154
+ fr: 270768
155
+ zh: 94411
156
+ ```
157
+
158
+ 样本示例:
159
+
160
+ | 数据 | 语种 | 样本 |
161
+ | :---: | :---: | :---: |
162
+ | bucc2018 | de | Einen weiteren Oscar erhielt er 2013 für seine Regiearbeit an "". |
163
+ | bucc2018 | de | Seine Eltern, Emigranten aus China, lernten sich in Taiwan kennen, Lee ist ihr ältester Sohn. |
164
+ | bucc2018 | de | Die Großeltern väterlicher- und mütterlicherseits sind im Zuge der kommunistischen Revolution in China ums Leben gekommen. |
165
+ | bucc2018 | en | Other data that are used included Bragg diffraction data for crystalline materials, and EXAFS data. |
166
+ | bucc2018 | en | The comparison with experiment is quantified using a function of the form |
167
+ | bucc2018 | en | Moreover, the move may also be rejected if it breaks certain constraints, even if the agreement with data is improved. |
168
+ | bucc2018 | fr | Il peut être divisé en trois zones en fonction du relief, du climat, du peuplement et de l'économie: |
169
+ | bucc2018 | fr | En 1877, 55 communes n’avaient pour seul accès que des sentiers ou des chemins muletiers. |
170
+ | bucc2018 | fr | Généralement, il ne cause pas de dommages à la flore, mais il peut introduire des parasites dans les poumons des moutons. |
171
+ | bucc2018 | ru | На севере граничит с Латвией, на юго-востоке — с Белоруссией, на юго-западе — c Польшей и Калининградской областью России. |
172
+ | bucc2018 | ru | Член ООН с 1991 года, ЕС и НАТО — с 2004 года. |
173
+ | bucc2018 | ru | Поля и луга занимают 57 % территории, леса и кустарники — 30 %, болота — 3 %, внутренние воды — 4 %. |
174
+ | bucc2018 | zh | 中國古代稱輿地,地理則是指風水學。 |
175
+ | bucc2018 | zh | 1902年,光緒皇帝接受吏部尚書張百熙建議,頒佈〈欽定學堂章程〉,其中尋常小學課目中,有史學、輿地二項。 |
176
+ | bucc2018 | zh | 張百熙派吳汝綸赴日本考察教育後,1903年,負責教育改革的張百熙、張之洞、榮慶向皇帝建議重訂學堂章程。 |
177
+
178
+
179
+ ```text
180
+ 文本长度:
181
+ 10-20: 9687
182
+ 20-30: 25319
183
+ 30-40: 25872
184
+ 40-50: 20904
185
+ 50-60: 33536
186
+ 60-70: 94395
187
+ 70-80: 193311
188
+ 80-90: 263914
189
+ 90-100: 295448
190
+ 100-110: 301739
191
+ 110-120: 280729
192
+ 120-130: 233477
193
+ 130-140: 168259
194
+ 140-150: 105622
195
+ 150-160: 61119
196
+ 160-170: 32300
197
+ 170-180: 15742
198
+ 180-190: 7148
199
+ 190-200: 2926
200
+ 200-210: 1871
201
+ ```
202
+
203
+ 文本长度统计图像:
204
+
205
+ ![bucc2018_text_length.jpg](docs/picture/bucc2018_text_length.jpg)
206
+
207
+
208
+
209
+ #### mike0307
210
+ 以下都是 train 训练集的信息
211
+
212
+ ```text
213
+ 语种数量:
214
+ es: 3436
215
+ pl: 3370
216
+ en: 3354
217
+ zh-tw: 3338
218
+ fr: 3325
219
+ pt: 3280
220
+ it: 3274
221
+ de: 3269
222
+ nl: 3233
223
+ ru: 3216
224
+ ```
225
+
226
+ 样本示例:
227
+ | 数据 | 语种 | 样本 |
228
+ | :---: | :---: | :---: |
229
+ | mike0307 | pt | Fluoretos binários de metalóides e não-metais de bloco p são geralmente covalentes e voláteis, com reatividade variável, e não-metais de estágio 3 e mais pesados ​​podem formar fluoretos hipervalentes. |
230
+ | mike0307 | pt | Ter sistemas de armas nucleares em alerta máximo aumenta o risco de utilização destas armas, inclusive inadvertidamente, com consequências catastróficas. |
231
+ | mike0307 | pt | O castelo foi remodelado duas vezes: primeiro no século XV e novamente no século XIX, após ter sido parcialmente destruído. |
232
+ | mike0307 | pl | Policja w Birmie postawiła Aung San Suu Kyi dwa kolejne zarzuty |
233
+ | mike0307 | pl | Kobieta trzyma w ramionach małego kangura. |
234
+ | mike0307 | pl | Do jakiego miasta należy Wudi? |
235
+ | mike0307 | ru | Взрыв 74+19+16! Дюрэнт и Харден сошли с ума, оба установили рекорды, а «Нетс» обыграли «Мэджик» |
236
+ | mike0307 | ru | 13. Каково настоящее имя известного писателя Лао Шэ? |
237
+ | mike0307 | ru | [Выход на массовый рынок в Новом году] Во время Весеннего фестиваля кассовые сборы фильма в округе Г��нгу достигли 1 миллиона юаней. |
238
+ | mike0307 | nl | Ze had slechts één voorwaarde: dat het boek pas na haar dood zou worden gepubliceerd. |
239
+ | mike0307 | nl | Narendra Modi belooft een harde houding tegenover Pakistan |
240
+ | mike0307 | nl | Leen het niet |
241
+ | mike0307 | en | Kang Young-hoon (,), South Korean Army Lieutenant General, Ambassador to foreign countries, and Prime Minister of South Korea. He served from December 5, 1988 to December 27, 1990, and served as the interim Prime Minister of South Korea until December 16, 1988. He was born in Changseong County, North Pyongan Province during the Japanese colonial period. Originally from Jinzhou (), his name was Qingnong (). Graduated from Yongbyon Agricultural High School in 1936 and Hiroshima Higher Normal University in 1940. Later, he studied in Manzhou and was admitted to the Department of Economics of Jianguo University. On May 1, 1946, he became the first batch of students of the Military English School and participated in the Korean War. In 1951, he served as the manager and director of the Ministry of Defense of South Korea. In 1952, he served as the military attache of the Korean Embassy in the United States. In 1954, he served as the chief of the Joint Staff Headquarters with the rank of major general. In 1955, he served as the assistant undersecretary for mobilization of the Ministry of National Defense. In 1956, he served as the manager of the Army Headquarters. Deputy Chief of Staff, from 1958 to further training, appointed in 1959. He served as the principal of the Army Military Academy in 1960, but because he opposed the participation of military academy students in demonstrations in support of the May 16th coup, he was imprisoned in Seodaemun Prison as the "number one counterrevolutionary general" (). He was released from prison in 1961 and retired with the rank of Army Lieutenant General. In 1970, he went to the University of Southern California to study abroad and received a doctorate in political science. In early 1978, he joined the Ministry of Foreign Affairs as the Dean of Diplomatic and Security Research Fellows. On January 13, 1981, he was concurrently appointed as Ambassador of Ireland (until 1984) and Ambassador to the Vatican (1985 to 1987). On April 26, 1988, he was elected to the 13th General Election. He was elected as a member of the National Assembly (May to December 1988). He was appointed as the 21st Prime Minister on December 16 of the same year and resigned in 1990. Died on May 10, 2016. |
242
+ | mike0307 | en | The S&P 500 index .SPX closed down 11.91 points, or 1.19%, at 986.60 points; |
243
+ | mike0307 | en | Tony Estanguet (Tony Estanguet,) is a French male canoe slalom athlete who won the gold medal in the single event at the 2000 Summer Olympics, 2004 Summer Olympics and 2012 Summer Olympics. Tony is the son of kayaker Henri Estrangay, who won a world championship medal in the 1970s. His older brother, Patrice Estangay [1996 Summer Olympics | 1996 Atlanta Olympics]] won a bronze medal. Tony Estangay won a total of 3 gold medals in the C-1 event at the Olympic Games, in 2000, 2004 and 2012. The 2004 gold medal was very controversial. The referee gave Michal Martykan a 2-second penalty, making him the runner-up. His final time was only 0.12 seconds behind Estangay. Estangay was France's flag bearer at the opening ceremony of the 2008 Summer Olympics in Beijing. He finished 9th in the C-1 semi-finals and was eliminated as a result. At the 2012 London Olympics, he became the first French athlete to win three gold medals in the same event. He won a total of 12 medals at the Canoe World Championships, including 5 gold medals (C-1: 2006, 2009, 2010; C-1 Team: 2005, 2007) and 6 silver medals (C-1 : 2003, 2005, 2007; C-1 Group: 1997, 2003, 2009), a bronze medal (C-1 Group: 1999). In 2012, he was elected to the International Olympic Committee Athletes Commission. He will serve as a member of the International Olympic Committee for a term of eight years. On October 30, 2012, he announced his retirement. |
244
+ | mike0307 | es | ¿Por qué la deducción no tiene éxito? El saldo es suficiente |
245
+ | mike0307 | es | ¿Cómo quitar la pintura de la ropa? |
246
+ | mike0307 | es | Peter conocía a Brewster, que era amigo del padre de Peter. |
247
+ | mike0307 | fr | Il a désormais été remplacé par Bing. |
248
+ | mike0307 | fr | Manifestations cliniques du pied diabétique |
249
+ | mike0307 | fr | Veuillez fournir votre numéro de téléphone portable. Merci pour votre travail acharné. |
250
+ | mike0307 | de | Schwarzflossenbarrakuda (wissenschaftlicher Name:), auch Schwarzflossenbarrakuda genannt, allgemein bekannt als Nadelschiffchen, Bambusschiffchen und Barrakuda, ist einer der Rochenfische in der Ordnung Perciformes, der Unterordnung Mackerelidae und der Familie Barracuda. Dieser Fisch ist in der indopazifischen Region verbreitet, einschließlich Südafrika, Ostafrika, dem Roten Meer, den Seychellen, den Malediven, Taiwan, Japan, Malaysia, Indonesien, Kambodscha, Australien, Samoa, Guam, Tonga und den Marshallinseln und Mikronesien. Rumänien, Hawaii-Inseln, Neukaledonien, Französisch-Polynesien, Mexiko und andere Gewässer. Die Typuslokalität dieser Art ist Nagasaki, Japan. Die Wassertiefe beträgt 40 bis 70 Meter. Der Körper dieses Fisches ist länglich und torpedoförmig, mit einem fast zylindrischen Querschnitt. Die Anzahl der Seitenschuppen beträgt mehr als 100, und es gibt keine verlängerten Kiemenräumer. Der Ansatzpunkt der Bauchflosse liegt vor der Vertikalen Linie des Ausgangspunkts der Rückenflosse. Die Augen sind gleich groß und der Kopf ist etwa sechsmal länger. , Die Brustflosse hat keinen großen schwarzen Fleck und der ㄍ-förmige Streifen erstreckt sich von der Rückseite des Körpers bis etwas unterhalb des Seitenlinienfetts. Die Bauchflosse ist schwarz und der Oberkiefer reicht nicht bis zum Augenrand. Die Rückenflosse hat 6 harte Stacheln; die Rückenflosse hat 9 weiche Strahlen; die Afterflosse hat 2 harte Stacheln; die Afterflosse hat 7 bis 9 weiche Strahlen und die Körperlänge kann 170 cm erreichen. Dieser Fisch bewohnt Lagunen und Küstenriffgebiete. Sie bewegen sich in Gruppen, sind tagsüber aktiv und schwimmen schnell. Sie sind wandernde, fleischfressende Fische, die sich von Fischen, Kopffüßern usw. ernähren. Es ist ein Speisefisch mit köstlichem Fleisch, der sich zum Schmoren, Braten oder Zubereiten von Suppen eignet. |
251
+ | mike0307 | de | Ein Mann hackt Pfeffer. |
252
+ | mike0307 | de | Colombres ist eine der drei Diözesen (Verwaltungsbezirke) von Asturien, einer Stadt in der Autonomen Gemeinschaft Ribadedeva in der Provinz Nordspanien. |
253
+ | mike0307 | zh-tw | 您那個是哪家的銀行卡? |
254
+ | mike0307 | zh-tw | 女性幾乎總是女性 - 男性護士並不常見,特別是在高級職位上。 |
255
+ | mike0307 | zh-tw | 使氣體液化有哪些方法? |
256
+ | mike0307 | it | Che marca di giacca di pelle è buona? |
257
+ | mike0307 | it | La Russia ha ratificato la versione rivista del trattato. |
258
+ | mike0307 | it | Un uomo sta sciando in montagna con un cane. |
259
+
260
+ ```text
261
+ 文本长度:
262
+ 0-10: 591
263
+ 10-20: 1700
264
+ 20-30: 2526
265
+ 30-40: 3559
266
+ 40-50: 3495
267
+ 50-60: 3038
268
+ 60-70: 2324
269
+ 70-80: 1927
270
+ 80-90: 1576
271
+ 90-100: 1383
272
+ 100-110: 1271
273
+ 110-120: 1099
274
+ 120-130: 985
275
+ 130-140: 903
276
+ 140-150: 719
277
+ 150-160: 625
278
+ 160-170: 496
279
+ 170-180: 326
280
+ 180-190: 249
281
+ 190-200: 164
282
+ 200-210: 4139
283
+ ```
284
+
285
+ 文本长度统计图像:
286
+
287
+ ![mike0307_text_length.jpg](docs/picture/docs/picture/mike0307_text_length.jpg)
288
+
289
+
290
  ### 参考来源
291
  <details>
292
  <summary>参考的数据来源,展开查看</summary>
data/{ducc2018.jsonl → bucc2018.jsonl} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8768a7e674e4aeb919fd745847a09feff90b641de8e0fcbb7dddc1a60cadbc6f
3
- size 877661718
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0913a3affc6289321d3d20f9f9247429cdbe8f56791f5109a747d8be82ce912e
3
+ size 877108209
examples/amazon_reviews_multi_text_length.jpg → docs/picture/bucc2018_text_length.jpg RENAMED
File without changes
docs/picture/mike0307_text_length.jpg ADDED

Git LFS Details

  • SHA256: 56d0075682cbf1faba642eff2949049d26f8e6eb5fdbec6af4a1402d60a191cb
  • Pointer size: 130 Bytes
  • Size of remote file: 19 kB
examples/make_subset_details.py CHANGED
@@ -1,7 +1,7 @@
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
@@ -12,7 +12,7 @@ from project_settings import project_path
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(),
@@ -27,7 +27,7 @@ def main():
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
@@ -35,6 +35,8 @@ def main():
35
 
36
  counter1 = Counter()
37
  counter2 = Counter()
 
 
38
  for sample in tqdm(dataset):
39
  text = sample["text"]
40
  language = sample["language"]
@@ -46,10 +48,25 @@ def main():
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]
@@ -60,7 +77,8 @@ def main():
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
 
1
  #!/usr/bin/python3
2
  # -*- coding: utf-8 -*-
3
  import argparse
4
+ from collections import Counter, defaultdict
5
 
6
  from datasets import load_dataset, DownloadMode
7
  import matplotlib.pyplot as plt
 
12
 
13
  def get_args():
14
  parser = argparse.ArgumentParser()
15
+ parser.add_argument("--dataset_name", default="mike0307", type=str)
16
  parser.add_argument(
17
  "--dataset_cache_dir",
18
  default=(project_path / "hub_datasets").as_posix(),
 
27
 
28
  dataset = load_dataset(
29
  "../language_identification.py",
30
+ name=args.dataset_name,
31
  split="train",
32
  cache_dir=args.dataset_cache_dir,
33
  # download_mode=DownloadMode.FORCE_REDOWNLOAD
 
35
 
36
  counter1 = Counter()
37
  counter2 = Counter()
38
+ examples = defaultdict(list)
39
+ examples_counter = defaultdict(int)
40
  for sample in tqdm(dataset):
41
  text = sample["text"]
42
  language = sample["language"]
 
48
  counter1.update([language])
49
  counter2.update([text_length_round])
50
 
51
+ if examples_counter[language] < 3:
52
+ examples[language].append(text)
53
+ examples_counter[language] += 1
54
+
55
+ print("\n")
56
  print("语种数量:")
57
  for k, v in counter1.most_common():
58
  print("{}: {}".format(k, v))
59
 
60
+ print("\n")
61
+ print("样本示例:")
62
+ print("| 数据 | 语种 | 样本 |")
63
+ print("| :---: | :---: | :---: |")
64
+ for language, text_list in examples.items():
65
+ for text in text_list:
66
+ row = "| {} | {} | {} |".format(args.dataset_name, language, text)
67
+ print(row)
68
+
69
+ print("\n")
70
  print("文本长度:")
71
  counter2 = list(sorted(counter2.items(), key=lambda x: x[0]))
72
  x = [item[0] for item in counter2]
 
77
  print("{}: {}".format(text_length_range, v))
78
 
79
  plt.plot(x, y)
80
+ image_file = project_path / "docs/picture/{}_text_length.jpg".format(args.dataset_name)
81
+ plt.savefig(image_file.as_posix())
82
  plt.show()
83
 
84
  return
examples/preprocess/preprocess_bucc2018.py CHANGED
@@ -24,12 +24,12 @@ def get_args():
24
  parser = argparse.ArgumentParser()
25
  parser.add_argument(
26
  "--dataset_dir",
27
- default=r"E:\programmer\nlp_datasets\ducc2018",
28
  type=str
29
  )
30
  parser.add_argument(
31
  "--output_file",
32
- default=(project_path / "data/ducc2018.jsonl"),
33
  type=str
34
  )
35
 
@@ -74,10 +74,6 @@ def main():
74
  "training": "train",
75
  }
76
 
77
- language_map = {
78
- "zh": "zh-cn"
79
- }
80
-
81
  text_set = set()
82
  counter = defaultdict(int)
83
  with open(args.output_file, "w", encoding="utf-8") as fout:
@@ -106,7 +102,6 @@ def main():
106
  continue
107
  text_set.add(text)
108
 
109
- language = language_map.get(language, language)
110
  if language not in LANGUAGE_MAP.keys():
111
  raise AssertionError(language)
112
 
 
24
  parser = argparse.ArgumentParser()
25
  parser.add_argument(
26
  "--dataset_dir",
27
+ default=r"E:\programmer\nlp_datasets\bucc2018",
28
  type=str
29
  )
30
  parser.add_argument(
31
  "--output_file",
32
+ default=(project_path / "data/bucc2018.jsonl"),
33
  type=str
34
  )
35
 
 
74
  "training": "train",
75
  }
76
 
 
 
 
 
77
  text_set = set()
78
  counter = defaultdict(int)
79
  with open(args.output_file, "w", encoding="utf-8") as fout:
 
102
  continue
103
  text_set.add(text)
104
 
 
105
  if language not in LANGUAGE_MAP.keys():
106
  raise AssertionError(language)
107
 
language_identification.py CHANGED
@@ -10,6 +10,7 @@ import datasets
10
 
11
  _URLS = {
12
  "amazon_reviews_multi": "data/amazon_reviews_multi.jsonl",
 
13
  "mike0307": "data/mike0307.jsonl",
14
  "nbnn": "data/nbnn.jsonl",
15
  "nordic_langid": "data/nordic_langid.jsonl",
@@ -62,6 +63,7 @@ LANGUAGE_MAP = {
62
  "tr": "turkish",
63
  "ur": "urdu",
64
  "vi": "vietnamese",
 
65
  "zh-cn": "simplified chinese",
66
  "zh-tw": "traditional chinese",
67
  }
@@ -72,6 +74,7 @@ class LanguageIdentification(datasets.GeneratorBasedBuilder):
72
 
73
  BUILDER_CONFIGS = [
74
  datasets.BuilderConfig(name="amazon_reviews_multi", version=VERSION, description="amazon_reviews_multi"),
 
75
  datasets.BuilderConfig(name="mike0307", version=VERSION, description="mike0307"),
76
  datasets.BuilderConfig(name="nbnn", version=VERSION, description="nbnn"),
77
  datasets.BuilderConfig(name="nordic_langid", version=VERSION, description="nordic_langid"),
 
10
 
11
  _URLS = {
12
  "amazon_reviews_multi": "data/amazon_reviews_multi.jsonl",
13
+ "bucc2018": "data/bucc2018.jsonl",
14
  "mike0307": "data/mike0307.jsonl",
15
  "nbnn": "data/nbnn.jsonl",
16
  "nordic_langid": "data/nordic_langid.jsonl",
 
63
  "tr": "turkish",
64
  "ur": "urdu",
65
  "vi": "vietnamese",
66
+ "zh": "chinese",
67
  "zh-cn": "simplified chinese",
68
  "zh-tw": "traditional chinese",
69
  }
 
74
 
75
  BUILDER_CONFIGS = [
76
  datasets.BuilderConfig(name="amazon_reviews_multi", version=VERSION, description="amazon_reviews_multi"),
77
+ datasets.BuilderConfig(name="bucc2018", version=VERSION, description="bucc2018"),
78
  datasets.BuilderConfig(name="mike0307", version=VERSION, description="mike0307"),
79
  datasets.BuilderConfig(name="nbnn", version=VERSION, description="nbnn"),
80
  datasets.BuilderConfig(name="nordic_langid", version=VERSION, description="nordic_langid"),