<commit_before>package ch.unibas.dmi.dbis.adam.index.structures.lsh.signature

import ch.unibas.dmi.dbis.adam.datatypes.bitString.BitString
import ch.unibas.dmi.dbis.adam.datatypes.feature.Feature._
import ch.unibas.dmi.dbis.adam.index.structures.lsh.hashfunction.Hasher
import ch.unibas.dmi.dbis.adam.index.structures.va.signature.FixedSignatureGenerator

/**
  * ADAMpro
  *
  * <NAME>
  * August 2016
  */
class LSHSignatureGenerator(hashTables : Seq[Hasher], m : Int) extends Serializable {
  val signatureGenerator = new FixedSignatureGenerator(hashTables.length, math.ceil(math.log(m) / math.log(2)).toInt)

  def toSignature(f: FeatureVector) : BitString[_] = {
    signatureGenerator.toSignature(toBuckets(f))
  }

  def toBuckets(f: FeatureVector) = {
    hashTables.map(ht => ht(f,m))
  }
<commit_msg>added comments<commit_after>package ch.unibas.dmi.dbis.adam.index.structures.lsh.signature

import ch.unibas.dmi.dbis.adam.datatypes.bitString.BitString
import ch.unibas.dmi.dbis.adam.datatypes.feature.Feature._
import ch.unibas.dmi.dbis.adam.index.structures.lsh.hashfunction.Hasher
import ch.unibas.dmi.dbis.adam.index.structures.va.signature.FixedSignatureGenerator

/**
  * ADAMpro
  *
  * <NAME>
  * August 2016
  */
class LSHSignatureGenerator(hashTables : Seq[Hasher], m : Int) extends Serializable {
  val signatureGenerator = new FixedSignatureGenerator(hashTables.length, math.ceil(math.log(m) / math.log(2)).toInt)

  /**
    *
    * @param f
    * @return
    */
  def toSignature(f: FeatureVector) : BitString[_] = {
    signatureGenerator.toSignature(toBuckets(f))
  }

  /**
    *
    * @param f
    * @return
    */
  def toBuckets(f: FeatureVector) = {
    hashTables.map(ht => ht(f,m))
  }

  /**
    *
    * @param b
    * @return
    */
{'fraction_non_alphanumeric': 0.1380871533672892, 'fraction_numerical': 0.005659309564233163, 'mean_word_length': 3.857142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5456953', 'n_tokens_mistral': 678, 'n_tokens_neox': 646, 'n_words': 84}