Beispiel #1
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;
  }