Created
November 9, 2016 05:15
-
-
Save ishideo/1c5bc34b5c214db38b33d9a500fa373d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import codecs | |
import time | |
from microsofttranslator import Translator | |
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) | |
translator = Translator('XXXXXXXXXXXXXXXXXXXXX') | |
def main(): | |
count = 1 | |
file = './english.txt' | |
for line in open(file, 'r'): | |
if line: | |
items = line.split('\t') | |
if count % 4000 == 0: time.sleep(80) | |
print translator.translate(items[0], "it", "en") | |
count += 1; | |
else: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment