Package cc.twittertools.thrift.gen

Examples of cc.twittertools.thrift.gen.TResult


        allResults.add(c.getFirstMember());
      }
     
      int i = 0;
      for (long result : allResults) {
        TResult hit = seenResults.get(result);
        out.println(String.format("%s Q0 %s %d %f %s", query.getTitle(), hit.getId(), i, hit.getRsv(), runTag));
        i++;
      }
    }
    out.close();
    err.close();
View Full Code Here


    // record hits, removing duplicates
    int i = 1;
    Map<Long, TResult> seenMap = new HashMap<Long, TResult>();
    Iterator<TResult> hitIterator = results.iterator();
    while(hitIterator.hasNext()) {
      TResult hit = hitIterator.next();
      if (hit.getRsv() < cutOffScore) {
        break;
      }
     
      long docId = hit.id;
      if (seenMap.containsKey(docId))
View Full Code Here

      int i = 1;
      int dupliCount = 0;
      double rsvPrev = 0;
      for (TResultComparable sortedResult : sortedResults) {
        TResult result = sortedResult.getTResult();
        double rsvCurr = result.rsv;
        if (Math.abs(rsvCurr - rsvPrev) > 0.0000001) {
          dupliCount = 0;
        } else {
          dupliCount ++;
          rsvCurr = rsvCurr - 0.000001 / numResults * dupliCount;
        }
        // The TREC official qrels don't have the "MB" prefix and trailing zeros, so we perform
        // this transformation so that trec_eval doesn't complain.
        String qid = query.getId().replaceFirst("^MB0*", "");
        out.println(String.format("%s Q0 %d %d %." + (int) (6 + Math.ceil(Math.log10(numResults))) + "f %s",
            qid, result.id, i, rsvCurr, runtag));
        if (verbose) {
          out.println("# " + result.toString().replaceAll("[\\n\\r]+", " "));
        }
        i++;
        rsvPrev = result.rsv;
      }

View Full Code Here

 
  private JaccardStore computeJaccardSimilarity() { 
    // compute jaccard similarity for each pair of results
    JaccardStore scores = new JaccardStore();
    for (int j = 0; j < results.size(); j++) {
      TResult doc1 = results.get(j);
      for (int k = j + 1; k < results.size(); k++) {
        TResult doc2 = results.get(k);
       
        double jaccardSim = JaccardStore.computeJaccardSimilarity(doc1.getText(), doc2.getText());
        scores.setScore(doc1.getId(), doc2.getId(), jaccardSim);
      }
    }
   
    return scores;
  }
View Full Code Here

        runTag = DEFAULT_RUNTAG;

      int i = 1;
      Iterator<TResult> hitIterator = results.iterator();
      while(hitIterator.hasNext()) {
        TResult hit = hitIterator.next();
        out.println(String.format("%s Q0 %s %d %f %s", query.getTitle(), hit.getId(), i,
            hit.getRsv(), runTag));

        if(i++ >= numResults)
          break;
      }
View Full Code Here

      double[] rsvs = new double[relDocs.size()];
      int k=0;
      Iterator<TResult> hitIterator = relDocs.iterator();
      while(hitIterator.hasNext()) {
        TResult hit = hitIterator.next();
        rsvs[k++] = hit.getRsv();
      }
     
      hitIterator = relDocs.iterator();
      while(hitIterator.hasNext()) {
        TResult hit = hitIterator.next();
        String text = hit.getText().toLowerCase();
        FeatureVector docVector = new FeatureVector(text, stopper);
        vocab.addAll(docVector.getFeatures());
        fbDocVectors.add(docVector);
      }
View Full Code Here

      results = client.search(query,upperBoundTime, count);
     
      // store our text for future reference
      Iterator<TResult> resultIterator = results.iterator();
      while(resultIterator.hasNext()) {
        TResult result = resultIterator.next();
        seenDocs.put(Long.toString(result.getId()), result.getText());
      }
    } catch (Exception e) {

    }
    return results;
View Full Code Here

      Query q = QUERY_PARSER.parse(query.text);
      TopDocs rs = searcher.search(q, filter, query.num_results);
      for (ScoreDoc scoreDoc : rs.scoreDocs) {
        Document hit = searcher.doc(scoreDoc.doc);

        TResult p = new TResult();
        // TODO: Fix String parsing.
        p.id = Long.parseLong(hit.get(StatusField.ID.name));
        p.screen_name = hit.get(StatusField.SCREEN_NAME.name);
        p.epoch = Long.parseLong(hit.get(StatusField.EPOCH.name));
        p.text = hit.get(StatusField.TEXT.name);
View Full Code Here

      int i = 1;
      int dupliCount = 0;
      double rsvPrev = 0;
      for (TResultComparable sortedResult : sortedResults) {
        TResult result = sortedResult.getTResult();
        double rsvCurr = result.rsv;
        if (Math.abs(rsvCurr - rsvPrev) > 0.0000001) {
          dupliCount = 0;
        } else {
          dupliCount ++;
          rsvCurr = rsvCurr - 0.000001 / numResults * dupliCount;
        }
        out.println(String.format("%s Q0 %d %d %." + (int) (6 + Math.ceil(Math.log10(numResults))) + "f %s",
            query.getId(), result.id, i, rsvCurr, runtag));
        if (verbose) {
          out.println("# " + result.toString().replaceAll("[\\n\\r]+", " "));
        }
        i++;
        rsvPrev = result.rsv;
      }

View Full Code Here

      Query q = QUERY_PARSER.parse(query.text);
      TopDocs rs = searcher.search(q, filter, query.num_results);
      for (ScoreDoc scoreDoc : rs.scoreDocs) {
        Document hit = searcher.doc(scoreDoc.doc);

        TResult p = new TResult();
        // TODO: Fix String parsing.
        p.id = Long.parseLong(hit.get(StatusField.ID.name));
        p.screen_name = hit.get(StatusField.SCREEN_NAME.name);
        p.epoch = Long.parseLong(hit.get(StatusField.EPOCH.name));
        p.text = hit.get(StatusField.TEXT.name);
View Full Code Here

TOP

Related Classes of cc.twittertools.thrift.gen.TResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.