<commit_before>
import asyncio
import json
import re
import urllib.parse

import waterbug

parser = waterbug.ArgumentParser()
parser.add_argument('-f', default="sv")
parser.add_argument('-t', default="en")
parser.add_argument('string', nargs='+')

class Commands:

    @waterbug.expose
    @asyncio.coroutine
    def translate(responder, *text):
        ns = parser.parse_args(text)
        qstring = urllib.parse.urlencode({
            "client": "t",
            "sl": ns.f,
            "tl": ns.t,
            "dt": "t",
            "ie": "UTF-8",
            "oe": "UTF-8",
            "q": " ".join(ns.string)<commit_msg>Autodetect language if none specified<commit_after>
import asyncio
import json
import re
import urllib.parse

import waterbug

parser = waterbug.ArgumentParser()
parser.add_argument('-f', default="auto")
parser.add_argument('-t', default="en")
parser.add_argument('string', nargs='+')

class Commands:

    @waterbug.expose
    @asyncio.coroutine
    def translate(responder, *text):
        ns = parser.parse_args(text)
        qstring = urllib.parse.urlencode({
            "client": "t",
            "sl": ns.f,
            "tl": ns.t,
            "dt": "t",
            "ie": "UTF-8",
            "oe": "UTF-8",
            "q": " ".join(ns.string)
{'fraction_non_alphanumeric': 0.1596244131455399, 'fraction_numerical': 0.003129890453834116, 'mean_word_length': 2.4850136239782015, 'pattern_counts': {'":': 14, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2187235', 'n_tokens_mistral': 426, 'n_tokens_neox': 423, 'n_words': 91}