<commit_before><?php

namespace Gpupo\Similarity;

Use Gpupo\Similarity\Input\InputInterface;

abstract class SimilarityAbstract
{
    const ACCURACY_DEFAULT = 60;
    
    protected $input;

    protected $accuracy;

    protected function getAccuracy()
    {
        if (empty($this->accuracy)) {
            $this->setAccuracy(self::ACCURACY_DEFAULT);
        }

        return $this->accuracy;
    }

    public function setAccuracy($number)
    {
        $this->accuracy = intval($number);

        return $this;
    }
    
    public function isApproximate()
    {
        $calc = $this->getProximityCalculation();

        if ($calc['difference'] <= $calc['limit']['maxDifference']) {
            return true;
        }

        return false;
    }

    protected function getInput()
    {
        if (empty($this->input)) {
            throw new \BadMethodCallException('Missing Input');
        } elseif (!$this->input instanceof InputInterface) {
            throw new \BadMethodCallException('Incompatible Input');
        }

        return $this->input;
    }

    protected function factoryExpert($name)
    {
        $expertObject = __NAMESPACE__ . '\\Similar' . $name;

        $expert =  new $expertObject($this->getInput(), $this->getAccuracy());

        return $expert;
    }<commit_msg>Fix factory case<commit_after><?php

namespace Gpupo\Similarity;

Use Gpupo\Similarity\Input\InputInterface;

abstract class SimilarityAbstract
{
    const ACCURACY_DEFAULT = 60;
    
    protected $input;

    protected $accuracy;

    protected function getAccuracy()
    {
        if (empty($this->accuracy)) {
            $this->setAccuracy(self::ACCURACY_DEFAULT);
        }

        return $this->accuracy;
    }

    public function setAccuracy($number)
    {
        $this->accuracy = intval($number);

        return $this;
    }
    
    public function isApproximate()
    {
        $calc = $this->getProximityCalculation();

        if ($calc['difference'] <= $calc['limit']['maxDifference']) {
            return true;
        }

        return false;
    }

    protected function getInput()
    {
        if (empty($this->input)) {
            throw new \BadMethodCallException('Missing Input');
        } elseif (!$this->input instanceof InputInterface) {
            throw new \BadMethodCallException('Incompatible Input');
        }

        return $this->input;
    }

    protected function factoryExpert($name)
    {
        $expertObject = __NAMESPACE__ . '\\Similar' . ucfirst($name);

        $expert =  new $expertObject($this->getInput(), $this->getAccuracy());

        return $expert;
    }
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.001524390243902439, 'mean_word_length': 2.3185840707964602, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '6949928', 'n_tokens_mistral': 794, 'n_tokens_neox': 745, 'n_words': 150}