Esempio n. 1
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);
      }
    }
  }
Esempio n. 2
0
  public boolean check(DepTree tree) {
    if (tree.size() == 2) return false;
    DepNode node;
    Matcher m;
    String fst, snd, form;
    int idx;

    for (int i = 1; i < tree.size(); i++) {
      node = tree.get(i);

      if (node.lemma.startsWith("+")) node.lemma = node.lemma.substring(1);

      if (node.lemma.endsWith("+")) node.lemma = node.lemma.substring(0, node.lemma.length() - 1);

      if (!node.form.contains("*")) node.lemma = node.lemma.replaceAll("\\*\\/", "/");

      if (P_Q.matcher(node.form).find()) return false;

      if (i == 1 && (m = P_Qd.matcher(node.form)).find()) {
        idx = node.lemma.indexOf("/");
        fst = node.lemma.substring(0, idx);
        snd = node.lemma.substring(idx + 1);

        form = m.group(1);
        if (snd.startsWith("SN")) form = fst + form;
        if (!form.isEmpty()) node.form = form;
      }
    }

    return true;
  }