Пример #1
0
  public void getTopics(
      ArrayList<HashSet<String>> aTopics, String argKey, double threshold, int num) {
    ArrayList<JObjectDoubleTuple<String>> aTA;
    Prob2dMap pTA, pAT;
    HashSet<String> topics, clone;

    outer:
    for (String id : m_ta.keySet()) {
      pTA = m_ta.get(id);
      pAT = m_at.get(id);
      if ((aTA = pTA.getProb1dList(argKey)) == null) continue;
      topics = new HashSet<String>();

      for (JObjectDoubleTuple<String> tup : aTA) {
        tup.value *= pAT.get1dProb(tup.object, argKey);
        if (tup.value >= threshold) topics.add(tup.object);
      }

      if (topics.size() >= num) {
        for (HashSet<String> pSet : aTopics) {
          clone = new HashSet<String>(topics);
          clone.removeAll(pSet);

          if (clone.size() < num) continue outer;
        }

        aTopics.add(topics);
      }
    }
  }