<commit_before>//
//  DocumentDistance.h
//  Algorithms
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 Me. All rights reserved.
//

#ifndef __Algorithms__DocumentDistance__
#define __Algorithms__DocumentDistance__

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <locale>
#include <map>
#include <vector>

// define a new locale to ignore non-alphanumeric characters
struct alpha_num : std::ctype<char>
{
    alpha_num(): std::ctype<char>(get_table()) {}
    
    static std::ctype_base::mask const* get_table()
    {
        static std::vector<std::ctype_base::mask> rc(std::ctype<char>::table_size, std::ctype_base::space);
        
        // fill the vector with alphanumerics
        std::fill(&rc['0'], &rc['9'], std::ctype_base::digit);
        std::fill(&rc['a'], &rc['z'], std::ctype_base::lower);
        std::fill(&rc['A'], &rc['Z'], std::ctype_base::upper);
        return &rc[0];
    }
};

// Document distance problem
// Template class
// assumes we want to ignore non-alphanumeric characters
template <typename T> class Document
{
public:
    Document() = default;
    <commit_msg>Document Distance<commit_after>//
//  DocumentDistance.h
//  Algorithms
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 Me. All rights reserved.
//

#ifndef __Algorithms__DocumentDistance__
#define __Algorithms__DocumentDistance__

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <locale>
#include <map>
#include <vector>

// define a new locale to ignore non-alphanumeric characters
struct alpha_num : std::ctype<char> 
{
    alpha_num(): std::ctype<char>(get_table()) {}
    
    static std::ctype_base::mask const* get_table()
    {
        static std::vector<std::ctype_base::mask> rc(std::ctype<char>::table_size, std::ctype_base::space);
        
        // fill the vector with alphanumerics
        std::fill(&rc['0'], &rc['9'], std::ctype_base::digit);
        std::fill(&rc['a'], &rc['z'], std::ctype_base::lower);
        std::fill(&rc['A'], &rc['Z'], std::ctype_base::upper);
        return &rc[0];
    }
};

// Document distance problem
// Template class
// assumes we want to ignore non-alphanumeric characters
template <typename T> class Document
{
public:
    Document() = default;
    
{'fraction_non_alphanumeric': 0.16499345264076823, 'fraction_numerical': 0.00960279353993889, 'mean_word_length': 3.8456659619450315, 'pattern_counts': {'":': 0, '<': 29, '<?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': '4805865', 'n_tokens_mistral': 762, 'n_tokens_neox': 732, 'n_words': 181}