<commit_before>#ifndef KTABLE_HH
#define KTABLE_HH

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <assert.h>

#include "khmer.hh"

// test validity
#define is_valid_dna(ch) ((toupper(ch)) == 'A' || (toupper(ch)) == 'C' || \
			  (toupper(ch)) == 'G' || (toupper(ch)) == 'T')

// bit representation of A/T/C/G.
#define twobit_repr(ch) ((toupper(ch)) == 'A' ? 0LL : \
                         (toupper(ch)) == 'T' ? 1LL : \
                         (toupper(ch)) == 'C' ? 2LL : 3LL)

#define revtwobit_repr(n) ((n) == 0 ? 'A' : \
                           (n) == 1 ? 'T' : \
                           (n) == 2 ? 'C' : 'G')

#define twobit_comp(ch) ((toupper(ch)) == 'A' ? 1LL : \
                         (toupper(ch)) == 'T' ? 0LL : \
                         (toupper(ch)) == 'C' ? 3LL : 2LL)

// choose wisely between forward and rev comp.
#define uniqify_rc(f, r) ((f) < (r) ? (f) : (r))


namespace khmer {
  // two-way hash functions.
  HashIntoType _hash(const char * kmer, const WordLength k);
  HashIntoType _hash(const char * kmer, const WordLength k,
			      HashIntoType& h, HashIntoType& r);
  HashIntoType _hash_forward(const char * kmer, WordLength k);

  std::string _revhash(HashIntoType hash, WordLength k);

  //
  // KTable class: keep track of k-mer prevalences.
  //
  // the main (so far only...) class in khmer.
  //

  class KTable {
  protected:
    WordLength _ksize;	// 'k'
    HashIntoType _max_hash;	// 4**k

    ExactCounterType * _counts;	// counts table.

    // allocate the counts table.
    void _allocate_counters() {
      // allocate.
      _counts = new ExactCounterType[n_entries()];<commit_msg>temp mirror<commit_after>#ifndef KTABLE_HH
#define KTABLE_HH

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <assert.h>

#include "khmer.hh"

// test validity
#define is_valid_dna(ch) ((toupper(ch)) == 'A' || (toupper(ch)) == 'C' || \
			  (toupper(ch)) == 'G' || (toupper(ch)) == 'T')

// bit representation of A/T/C/G.
#define twobit_repr(ch) ((toupper(ch)) == 'A' ? 0LL : \
                         (toupper(ch)) == 'T' ? 1LL : \
                         (toupper(ch)) == 'C' ? 2LL : 3LL)

#define revtwobit_repr(n) ((n) == 0 ? 'A' : \
                           (n) == 1 ? 'T' : \
                           (n) == 2 ? 'C' : 'G')

#define twobit_comp(ch) ((toupper(ch)) == 'A' ? 1LL : \
                         (toupper(ch)) == 'T' ? 0LL : \
                         (toupper(ch)) == 'C' ? 3LL : 2LL)

// choose wisely between forward and rev comp.
//#define uniqify_rc(f, r) ((f) < (r) ? (f) : (r))
#define uniqify_rc(f,r)(f)


namespace khmer {
  // two-way hash functions.
  HashIntoType _hash(const char * kmer, const WordLength k);
  HashIntoType _hash(const char * kmer, const WordLength k,
			      HashIntoType& h, HashIntoType& r);
  HashIntoType _hash_forward(const char * kmer, WordLength k);

  std::string _revhash(HashIntoType hash, WordLength k);

  //
  // KTable class: keep track of k-mer prevalences.
  //
  // the main (so far only...) class in khmer.
  //

  class KTable {
  protected:
    WordLength _ksize;	// 'k'
    HashIntoType _max_hash;	// 4**k

    ExactCounterType * _counts;	// counts table.

    // allocate the counts table.
    void _allocate_counters() {
      // allocate.
      _counts = new ExactCounterType[n_entries()];
{'fraction_non_alphanumeric': 0.1732513901082821, 'fraction_numerical': 0.007023705004389816, 'mean_word_length': 2.2928709055876686, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '6221575', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1259, 'n_words': 314}