/*
    $Id: example.cc 1137 2007-04-17 18:03:28Z rvernica $

    Copyright (C) 2007 by The Regents of the University of California

    Redistribution of this file is permitted under the terms of the
    GNU Public License (GPL).

    Date: 27/03/2007
    Author: Rares Vernica <rvernica@ics.uci.edu>
*/

#include <iostream>

#include "sepia.h"
#include "util/input.h"
#include "util/misc.h"

using namespace std;

int main() 
{
  const string 
    filenameData = "dataset.txt", 
    filenameSepia = "sepia";

  vector<string> data;
  readString(data, filenameData);

  Sepia sepia = Sepia(data, 2, 3, 10, 10);

  // 1. pre-processing (generate signatures)

  sepia.build();

  // 2. save

  sepia.saveData(filenameSepia);

  // 3. use

  string que = "delmare";
  unsigned ed = 2;

  cout << "query:\t" << que << endl;
  cout << "edit-dist:\t" << ed << endl;
  cout << "estimate selectivity:\t" << sepia.getEstimateSelectivity(que, ed)
       << endl;  
  cout << "real selectivity:\t" << sepia.getRealSelectivity(que, ed) << endl;
}

