<commit_before><?php

#####################################################################################################

require_once("lib.php");
require_once("translate_lib.php");

$trailing=trim($argv[1]);
$dest=$argv[2];
$nick=$argv[3];
$alias=$argv[4];

if ($trailing=="")
{
  privmsg("syntax: .trans <nick>");
  return;
}

$lang_from="auto";
$lang_to="en";
$index="last_".strtolower($trailing)."_".strtolower($dest);

$msg=get_bucket($index);

if ($msg=="")
{
  privmsg("message by $trailing not found");
  return;
}

$def=translate($lang_from,$lang_to,$msg);

if ($def==$msg)
{
  privmsg("error translating");
  return;
}

if (strlen($def)>500)
{
  $def=substr($def,0,500)."...";
}
if ($def<>"")
{
  privmsg("[google] $msg: $def");
}

#####################################################################################################

?><commit_msg>whatever i changed<commit_after><?php

#####################################################################################################

require_once("lib.php");
require_once("translate_lib.php");

$trailing=trim($argv[1]);
$dest=$argv[2];
$nick=$argv[3];
$alias=$argv[4];

if ($trailing=="")
{
  privmsg("syntax: .trans <nick>");
  privmsg("uses google translate");
  return;
}

$lang_from="auto";
$lang_to="en";
$index="last_".strtolower($trailing)."_".strtolower($dest);

$msg=get_bucket($index);

if ($msg=="")
{
  privmsg("message by $trailing not found");
  return;
}

$def=translate($lang_from,$lang_to,$msg);

if ($def==$msg)
{
  return;
}

if (strlen($def)>500)
{
  $def=substr($def,0,500)."...";
}
if ($def<>"")
{
  privmsg("<$trailing> $msg: $def");
}
else
{
  privmsg("error translating");
  return;
}

#####################################################################################################

?>
{'fraction_non_alphanumeric': 0.4292109681029659, 'fraction_numerical': 0.012311135982092894, 'mean_word_length': 8.3125, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '743713', 'n_tokens_mistral': 627, 'n_tokens_neox': 598, 'n_words': 85}