-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileProcess.h
39 lines (36 loc) · 1.23 KB
/
FileProcess.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
31
32
33
34
35
36
37
38
39
#pragma once
#include "Utils.h"
namespace sse
{
struct BothAreSpaces
{
char c;
BothAreSpaces(char r) : c(r) {}
bool operator()(char l, char r) const
{
return r == c && l == c;
}
};
class FileReading
{
private:
mutex mtx;
std::map<string, std::vector<string> > file2words, invIndex;
void ProcessLine(string &line);
bool IsEnglish(string word);
void AddKeyword(string masterKey, string FjKey, string keywords, string fileName, SSEMap &TW, SSEMap &TF, MWMap &MW, MFMap &MF);
public:
FileReading();
void ReadIndex(string masterKey, SSEMap &TW, SSEMap &TF, MWMap &MW, MFMap &MF);
void BuildIndex(string masterKey, SSEMap &TW, SSEMap &TF, MWMap &MW, MFMap &MF);
void ReadFile(string path, string fileName);
int ReadWikiArchives(string &error);
int ReadWikiArchive(string &error);
void ReadFiles(string path);
void ConvertIndex2Sophos();
void WriteIndex();
void BuildInvertedIndex();
void WriteInvertedIndex();
void WriteIndexSophos(int nProcessed);
};
}//namespace