<commit_before>package concrete.generator.constraint;

import concrete.constraint.semantic.Clause
import concrete.{ Variable, Problem }
import cspom.CSPOMConstraint
import cspom.variable.CSPOMVariable
import cspom.variable.CSPOMConstant
import cspom.variable.BoolVariable
import Generator._
import cspom.variable.CSPOMSeq

final object ClauseGenerator extends Generator {

  override def gen(gC: CSPOMConstraint[Boolean])(implicit variables: VarMap) = {
    require(gC.function == 'clause, "Unexpected constraint " + gC)
    val Seq(positive: CSPOMSeq[_], negative: CSPOMSeq[_]) = gC.arguments

    val posConc = positive.map(cspom2concreteVar).toArray
    val negConc = negative.map(cspom2concreteVar).toArray

    Seq(new Clause(posConc, negConc))
  }

}<commit_msg>Accepts constants in Clause generation<commit_after>package concrete.generator.constraint;

import Generator._
import concrete.Variable
import concrete.constraint.semantic.Clause
import cspom.CSPOMConstraint
import cspom.variable.BoolVariable
import cspom.variable.CSPOMConstant
import cspom.variable.CSPOMSeq
import cspom.variable.CSPOMVariable

final object ClauseGenerator extends Generator {

  override def gen(gC: CSPOMConstraint[Boolean])(implicit variables: VarMap) = {
    require(gC.function == 'clause, "Unexpected constraint " + gC)
    val Seq(positive: CSPOMSeq[_], negative: CSPOMSeq[_]) = gC.arguments

    if (positive.exists {
      case CSPOMConstant(true) => true
      case _                   => false
    } || negative.exists {
      case CSPOMConstant(false) => true
      case _                    => false
    }) {
      Seq()
    } else {

      val posConc = positive.collect { case v: BoolVariable => cspom2concreteVar(v) }.toArray
      val negConc = negative.collect { case v: BoolVariable => cspom2concreteVar(v) }.toArray

      Seq(new Clause(posConc, negConc))
    }
  }

}
{'fraction_non_alphanumeric': 0.09541577825159915, 'fraction_numerical': 0.0021321961620469083, 'mean_word_length': 4.072972972972973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3140404', 'n_tokens_mistral': 601, 'n_tokens_neox': 578, 'n_words': 129}