<commit_before><?php
require_once __DIR__ . '/vendor/autoload.php';

use Stichoza\GoogleTranslate\TranslateClient;

class translate extends Script
{
	public function run()
	{
		$tr = new TranslateClient($this->matches[1], $this->matches[2]);

		$translatedText = $tr->translate($this->matches[3]);

		if(!isset($this->matches[1])) {
			$this->send('You are translating from ' . $tr->getLastDetectedSource());
		}

		return $this->send($translatedText);
	}
}<commit_msg>Detect language, when the user wrote 'AUTO'<commit_after><?php
require_once __DIR__ . '/vendor/autoload.php';

use Stichoza\GoogleTranslate\TranslateClient;

class translate extends Script
{
	public function run()
	{
		$tr = new TranslateClient($this->matches[1], $this->matches[2]);

		$translatedText = $tr->translate($this->matches[3]);

		if($this->matches[1] === 'AUTO') {
			$this->send('You are translating from ' . $tr->getLastDetectedSource());
		}

		return $this->send($translatedText);
	}
}
{'fraction_non_alphanumeric': 0.17610710607621008, 'fraction_numerical': 0.008238928939237899, 'mean_word_length': 5.2709677419354835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4574278', 'n_tokens_mistral': 347, 'n_tokens_neox': 320, 'n_words': 61}