Пример #1
0
  public static void tok(String s) {
    try {
      br = new BufferedReader(new FileReader(s));
      while ((strLine = br.readLine()) != null) {
        String[] result =
            getlinetoken(
                strLine); // take one query and split it into its terms store each term in result
        // array
        int qno = result.length;
        // System.out.println("query terms are!");
        for (i = 0; i < qno; i++) {

          System.out.println(
              "FUNCTION: getPostings "
                  + result[
                      i]); // for each query term call getbydoc and getbyfreq to get its different
          // postings list
          Docindex.getbydoc(result[i]);
          Termindex.getbyfreq(result[i]);
        }
        // then call the taat and daat operations using their different indexes
        Termindex.taatand(strLine);
        Termindex.taator(strLine);
        Docindex.daatand(strLine);
        // Docindex2.daator(strLine);

      }
    } catch (FileNotFoundException e) {
      System.err.println("Unable to find the file: fileName");
    } catch (IOException e) {
      System.err.println("Unable to read the file: fileName");
    }
  }
Пример #2
0
  public static void main(String[] args) throws IOException {

    Docindex.createdoc(args[0]); // create index by docid
    Docindex2.createdoc(args[0]); // create another index to avoid duplication by docid operations
    System.setOut(new PrintStream(new FileOutputStream(args[1]))); // write to output file
    System.out.println("FUNCTION: getTopK " + args[2]);
    Docindex.gettopk(args[2]); // get topk using docindex
    Termindex.createfreq(
        args[0]); // create index with postings list ordered according to decreasing freq
    Querymanip.tok(args[3]); // pass the file with query string for manipulation
  }