<commit_before><?php

namespace Asoc\DadatataBundle\Command;

use Asoc\Dadatata\Tool\PdfBox;
use Asoc\Dadatata\Tool\Tesseract;
use Asoc\Dadatata\Tool\Unoconv;
use Asoc\Dadatata\ToolInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ToolCheckCommand extends ContainerAwareCommand {

    protected function configure()
    {
        $this->setName('dadatata:tool-check')
            ->setDescription('Check available tools');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Tools installed:');

        $tools = ['unoconv', 'tesseract', 'pdfbox'];
        foreach($tools as $name) {
            switch($name) {
                case 'unoconv':
                    $tool = Unoconv::create();
                    break;
                case 'tesseract':
                    $tool = Tesseract::create();
                    break;
                case 'pdfbox':
                    $tool = PdfBox::create();
                    break;
                default:
                    $tool = null;
                    break;
            }

            $this->checkTool($output, $name, $tool);
        }
    }

    private function checkTool(OutputInterface $output, $name, ToolInterface $tool = null) {
        if(null === $tool) {
            $output->writeln(sprintf('  %s: <warning>not available</warning>', $name));
        }
        else {<commit_msg><warning> console formatter does not exist, use <comment><commit_after><?php

namespace Asoc\DadatataBundle\Command;

use Asoc\Dadatata\Tool\PdfBox;
use Asoc\Dadatata\Tool\Tesseract;
use Asoc\Dadatata\Tool\Unoconv;
use Asoc\Dadatata\ToolInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ToolCheckCommand extends ContainerAwareCommand {

    protected function configure()
    {
        $this->setName('dadatata:tool-check')
            ->setDescription('Check available tools');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Tools installed:');

        $tools = ['unoconv', 'tesseract', 'pdfbox'];
        foreach($tools as $name) {
            switch($name) {
                case 'unoconv':
                    $tool = Unoconv::create();
                    break;
                case 'tesseract':
                    $tool = Tesseract::create();
                    break;
                case 'pdfbox':
                    $tool = PdfBox::create();
                    break;
                default:
                    $tool = null;
                    break;
            }

            $this->checkTool($output, $name, $tool);
        }
    }

    private function checkTool(OutputInterface $output, $name, ToolInterface $tool = null) {
        if(null === $tool) {
            $output->writeln(sprintf('  %s: <comment>not available</comment>', $name));
        }
        else {
{'fraction_non_alphanumeric': 0.11889663918833228, 'fraction_numerical': 0.0, 'mean_word_length': 2.0220306513409962, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5496899', 'n_tokens_mistral': 888, 'n_tokens_neox': 853, 'n_words': 171}