Package com.ansj.vec.domain

Examples of com.ansj.vec.domain.WordEntry


  }

  private void insertTopN(String name, float score, List<WordEntry> wordsEntrys) {
    // TODO Auto-generated method stub
    if (wordsEntrys.size() < topNSize) {
      wordsEntrys.add(new WordEntry(name, score));
      return;
    }
    float min = Float.MAX_VALUE;
    int minOffe = 0;
    for (int i = 0; i < topNSize; i++) {
      WordEntry wordEntry = wordsEntrys.get(i);
      if (min > wordEntry.score) {
        min = wordEntry.score;
        minOffe = i;
      }
    }

    if (score > min) {
      wordsEntrys.set(minOffe, new WordEntry(name, score));
    }

  }
View Full Code Here


      for (int i = 0; i < vector.length; i++) {
        dist += center[i] * vector[i];
      }

      if (dist > min) {
        result.add(new WordEntry(entry.getKey(), dist));
        if (resultSize < result.size()) {
          result.pollLast();
        }
        min = result.last().score;
      }
View Full Code Here

      for (int i = 0; i < vector.length; i++) {
        dist += center[i] * vector[i];
      }

      if (dist > min) {
        result.add(new WordEntry(entry.getKey(), dist));
        if (resultSize < result.size()) {
          result.pollLast();
        }
        min = result.last().score;
      }
View Full Code Here

TOP

Related Classes of com.ansj.vec.domain.WordEntry

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.