Examples of PairOfIntLong


Examples of edu.umd.cloud9.io.pair.PairOfIntLong

  }

  public PairOfIntLong getStats(String term) {
    int df = -1;
    long cf = -1;
    PairOfIntLong p = new PairOfIntLong();
    if(frequentTermsDfs != null){
      try{
        df = frequentTermsDfs.get(term);
        LOGGER.info("[cached] df of "+term+": "+df);
        if(frequentTermsCfs != null){
          try{
            cf = frequentTermsCfs.get(term);
            LOGGER.info("[cached] cf of "+term+": "+cf);
            p.set(df, cf);
            return p;
          }catch (NoSuchElementException e){
          }
        }
      }catch (NoSuchElementException e){
      }
    }
    int index = prefixSet.getId(term);
    LOGGER.info("index of " + term + ": " + index);
    if (index < 0)
      return null;
    p.set(dfs[index], cfs[index]);
    return p;
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfIntLong

  }*/
 
  public PairOfIntLong getStats(int index) {
    if (index < 0)
      return null;
    PairOfIntLong p = new PairOfIntLong();
    p.set(dfs[index], cfs[index]);
    return p;
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfIntLong

      int df = 0;
      long cf = 0;

      while (values.hasNext()) {
        PairOfIntLong p = values.next();
        df += p.getLeftElement();
        cf += p.getRightElement();
      }

      LOG.info(key + " " + df + " " + cf);

      if (curKeyIndex % window == 0) {
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfIntLong

    @Override
    public void reduce(Text key, Iterable<PairOfIntLong> values, Context context)
        throws IOException, InterruptedException {
      String term = key.toString();
      Iterator<PairOfIntLong> iter = values.iterator();
      PairOfIntLong p = iter.next();
      int df = p.getLeftElement();
      long cf = p.getRightElement();
      WritableUtils.writeVInt(dfByTermOut, df);
      WritableUtils.writeVLong(cfByTermOut, cf);

      if (iter.hasNext()) {
        throw new RuntimeException("More than one record for term: " + term);
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfIntLong

    @Override
    public void reduce(Text key, Iterable<PairOfIntLong> values, Context context)
        throws IOException, InterruptedException {
      String term = key.toString();
      Iterator<PairOfIntLong> iter = values.iterator();
      PairOfIntLong p = iter.next();
      int df = p.getLeftElement();
      long cf = p.getRightElement();
      WritableUtils.writeVInt(dfByTermOut, df);
      WritableUtils.writeVLong(cfByTermOut, cf);

      if (iter.hasNext()) {
        throw new RuntimeException("More than one record for term: " + term);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.