luketheduke commited on
Commit
4477711
·
1 Parent(s): 40b091e

Delete add_translation.py

Browse files
Files changed (1) hide show
  1. add_translation.py +0 -26
add_translation.py DELETED
@@ -1,26 +0,0 @@
1
- from datasets import load_dataset
2
- from googletrans import Translator
3
-
4
- def main():
5
- translator = Translator()
6
- raw_ds = load_dataset('SetFit/amazon_massive_intent_de-DE')
7
- for split, dset in raw_ds.items():
8
- if split =='validation':
9
- label_text = dset['label_text']
10
- translations = []
11
- progress = 0
12
- for text in label_text:
13
- progress+=1
14
- if progress%1000 == 0:
15
- print(progress)
16
- print(translation)
17
- text = text.replace("_", " ")
18
- translation = translator.translate(text, dest='german').text
19
- translations.append(translation)
20
- dset = dset.add_column("label_text_de", translations)
21
- dset.to_json(f"{split}.jsonl")
22
-
23
- if __name__ == "__main__":
24
- main()
25
-
26
-