<commit_before><?php
/**
 * @file
 * Integrate with Ted.
 *
 * @link http://www.nllgg.nl/Ted/
 */

namespace Witti\FileConverter\Engine\Convert;

use Witti\FileConverter\Engine\EngineBase;
class Ted extends EngineBase {
  public function getConvertFileShell($source, &$destination) {
    return array(
      $this->cmd,
      '--printToFile',
      $source,
      $destination,
    );
  }

  public function getHelpInstallation($os, $os_version) {
    switch ($os) {
      case 'Ubuntu':
        $output = array(
          'Download .deb file from http://www.nllgg.nl/Ted/#How_to_install_Ted',
          'sudo dpkg -i <package-details>.deb',
          'Ex: sudo dpkg -i ted-2.23-amd64.deb',
        );
        return join("\n", $output);
    }

    return parent::getHelpInstallation();
  }

  public function isAvailable() {
    $this->cmd = $this->shellWhich('Ted');
    return isset($this->cmd);
  }

}<commit_msg>Added version info for Ted.<commit_after><?php
/**
 * @file
 * Integrate with Ted.
 *
 * @link http://www.nllgg.nl/Ted/
 */

namespace Witti\FileConverter\Engine\Convert;

use Witti\FileConverter\Engine\EngineBase;
class Ted extends EngineBase {
  public function getConvertFileShell($source, &$destination) {
    return array(
      $this->cmd,
      '--printToFile',
      $source,
      $destination,
    );
  }

  public function getHelpInstallation($os, $os_version) {
    switch ($os) {
      case 'Ubuntu':
        $output = array(
          'Download .deb file from http://www.nllgg.nl/Ted/#How_to_install_Ted',
          'sudo dpkg -i <package-details>.deb',
          'Ex: sudo dpkg -i ted-2.23-amd64.deb',
        );
        return join("\n", $output);
    }

    return parent::getHelpInstallation();
  }

  public function getVersionInfo() {
    $info = array(
        'ted' => 'unknown',
    );
    $v = $this->shell($this->cmd . " --version");
    if (preg_match('@Ted ([\d\.]+)@', $v, $arr)) {
      $info['ted'] = $arr[1];
    }
    return $info;
  }

  public function isAvailable() {
    $this->cmd = $this->shellWhich('Ted');
    return isset($this->cmd);
  }

}
{'fraction_non_alphanumeric': 0.1672224868985231, 'fraction_numerical': 0.005240590757503573, 'mean_word_length': 2.553299492385787, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3862141', 'n_tokens_mistral': 737, 'n_tokens_neox': 703, 'n_words': 145}