Advertisement
Anophoo

rss

Nov 15th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. setbuf(stdout, NULL);
  2. Welcome(kWelcomeTextFile);
  3. int numBuckets = 10007;
  4. hashset stopWords;
  5. HashSetNew(&stopWords, sizeof(char*), numBuckets, Whashfn, Wcomparefn, Wfreefn);
  6. hashset articles;
  7. HashSetNew(&articles, sizeof(struct article), numBuckets, Ahashfn, Acomparefn, Afreefn);
  8. printf("%s\n", "sheiqmna es upatrono 'articles'.");
  9. hashset allWords;
  10. HashSetNew(&allWords, sizeof(wordData), numBuckets, Dhashfn, Dcomparefn, Dfreefn);
  11. printf("%s\n", "sheiqmna es upatrono 'allWords'.");
  12. // --------------------------------------------------------------------------
  13. FILE *infile;
  14. streamtokenizer st;
  15. char buffer[1024];
  16. infile = fopen(stoplist, "r");
  17. assert(infile != NULL);
  18. printf("%s\n", "after assert");
  19. STNew(&st, infile, kNewLineDelimiters, true);
  20. while (STNextToken(&st, buffer, sizeof(buffer))) {
  21. char* b = strdup(buffer);
  22. // printf("%s\n", b);
  23. HashSetEnter(&stopWords, &b);
  24. }
  25. printf("\n");
  26. STDispose(&st); // remember that STDispose doesn't close the file, since STNew doesn't open one..
  27. fclose(infile);
  28. // --------------------------------------------------------------------------
  29. printf("%d\n", HashSetCount(&stopWords));
  30. printf("%s\n", kDefaultFeedsFile);
  31. BuildIndices(&stopWords, &allWords, &articles, (argc == 1) ? kDefaultFeedsFile : argv[1]);
  32. QueryIndices(&stopWords, &allWords);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement