<commit_before>from googletrans import Translator
from utilities.GeneralUtilities import print_say
from googletrans.constants import LANGCODES, LANGUAGES, SPECIAL_CASES


def main(self):

    '''
        source language
    '''

    print_say('\nEnter source language ', self)
    srcs = raw_input()
    while (srcs not in LANGUAGES) and (srcs not in SPECIAL_CASES) and (srcs not in LANGCODES):
        if srcs in SPECIAL_CASES:
            srcs = SPECIAL_CASES[srcs]
        elif srcs in LANGCODES:
            srcs = LANGCODES[srcs]
        else:
            print_say("\nInvalid source language\nEnter again", self)
            srcs = raw_input()
    print_say('\nEnter destination language ', self)
    des = raw_input()
    while (des not in LANGUAGES) and (des not in SPECIAL_CASES) and (des not in LANGCODES):
        if des in SPECIAL_CASES:
            des = SPECIAL_CASES[des]
        elif des in LANGCODES:
            des = LANGCODES[des]
        else:
            print_say("\nInvalid destination language\nEnter again", self)
            des = raw_input()
    print_say('\nEnter text ', self)
    tex = raw_input()
    translator = Translator()
    result = translator.translate(tex, dest=des, src=srcs)
    result = u"""
[{src}] {original}
    ->
[{dest}] {text}
[pron.] {pronunciation}
    """.strip().format(src=result.src, dest=result.dest, original=result.origin,
                       text=result.text, pronunciation=result.pronunciation)
    print(result)<commit_msg>Adjust translate.py for python3 support<commit_after>from googletrans import Translator
from utilities.GeneralUtilities import print_say
from googletrans.constants import LANGCODES, LANGUAGES, SPECIAL_CASES
import six


def main(self):

    '''
        source language
    '''

    print_say('\nEnter source language ', self)
    if six.PY2:
        srcs = raw_input()
    else:
        srcs = input()
    while (srcs not in LANGUAGES) and (srcs not in SPECIAL_CASES) and (srcs not in LANGCODES):
        if srcs in SPECIAL_CASES:
            srcs = SPECIAL_CASES[srcs]
        elif srcs in LANGCODES:
            srcs = LANGCODES[srcs]
        else:
            print_say("\nInvalid source language\nEnter again", self)
            if six.PY2:
                srcs = raw_input()
            else:
                srcs = input()
    print_say('\nEnter destination language ', self)
    if six.PY2:
        des = raw_input()
    else:
        des = input()
    while (des not in LANGUAGES) and (des not in SPECIAL_CASES) and (des not in LANGCODES):
        if des in SPECIAL_CASES:
            des = SPECIAL_CASES[des]
        elif des in LANGCODES:
            des = LANGCODES[des]
        else:
            print_say("\nInvalid destination language\nEnter again", self)
            if six.PY2:
                des = raw_input()
            else:
                des = input()
    print_say('\nEnter text ', self)
    if six.PY2:
        tex = raw_input()
    else:
        tex = input()
    translator = Translator()
    result = translator.translate(tex, dest=des, src=srcs)
    result = u"""
[{src}] {original}
    ->
[{dest}] {text}
[pron.] {pronunciation}
    """.strip().format(src=result.src, dest=result.dest, original=result.origin,
                       text=result.text, pronunciation=result.pronunciation)
    print(result)
{'fraction_non_alphanumeric': 0.10195488721804512, 'fraction_numerical': 0.0018045112781954887, 'mean_word_length': 2.329329329329329, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4416871', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1015, 'n_words': 280}