-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordStat.h
30 lines (27 loc) · 963 Bytes
/
wordStat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef WORDSTAT_H
#define WORDSTAT_H
#include <iostream>
#include <fstream>
#include <string.h>
#include <sstream>
#include <vector>
#include <map>
#include <stdio.h>
#include <algorithm> // for sort() function
#include <iterator>
using namespace std;
typedef std::map<std::string, int> StrIntMap;
typedef std::pair<std::string, int> PairVect;
class WordStat
{
public:
WordStat(){};
std::vector<std::string> readFileToVector(const char* fileName = "my_vocabluary.txt");
bool checkWord(std::vector<std::string> words, const char* search);
void writeStatToFile(const std::vector<PairVect>& vec,const char* fileName = "wordsAnalysis.txt",bool justWords=1);
std::vector<PairVect > sort_by_weight(StrIntMap& s_map);
void noCharact(std::string str, std::vector<std::string>& vect);
std::string convertToLower(std::string str);
void countWords(ifstream& file, std::map<std::string,int>& dict, std::vector<std::string> my_vocabluary);
};
#endif