<commit_before>package org.deepdive.inference
import org.deepdive.settings._
import org.deepdive.Context
import java.io.File

object InferenceNamespace {
  
  val deepdivePrefix = "dd_"
  def WeightsTable = "dd_graph_weights"
  def lastWeightsTable = "dd_graph_last_weights"
  def FactorsTable = "dd_graph_factors"
  def VariablesTable = "dd_graph_variables"
  def VariablesMapTable = "dd_graph_variables_map"
  def WeightResultTable = "dd_inference_result_weights"
  def VariablesHoldoutTable = "dd_graph_variables_holdout"
  def VariableResultTable = "dd_inference_result_variables"
  def MappedInferenceResultView = "dd_mapped_inference_result"
  def IdSequence = "dd_variable_sequence"
  def FactorMetaTable = "dd_graph_factormeta"
  def VariablesObservationTable = "dd_graph_variables_observation"
  def LearnedWeightsTable = "dd_inference_result_weights_mapping"
  def FeatureStatsSupportTable = "dd_feature_statistics_support"
  def FeatureStatsView = "dd_feature_statistics"
  
  // internal tables
  def getWeightTableName(tableName: String) = s"dd_weights_${tableName}"
  def getQueryTableName(tableName: String) = s"dd_query_${tableName}"
  def getFactorTableName(tableName: String) = s"dd_factors_${tableName}"
  def getCardinalityTableName(relation: String, column: String) = s"dd_${relation}_${column}_cardinality"
  def getVariableTypeTableName(relation: String) = s"dd_${relation}_vtype"
  def getCardinalityInFactorTableName(prefix: String, idx: Int) = s"dd_${prefix}_cardinality_${idx}"

  // files
  def getVariableFileName(relation: String) = s"dd_variables_${relation}"
  def getFactorFileName(name: String) = s"dd_factors_${name}_out"
  def getWeightFileName = s"dd_weights"
  def getFactorMetaFileName = s"dd_factormeta"

  // variable data type id, it's an enum type used to communicate with the sampler
  def getVariableDataTypeId(variable: VariableDataType) : Int = {
    variable match {
      case BooleanType => 0
      case MultinomialType(x) => 1
    }
  }

  // factor funce type id, enum used to communicate with the sampler
  def getFactorFunctionTypeid(functionName: String) : Int = {
    functionName match {
      case "ImplyFactorFunction" => 0
      case "OrFactorFunction" => 1
      case "AndFactorFunction" => 2
      case "EqualFactorFunction" => 3
      case "IsTrueFactorFunction" =>  4
      case "MultinomialFactorFunction" => 5
      case "LinarFactorFunction" => 6
      case "RatioFactorFunction" => 7
      case "LogicalFactorFunction" => 8
    }
  }<commit_msg>fix factor funce type id<commit_after>package org.deepdive.inference
import org.deepdive.settings._
import org.deepdive.Context
import java.io.File

object InferenceNamespace {
  
  val deepdivePrefix = "dd_"
  def WeightsTable = "dd_graph_weights"
  def lastWeightsTable = "dd_graph_last_weights"
  def FactorsTable = "dd_graph_factors"
  def VariablesTable = "dd_graph_variables"
  def VariablesMapTable = "dd_graph_variables_map"
  def WeightResultTable = "dd_inference_result_weights"
  def VariablesHoldoutTable = "dd_graph_variables_holdout"
  def VariableResultTable = "dd_inference_result_variables"
  def MappedInferenceResultView = "dd_mapped_inference_result"
  def IdSequence = "dd_variable_sequence"
  def FactorMetaTable = "dd_graph_factormeta"
  def VariablesObservationTable = "dd_graph_variables_observation"
  def LearnedWeightsTable = "dd_inference_result_weights_mapping"
  def FeatureStatsSupportTable = "dd_feature_statistics_support"
  def FeatureStatsView = "dd_feature_statistics"
  
  // internal tables
  def getWeightTableName(tableName: String) = s"dd_weights_${tableName}"
  def getQueryTableName(tableName: String) = s"dd_query_${tableName}"
  def getFactorTableName(tableName: String) = s"dd_factors_${tableName}"
  def getCardinalityTableName(relation: String, column: String) = s"dd_${relation}_${column}_cardinality"
  def getVariableTypeTableName(relation: String) = s"dd_${relation}_vtype"
  def getCardinalityInFactorTableName(prefix: String, idx: Int) = s"dd_${prefix}_cardinality_${idx}"

  // files
  def getVariableFileName(relation: String) = s"dd_variables_${relation}"
  def getFactorFileName(name: String) = s"dd_factors_${name}_out"
  def getWeightFileName = s"dd_weights"
  def getFactorMetaFileName = s"dd_factormeta"

  // variable data type id, it's an enum type used to communicate with the sampler
  def getVariableDataTypeId(variable: VariableDataType) : Int = {
    variable match {
      case BooleanType => 0
      case MultinomialType(x) => 1
    }
  }

  // factor funce type id, enum used to communicate with the sampler
  def getFactorFunctionTypeid(functionName: String) : Int = {
    functionName match {
      case "ImplyFactorFunction" => 0
      case "OrFactorFunction" => 1
      case "AndFactorFunction" => 2
      case "EqualFactorFunction" => 3
      case "IsTrueFactorFunction" =>  4
      case "MultinomialFactorFunction" => 5
      case "LinearFactorFunction" => 7
      case "RatioFactorFunction" => 8
      case "LogicalFactorFunction" => 9
    }
  }
{'fraction_non_alphanumeric': 0.08733624454148471, 'fraction_numerical': 0.004366812227074236, 'mean_word_length': 5.198031980319803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '7319999', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1545, 'n_words': 350}