<commit_before><?php

namespace EasyMinerCenter\Model\EasyMiner\Facades;

use EasyMinerCenter\Model\EasyMiner\Entities\Cedent;
use EasyMinerCenter\Model\EasyMiner\Entities\Rule;
use EasyMinerCenter\Model\EasyMiner\Entities\RuleAttribute;
use EasyMinerCenter\Model\EasyMiner\Entities\Task;
use EasyMinerCenter\Model\EasyMiner\Repositories\CedentsRepository;
use EasyMinerCenter\Model\EasyMiner\Repositories\RuleAttributesRepository;
use EasyMinerCenter\Model\EasyMiner\Repositories\RulesRepository;
use Nette\Utils\Strings;


/**
 * Class RulesFacade - třída pro práci s pravidly v DB
 * @package EasyMinerCenter\Model\EasyMiner\Facades
 */
class RulesFacade {
  /** @var  RulesRepository $rulesRepository */
  private $rulesRepository;
  /** @var  CedentsRepository $cedentsRepository */
  private $cedentsRepository;
  /** @var  RuleAttributesRepository $ruleAttributesRepository */
  private $ruleAttributesRepository;

  /**
   * @param int $ruleId
   * @return Rule
   */
  public function findRule($ruleId){
    return $this->rulesRepository->find($ruleId);
  }

  /**
   * @param int $taskId
   * @param int $pmmlRuleId
   * @return Rule
   * @throws \EasyMinerCenter\Exceptions\EntityNotFoundException
   */
  public function findRuleByPmmlImportId($taskId,$pmmlRuleId){
    return $this->rulesRepository->findBy(['task_id'=>$taskId,'pmml_rule_id'=>$pmmlRuleId]);
  }

  private function getRulesOrderFormula($order){
    $formulasArr=[
      'default'=>'',
      'fui'=>'confidence DESC',
      'confidence'=>'confidence DESC',
      'supp'=>'support DESC',
      'support'=>'support DESC',
      'add'=>'lift DESC',
      'lift'=>'lift DESC',<commit_msg>oprava problému s výchozím řazením pravidel<commit_after><?php

namespace EasyMinerCenter\Model\EasyMiner\Facades;

use EasyMinerCenter\Model\EasyMiner\Entities\Cedent;
use EasyMinerCenter\Model\EasyMiner\Entities\Rule;
use EasyMinerCenter\Model\EasyMiner\Entities\RuleAttribute;
use EasyMinerCenter\Model\EasyMiner\Entities\Task;
use EasyMinerCenter\Model\EasyMiner\Repositories\CedentsRepository;
use EasyMinerCenter\Model\EasyMiner\Repositories\RuleAttributesRepository;
use EasyMinerCenter\Model\EasyMiner\Repositories\RulesRepository;
use Nette\Utils\Strings;


/**
 * Class RulesFacade - třída pro práci s pravidly v DB
 * @package EasyMinerCenter\Model\EasyMiner\Facades
 */
class RulesFacade {
  /** @var  RulesRepository $rulesRepository */
  private $rulesRepository;
  /** @var  CedentsRepository $cedentsRepository */
  private $cedentsRepository;
  /** @var  RuleAttributesRepository $ruleAttributesRepository */
  private $ruleAttributesRepository;

  /**
   * @param int $ruleId
   * @return Rule
   */
  public function findRule($ruleId){
    return $this->rulesRepository->find($ruleId);
  }

  /**
   * @param int $taskId
   * @param int $pmmlRuleId
   * @return Rule
   * @throws \EasyMinerCenter\Exceptions\EntityNotFoundException
   */
  public function findRuleByPmmlImportId($taskId,$pmmlRuleId){
    return $this->rulesRepository->findBy(['task_id'=>$taskId,'pmml_rule_id'=>$pmmlRuleId]);
  }

  private function getRulesOrderFormula($order){
    $formulasArr=[
      'default'=>'rule_id',
      'fui'=>'confidence DESC',
      'confidence'=>'confidence DESC',
      'supp'=>'support DESC',
      'support'=>'support DESC',
      'add'=>'lift DESC',
      'lift'=>'lift DESC',
{'fraction_non_alphanumeric': 0.12667261373773417, 'fraction_numerical': 0.0, 'mean_word_length': 4.840277777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '3095702', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1083, 'n_words': 182}