<commit_before>#include<iostream>
#include<stdio.h>
#include<fstream>
#include<string>
#include<sstream>
#include<map>

using namespace std;

void getPrimes(int *primes, int n);
unsigned long long int getHash(string str, int primes[]);
string convertLongToString(unsigned long long int);
void insertInMap(string key, string value, map<string, string> & primeAnagram);
void writeMapToFile(std::map<string, string> primeAnagram); 



int main () {
  string word;
  int primes[26];
  map<string, string> primeAnagram;
  
  getPrimes(primes,26);

  ifstream inputFile ("sowpods.txt");
  if (inputFile.is_open()){
    while ( getline (inputFile,word) ){
      string hash = convertLongToString(getHash(word,primes));
      insertInMap(hash, word, primeAnagram);
      //cout << hash<<endl;
      //getchar();
    }
    inputFile.close();
  }
  else {
    cerr << "Unable to open file" <<endl;
  } 
	
  writeMapToFile(primeAnagram);
  return 0;
}


unsigned long long int getHash(string str,int primes[]) {
  unsigned long long int hash=1;
  for (int i = 0; i< str.length(); i++) {
    hash *= primes[str[i]-'a'];
  }

  return hash;
}

void getPrimes(int *primes, int n) {
  int count = 1;
  primes[0] = 2;
  int curNum = 3;<commit_msg>Fix:Minor:Move map to local<commit_after>#include<iostream>
#include<stdio.h>
#include<fstream>
#include<string>
#include<sstream>
#include<map>

#define NCHAR 26


using namespace std;

void getPrimes(int *primes, int n);
unsigned long long int getHash(string str, int primes[]);
string convertLongToString(unsigned long long int);
void insertInMap(string key, string value, map<string, string> & primeAnagram);
void writeMapToFile(std::map<string, string> primeAnagram); 



int main () {
  string word;
  int primes[NCHAR];
  map<string, string> primeAnagram;
  
  getPrimes(primes,NCHAR);

  ifstream inputFile ("sowpods.txt");
  if (inputFile.is_open()){
    while ( getline (inputFile,word) ){
      string hash = convertLongToString(getHash(word,primes));
      insertInMap(hash, word, primeAnagram);
    }
    inputFile.close();
  }
  else {
    cerr << "Unable to open file" <<endl;
  } 
	
  writeMapToFile(primeAnagram);
  return 0;
}


unsigned long long int getHash(string str,int primes[]) {
  unsigned long long int hash=1;
  for (int i = 0; i< str.length(); i++) {
    hash *= primes[str[i]-'a'];
  }

  return hash;
}

void getPrimes(int *primes, int n) {
  int count = 1;
  primes[0] = 2;
  int curNum = 3;
{'fraction_non_alphanumeric': 0.14058679706601468, 'fraction_numerical': 0.008149959250203748, 'mean_word_length': 4.190274841437632, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 21, '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': '1111840', 'n_tokens_mistral': 898, 'n_tokens_neox': 855, 'n_words': 228}