示例#1
0
  /**
   * 把词按照频率排序返回,用于查看高频词或低频词 便于加入停词中
   *
   * @return
   */
  public List<Entry<String, Integer>> showFrequencyWords(boolean flag) {
    Map<String, Integer> tMap = new HashMap<>();
    for (Entry<String, AtomicInteger> entry : wordCountPerUnit.entrySet()) {
      String key = entry.getKey();
      int i = entry.getValue().get();
      tMap.put(key, i);
    }

    ArrayList<Entry<String, Integer>> countList = new ArrayList<>(tMap.entrySet());
    Utils.sortMapStringAndInteger(countList, flag);
    return countList;
  }
示例#2
0
 /**
  * 把词按照频率排序返回,用于查看高频词或低频词 便于加入停词中
  *
  * @return
  */
 public List<Entry<String, Integer>> showFrequencyWordsWithWeight(boolean flag) {
   ArrayList<Entry<String, Integer>> countList = new ArrayList<>(posMap.entrySet());
   Utils.sortMapStringAndInteger(countList, flag);
   return countList;
 }