-
Notifications
You must be signed in to change notification settings - Fork 2
/
FileIndex.h
61 lines (54 loc) · 1.3 KB
/
FileIndex.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#pragma comment(lib, "NLPIR.lib")
#include <string>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <windows.h>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#include <list>
#include "Reader.h"
#include "NLPIR.h"
#include <qprocess.h>
#include <FileEntry.h>
#include <algorithm>
#include "USNParser.h"
class fword {
public:
std::wstring word;
double tfidf;
int freq;
};
class FileInfo {
public:
FILEREF FileNum;
std::wstring FileName;
std::wstring FilePath;
std::wstring FileContent;
int max_freq;
FileInfo(FILEREF num, const std::wstring& path);
std::wstring identifyName(const std::wstring& path);
std::vector<fword> words;
};
class post {
public:
FILEREF FileNum;
double FreqNum;
};
class FileIndex {
public:
std::list<FileInfo> Files;
std::unordered_map<std::wstring, std::list<post>> DB;
FileIndex(USNParser* driver);
FileIndex(const FileIndex&) = delete;
FileIndex& operator=(const FileIndex&) = delete;
void InsertFiles(const std::wstring& dir);
void InsertFileIndex(FILEREF num, const std::wstring& path);
void DeleteFileIndex(const std::wstring& path);
bool exist(FILEREF num);
std::set<FileEntry*> SearchFile(const std::wstring& sentence);
void Calctfidf();
USNParser* driver;
};