All pastes #185901 Raw Edit

Stuff

public text v1 · immutable
#185901 ·published 2006-09-29 12:11 UTC
rendered paste body
// This file is part of the COMP125 search engine assignment 
// Second semester, 2006
// Original Author: Steve Cassidy
//
// Student Name:
// Student ID: 
// 


#include "inverted_index.h"


int main() {

  StringSet ss;

  ss.insert("one");
  ss.insert("two");
  ss.insert("four");
  ss.insert("one");
  ss.insert("two");
  ss.insert("four");
  ss.insert("three");
  ss.insert("one");    

  if (ss.contains("one")) 
    cout << "ok - contains('one')\n";
  else
    cout << "fail - contains('one')\n";
    
  StringSet tt;

  tt.insert("four");
  tt.insert("two");
  tt.insert("four");
  tt.insert("five");
    
    StringSet result = ss.set_intersection(tt);
    
    
    ss.print();
    cout << "end of ss" << endl;
    
    /*
    //tt.print();    
    //cout << "end of tt" << endl;
    result.print();
    cout << "end of intersection" << endl;
    
    */
    
    StringSet newresult; 
    newresult = ss.set_union(tt);
     
    cout << "start of union" << endl;

    newresult.print();
    cout << "end of union" << endl;    
    
    
    
  /*
  // test the InvertedIndex 
  InvertedIndex idx;
  idx.tally("cat", "cats.txt");
  idx.tally("cat", "animals.txt");
  idx.tally("cat", "everything.txt");
  idx.tally("dog", "dogs.txt");

  // searching idx for cat should give us three files
  vector <string> query;
  query.push_back("cat");
  StringSet si = idx.search(query);
  if (si.contains("cats.txt") && si.contains("animals.txt") && si.contains("everything.txt") )
    cout << "ok - search('cat')\n";
  else 
    cout << "fail - search('cat')\n";

  if (si.contains("dogs.txt"))
    cout << "fail - search('cat') -- dogs.txt found\n";
  else 
    cout << "ok - search('cat') no dogs\n";

  */
  //system("PAUSE");
  cout << "the end" << endl;
  pause();
}