<commit_before>#!/usr/bin/python
#  -*- encoding: utf-8 -*-

import Queue
import threading

from translators.microsoft import save_microsoft_translation
from translators.google import save_google_translation
from translators.ut import ut_translation
from translators.tilde import tilde_translation


def get_translations(source_text, language_translate_from, language_translate_to, timeout=3, num_translators=4):
    queue = Queue.Queue()
    print("get_translations : language_translate_from", language_translate_from)
    print("get_translations : language_translate_to", language_translate_to)

    thread_microsoft = threading.Thread(target=save_microsoft_translation, args=(queue,
                                                                                 source_text,
                                                                                 'MarkTranslationAPI1',
                                                                                 '+9S5n0BWNA27XgZrJysgtNrGgYRK1irG4pu9bpYBWw4=',
                                                                                 language_translate_from,
                                                                                 language_translate_to)
                                        )
    thread_microsoft.daemon = True
    thread_microsoft.start()

    thread_google = threading.Thread(target=save_google_translation, args=(queue,
                                                                           source_text,
                                                                           language_translate_from,
                                                                           language_translate_to)
                                     )
    thread_google.daemon = True
    thread_google.start()

    thread_ut = threading.Thread(target=ut_translation, args=(queue,
                                                              source_text,
                                                              language_translate_from,
                                                              language_translate_to)
                                 )
    thread_ut.daemon = True
    thread_ut.start()

    thread_tilde = threading.Thread(target=tilde_translation, args=(queue,
                                                              source_text,
                                                              language_translate_from,
                                                              language_translate_to)
                                 )

    thread_tilde.daemon = True
    thread_tilde.start()

    translations = dict()

    for _ in xrange(num_translators):
        for key, value in queue.get().iteritems():
            translations[key] = value
            queue.task_done()

    return translations
<commit_msg>Remove redundant Microsoft translator call<commit_after>#!/usr/bin/python
#  -*- encoding: utf-8 -*-

import Queue
import threading

from translators.microsoft import save_microsoft_translation
from translators.google import save_google_translation
from translators.ut import ut_translation
from translators.tilde import tilde_translation


def get_translations(source_text, language_translate_from, language_translate_to, timeout=3, num_translators=3):
    queue = Queue.Queue()
    print("get_translations : language_translate_from", language_translate_from)
    print("get_translations : language_translate_to", language_translate_to)

    """
    thread_microsoft = threading.Thread(target=save_microsoft_translation, args=(queue,
                                                                                 source_text,
                                                                                 'MarkTranslationAPI1',
                                                                                 '+9S5n0BWNA27XgZrJysgtNrGgYRK1irG4pu9bpYBWw4=',
                                                                                 language_translate_from,
                                                                                 language_translate_to)
                                        )
    thread_microsoft.daemon = True
    thread_microsoft.start()
    """

    thread_google = threading.Thread(target=save_google_translation, args=(queue,
                                                                           source_text,
                                                                           language_translate_from,
                                                                           language_translate_to)
                                     )
    thread_google.daemon = True
    thread_google.start()

    thread_ut = threading.Thread(target=ut_translation, args=(queue,
                                                              source_text,
                                                              language_translate_from,
                                                              language_translate_to)
                                 )
    thread_ut.daemon = True
    thread_ut.start()

    thread_tilde = threading.Thread(target=tilde_translation, args=(queue,
                                                              source_text,
                                                              language_translate_from,
                                                              language_translate_to)
                                 )

    thread_tilde.daemon = True
    thread_tilde.start()

    translations = dict()

    for _ in xrange(num_translators):
        for key, value in queue.get().iteritems():
            translations[key] = value
            queue.task_done()

    return translations

{'fraction_non_alphanumeric': 0.050761421319796954, 'fraction_numerical': 0.004551023980395589, 'mean_word_length': 1.0283990060347887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 76, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4622539', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1042, 'n_words': 184}