Package com.clearnlp.util.pair

Examples of com.clearnlp.util.pair.StringDoublePair


    return ps;
  }
 
  private void getSimilarPhrasesAux(String phrase, int top, double[] curr, List<StringDoublePair> ps, Map<String,double[]> map)
  {
    StringDoublePair p;
    double sim;
   
    for (String key : map.keySet())
    {
      if (phrase.equals(key))  continue;
      sim = UTMath.cosineSimilarity(curr, map.get(key));
   
      if (ps.size() < top)
        ps.add(new StringDoublePair(key, sim));
      else
      {
        p = ps.get(top-1);
        if (p.d < sim) p.set(key, sim);
      }
     
      Collections.sort(ps, Collections.reverseOrder());
    }   
  }
View Full Code Here


  {
    StringDoublePair[] ps = getProb1D(key);
   
    if (ps != null)
    {
      StringDoublePair max = ps[0];
      int i, size = ps.length;
     
      for (i=1; i<size; i++)
      {
        if (ps[i].d > max.d)
View Full Code Here

    for (ObjectCursor<String> cur : map.keys())
    {
      value = cur.value;
     
      if (!value.equals(TOTAL))
        probs[i++] = new StringDoublePair(value, (double)map.get(value)/total);
    }
   
    double prior = (double)total / i_total;
    return new Pair<Double,StringDoublePair[]>(prior, probs);
  }
View Full Code Here

  {
    StringDoublePair[] ps = getProb1D(key);
   
    if (ps != null)
    {
      StringDoublePair max = ps[0];
      int i, size = ps.length;
     
      for (i=1; i<size; i++)
      {
        if (ps[i].d > max.d)
View Full Code Here

    for (ObjectCursor<String> cur : map.keys())
    {
      value = cur.value;
     
      if (!value.equals(TOTAL))
        probs[i++] = new StringDoublePair(value, (double)map.get(value)/total);
    }
   
    double prior = (double)total / i_total;
    return new Pair<Double,StringDoublePair[]>(prior, probs);
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.util.pair.StringDoublePair

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.