Skip to content
Snippets Groups Projects
Commit f2efce2b authored by Nicholas Yang's avatar Nicholas Yang
Browse files

testing with moment and life

parent f479081f
No related branches found
No related tags found
1 merge request!9Website
No preview for this file type
......@@ -16,9 +16,6 @@ public:
size_t numberDocuments;
size_t numberWords;
std::vector<Chunk> chunks;
private:
MMDiskHashTable master = MMDiskHashTable(util::GetCurrentWorkingDir() +
IndexerConstants::pathToIndex +
"master.txt",
......
......@@ -6,11 +6,6 @@ class WordInfo {
public:
/**
* Meant to parse in input from master DHT
* @param value Value from DHT
*/
WordInfo() {
chunks = std::vector<int>();
frequency = 0;
......@@ -18,6 +13,10 @@ public:
lastLocation = 0;
}
/**
* Meant to parse in input from master DHT
* @param value Value from DHT
*/
WordInfo(string value) {
if(value == "") {
return;
......
......@@ -15,5 +15,27 @@ int main() {
cout << "\tNumber documents: " << corpus.chunks[i].numberDocs << endl;
cout << "\tEnding offset: " << corpus.chunks[i].lastLocation << endl;
}
WordInfo momentInfo = corpus.getWordInfo("moment");
cout << "Moment" << endl;
cout << "\tChunks: ";
for(auto chunk : momentInfo.chunks) {
cout << chunk << " ";
}
cout << endl;
cout << "\tDocument frequency: " << momentInfo.docFrequency << endl;
cout << "\tFrequency: " << momentInfo.frequency << endl;
cout << "\tLast location: " << momentInfo.lastLocation << endl;
WordInfo lifeInfo = corpus.getWordInfo("life");
cout << "Life" << endl;
cout << "\tChunks: ";
for(auto chunk : lifeInfo.chunks) {
cout << chunk << " ";
}
cout << endl;
cout << "\tDocument frequency: " << lifeInfo.docFrequency << endl;
cout << "\tFrequency: " << lifeInfo.frequency << endl;
cout << "\tLast location: " << lifeInfo.lastLocation << endl;
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment