Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <sstream>
  5. #include <vector>
  6. #include <limits> //I used std::numeric_limits<int>::max()
  7. #include "ics46goody.hpp"
  8. #include "stopwatch.hpp"
  9. #include "array_queue.hpp"
  10. #include "heap_priority_queue.hpp"
  11. #include "array_set.hpp"
  12. #include "bst_map.hpp"
  13.  
  14.  
  15. typedef ics::ArrayQueue<std::string> WordQueue;
  16. typedef ics::ArraySet<std::string> FollowSet;
  17. typedef ics::pair<WordQueue,FollowSet> CorpusEntry;
  18.  
  19. bool queue_lt(const WordQueue& a, const WordQueue& b) {
  20. for (WordQueue::Iterator ac = a.begin(), bc= b.begin(); ac != a.end(); ++ac,++bc)
  21. if (*ac < *bc) return true;
  22. else if (*ac > *bc) return false;
  23. return false;
  24. }
  25.  
  26. bool CorpusEntry_gt(const CorpusEntry& a, const CorpusEntry& b) {
  27. return queue_lt(a.first,b.first); // reverse of lt for queues
  28. }
  29.  
  30. typedef ics::HeapPriorityQueue<CorpusEntry,CorpusEntry_gt> CorpusPQ; //Convenient to supply gt at construction
  31. typedef ics::BSTMap<WordQueue,FollowSet,queue_lt> Corpus;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement