Browse Source

Versione 1

Converte file inglese italiano
cromatiste 3 years ago
parent
commit
bc3a5fb4c1
1 changed files with 16 additions and 0 deletions
  1. 16 0
      traduzionelast.py

+ 16 - 0
traduzionelast.py

@@ -0,0 +1,16 @@
+from googletrans import Translator
+import os
+
+
+translator = Translator()
+#sostiruire la rirectory
+os.chdir('C:\\Users\\fumaga\\Documents\\py\\')
+
+for numero in range (50,8500,50):
+    numeroch = str(numero)
+    f = open('small_file_'+ numeroch + '.txt', 'r', encoding ='utf-8')
+    contents = f.read()
+    result = translator.translate(contents, dest='it',src='auto')
+    with open('small_it_'+ numeroch + '.txt', 'w',errors='ignore') as f:
+        f.write(result.text)
+        print("Fine small_it"+ numeroch)