Examples of PairOfFloatInt


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

      return null;
    }
    PriorityQueue<PairOfFloatInt> eS = f2eProbs.get(f).getTranslationsWithProbs(lexProbThreshold);

    if (!eS.isEmpty()) {
      PairOfFloatInt entry = eS.poll();
      int e = entry.getRightElement();
      String eTerm = eVocab_f2e.get(e);
      return eTerm;
    }
    return token;
  }
View Full Code Here

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

    float sumProbEF = 0;
    int numTrans = 0;
    //tf(e) = sum_f{tf(f)*prob(e|f)}
    while (numTrans < numTransPerToken && !eS.isEmpty()) {
      PairOfFloatInt entry = eS.poll();
      float probEF = entry.getLeftElement();
      int e = entry.getRightElement();
      String eTerm = eVocab_f2e.get(e);

      //      LOG.info("Pr("+eTerm+"|"+token+")="+probEF);

      if (probEF > 0 && e > 0 && !docLangTokenizer.isStopWord(eTerm) && (translateOnly == null || !translateOnly.equals("indri") || indriPuncPattern.matcher(eTerm).matches()) && (pairsInSCFG == null || pairsInSCFG.contains(new PairOfStrings(token,eTerm)))) {     
View Full Code Here

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

      return null;
    }
    PriorityQueue<PairOfFloatInt> eS = f2eProbs.get(f).getTranslationsWithProbs(lexProbThreshold);

    if (!eS.isEmpty()) {
      PairOfFloatInt entry = eS.poll();
      int e = entry.getRightElement();
      String eTerm = eVocab_f2e.get(e);
      return eTerm;
    }
    return token;
  }
View Full Code Here

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

    float sumProbEF = 0;
    int numTrans = 0;
    //tf(e) = sum_f{tf(f)*prob(e|f)}
    while (numTrans < numTransPerToken && !eS.isEmpty()) {
      PairOfFloatInt entry = eS.poll();
      float probEF = entry.getLeftElement();
      int e = entry.getRightElement();
      String eTerm = eVocab_f2e.get(e);

      //      LOG.info("Pr("+eTerm+"|"+token+")="+probEF);

      if (probEF > 0 && e > 0 && !docLangTokenizer.isStemmedStopWord(eTerm) && (pairsInSCFG == null || pairsInSCFG.contains(new PairOfStrings(token,eTerm)))) {     
View Full Code Here

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

        IntWritable sampleDocno = (IntWritable)vectors.get(i).getLeftElement();

        WeightedIntDocVector fromSample = (WeightedIntDocVector)vectors.get(i).getRightElement();
        float cs = CLIRUtils.cosine(docvector.getWeightedTerms(), fromSample.getWeightedTerms());
        if(cs >= threshold){
          output.collect(new IntWritable(sampleDocno.get()), new PairOfFloatInt(cs,docno.get()));
        }
      }
      sLogger.info("Finished in "+(System.currentTimeMillis()-time));
    }
View Full Code Here

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

        IntWritable sampleDocno = (IntWritable)signatures.get(i).getLeftElement();
        Signature fromSample = (Signature)signatures.get(i).getRightElement();
        int dist = signature.hammingDistance(fromSample, maxDist);
 
        if(dist <= maxDist){
          output.collect(new IntWritable(sampleDocno.get()), new PairOfFloatInt(-dist,docno.get()));
        }
        reporter.incrCounter(mapoutput.count, 1);
      }
      sLogger.info("Finished in "+(System.currentTimeMillis()-time));
    }
View Full Code Here

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

    public void reduce(IntWritable key, Iterator<PairOfFloatInt> values,
        OutputCollector<PairOfInts, Text> output, Reporter reporter)
    throws IOException {
      list.clear();
      while(values.hasNext()){
        PairOfFloatInt p = values.next();
        list.add(new PairOfFloatInt(p.getLeftElement(), p.getRightElement()));
        reporter.incrCounter(mapoutput.count, 1);
      }
      int cntr = 0;
      while(!list.isEmpty() && cntr<numResults){
        PairOfFloatInt pair = list.pollLast();
        sLogger.debug("output " + cntr + "=" + pair);
       
        keyOut.set(pair.getRightElement(), key.get());    //first english docno, then foreign language docno
        valOut.set(nf.format(pair.getLeftElement()));
        output.collect(keyOut, valOut);
        cntr++;
      }
    }
View Full Code Here

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

  public PriorityQueue<PairOfFloatInt> getTranslationsWithProbs(float probThreshold){
    PriorityQueue<PairOfFloatInt> q = new PriorityQueue<PairOfFloatInt>(_data.length, Collections.reverseOrder());
    if (_useBinSearch) {
      for (int i=0; i < _data.length; i++) {
        if (_data[i] > probThreshold) {
          q.add(new PairOfFloatInt(_data[i],_indices[i]));
        }
      }
    }else{
      for (int i=0; i < _data.length; i++) {
        if (_data[i] > probThreshold) {
          q.add(new PairOfFloatInt(_data[i],i));
        }
      }
    }
    return q;
  }
View Full Code Here

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

  public List<PairOfFloatInt> getTranslationsWithProbsAsList(float probThreshold){
    List<PairOfFloatInt> l = new ArrayList<PairOfFloatInt>();
    if (_useBinSearch) {
      for(int i=0; i < _data.length; i++){
        if (_data[i] > probThreshold) {
          l.add(new PairOfFloatInt(_data[i],_indices[i]));
        }
      }
    }else{
      for (int i=0; i < _data.length; i++) {
        if (_data[i] > probThreshold) {
          l.add(new PairOfFloatInt(_data[i],i));
        }
      }
    }
    return l;
  }
View Full Code Here

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

public class PairOfFloatIntTest {

  @Test
  public void testBasic() throws IOException {
    PairOfFloatInt pair = new PairOfFloatInt(3.14f, 2);

    assertTrue(pair.getLeftElement() == 3.14f);
    assertEquals(2, pair.getRightElement());
  }
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.