コード例 #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);
      }
    }
  }
コード例 #2
0
  public void retrieveTopics(DepTree tree) {
    DepNode node, pred;
    SRLInfo info;
    String feat;
    Prob2dMap pTA, pAT;

    for (int i = 1; i < tree.size(); i++) {
      node = tree.get(i);
      info = node.srlInfo;
      if (!node.isPosx("NN.*")) continue;

      for (SRLHead head : info.heads) {
        pred = tree.get(head.headId);
        if ((feat = pred.getFeat("ct")) == null) continue;

        pTA = getSubMap(m_ta, feat);
        pTA.increment(head.label, node.lemma);

        pAT = getSubMap(m_at, feat);
        pAT.increment(node.lemma, head.label);

        getSubSet(s_verbs, feat).add(pred.lemma);
      }
    }
  }