-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
73 lines (63 loc) · 3.06 KB
/
main.c
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
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "create_inverted_file_index.h"
int main(int argc, char** argv) {
FILE *postingsFilePtr,*docsFilePtr;
FILE *termsFilePtr;
int stoplist_cnt, i;
int currentTermID = 0;
char postingsFileNm[50] = "";
char docsFileNm[50] = "";
//char t[15];
int a;
/*for (a=1;a<50;a++){
printf("%d%c ",a,a);
}
getchar();
*/
//postingsFilePtr = fopen("termsWithDocs.txt", "w");
//fclose(postingsFilePtr);
termsFilePtr = fopen("/home/Izakey/Documents/MmeJoyce/One/ohsumed/terms.txt", "w");
stoplist_cnt = getstoplist(stoplist);
/*for (i=0;i<stoplist_cnt;i++){
printf("$$$%s****",stoplist[i]);getchar();}*/
/*printf("%d\n", stoplist_cnt);
getchar();
for (i = 0; i < stoplist_cnt; i++) {
printf("%d %s\n",i+1,stoplist[i]);
}getchar();*/
/* StopList_node stopListRoot = stopListNodeInit();
for (i = 0; i < stoplist_cnt; i++) {
//printf("%d %s %s\n",strlen(stoplist[i]),stoplist[i],"*");
insertStopLististElement(stopListRoot, stoplist[i]);
}*/
//printf("\n%d %s\n",searchStopLististTree(stopListRoot, "c"),"@@@@####$$$$%%%%");
//traverseStopListTree(stopListRoot);
Dict_node dictRoot = dictNodeInit(¤tTermID);
Term_Docs_Node termsDocsNode = termDocsNodeInit(0, 0);
DocLL docsNode = NULL;
initIntString();
/*strcpy(t,"mno");
insertDictElement(dictRoot,t);*/
/*insertDictElement(dictRoot,"ghi");
/*insertDictElement(dictRoot,"jkl");
insertDictElement(dictRoot,"abc");
insertDictElement(dictRoot,"def");
insertDictElement(dictRoot,"abc");
*/
//getDictTerms("ohsumed\\ohsumed87b.tar", &postingsFilePtr,&docsFilePtr, dictRoot, &termsDocsNode, &docsNode, postingsFileNm, docsFileNm,stoplist, stoplist_cnt, ¤tTermID);
getDictTerms("/home/Izakey/Documents/MmeJoyce/One/ohsumed/ohsumed88.tar",&postingsFilePtr,&docsFilePtr,dictRoot,&termsDocsNode,&docsNode,postingsFileNm,docsFileNm,stoplist,stoplist_cnt,¤tTermID);
getDictTerms("/home/Izakey/Documents/MmeJoyce/One/ohsumed/ohsumed89.tar",&postingsFilePtr,&docsFilePtr,dictRoot,&termsDocsNode,&docsNode,postingsFileNm,docsFileNm,stoplist,stoplist_cnt,¤tTermID);
getDictTerms("/home/Izakey/Documents/MmeJoyce/One/ohsumed/ohsumed90.tar",&postingsFilePtr,&docsFilePtr,dictRoot,&termsDocsNode,&docsNode,postingsFileNm,docsFileNm,stoplist,stoplist_cnt,¤tTermID);
getDictTerms("/home/Izakey/Documents/MmeJoyce/One/ohsumed/ohsumed91.tar",&postingsFilePtr,&docsFilePtr,dictRoot,&termsDocsNode,&docsNode,postingsFileNm,docsFileNm,stoplist,stoplist_cnt,¤tTermID);
storeTerms(dictRoot, termsFilePtr);
printf("%s\n", "Preparing to Store Postings");
storePostings(termsDocsNode, postingsFilePtr);
fclose(postingsFilePtr);
printf("%s\n", "Postings stored");
//ALSO STORE DOCUMENTS
storeDocuments(docsNode,docsFilePtr);
printf("%s\n", "Documents stored");
return (EXIT_SUCCESS);
}