コード例 #1
0
  private String getSimpleLabel(CTNode C) {
    if (C.isPTag(CTLibKaist.PTAG_MODP) || CTLibKaist.isAdnoun(C, DELIM_PLUS))
      return DEPLibKr.DEP_ADN;

    if (C.isPTag(CTLibKaist.PTAG_ADVP) || CTLibKaist.isAdverb(C, DELIM_PLUS))
      return DEPLibKr.DEP_ADV;

    if (C.isPTagAny(CTLibKaist.PTAG_IP) || CTLibKaist.isInterjection(C, DELIM_PLUS))
      return DEPLibKr.DEP_INTJ;

    return null;
  }
コード例 #2
0
  // KAIST
  private String getSpecialLabel(CTNode C) {
    CTNode d = C.c2d.getDependencyHead();

    if (CTLibKaist.isPunctuation(C) || CTLibKaist.isPunctuation(d)) return DEPLibKr.DEP_PUNCT;

    if (CTLibKaist.isOnlyEJX(C, DELIM_PLUS)) return DEPLibKr.DEP_EJX;

    if (C.isPTag(CTLibKaist.PTAG_AUXP)) return DEPLibKr.DEP_AUX;

    if (CTLibKaist.isConjunction(C, DELIM_PLUS)) return DEPLibKr.DEP_CC;

    if (CTLibKaist.isConjunct(C, DELIM_PLUS)) return DEPLibKr.DEP_CONJ;

    return null;
  }
コード例 #3
0
  @Override
  protected String getDEPLabel(CTNode C, CTNode P, CTNode p) {
    String label;

    if ((label = getFunctionLabel(C)) != null) return label;

    if ((label = getSpecialLabel(C)) != null) return label;

    String[] pTags = CTLibKaist.getLastPOSTags(C, DELIM_PLUS);
    String pTag = pTags[pTags.length - 1];

    if ((label = getRoleLabel(pTag)) != null) return label;

    if ((label = getSubLabel(pTags)) != null) return label;

    if ((label = getSimpleLabel(C)) != null) return label;

    CTNode d = C.c2d.getDependencyHead();

    if ((label = getSimpleLabel(d)) != null) return label;

    if (P.isPTag(CTLibKaist.PTAG_ADJP)) return DEPLibKr.DEP_AMOD;

    if (P.isPTag(CTLibKaist.PTAG_ADVP)) return DEPLibKr.DEP_ADV;

    if (P.isPTag(CTLibKaist.PTAG_NP)) return DEPLibKr.DEP_NMOD;

    if (P.isPTag(CTLibKaist.PTAG_VP)) return DEPLibKr.DEP_VMOD;

    return DEPLibKr.DEP_DEP;
  }
コード例 #4
0
  @Override
  protected int getHeadFlag(CTNode child) {
    if (child.c2d.hasHead()) return -1;

    if (child.isPTag(CTLibKaist.PTAG_AUXP)) return 1;

    if (child.isPTag(CTLibKaist.PTAG_IP)) return 2;

    if (child.hasFTag(CTLibKaist.FTAG_PRN)) return 3;

    if (CTLibKaist.isOnlyEJX(child, DELIM_PLUS)) return 4;

    if (CTLibKaist.isPunctuation(child)) return 5;

    return 0;
  }
コード例 #5
0
  private String getConjunctLabel(CTNode parent, CTNode child) {
    String label;

    if (CTLibKaist.isConjunct(child, DELIM_PLUS)) return DEPLibKr.DEP_CONJ;

    if ((label = getSpecialLabel(child)) != null) return label;

    if (child.isPTag(CTLibKaist.PTAG_ADVP) && !parent.isPTag(CTLibKaist.PTAG_ADVP))
      return DEPLibKr.DEP_ADV;

    return DEPLibKr.DEP_CONJ;
  }
コード例 #6
0
  /**
   * If the specific node contains a coordination structure, find the head of each coordination.
   *
   * @param curr the specific node to be compared.
   * @return {@code true} if this node contains a coordination structure.
   */
  private void findConjuncts(HeadRule rule, CTNode curr) {
    List<CTNode> children = curr.getChildren();
    int i, size = children.size();
    String label;
    CTNode child;

    for (i = 0; i < size; i++) {
      child = children.get(i);

      if ((label = getSpecialLabel(child)) != null) child.addFTag(label);
      else break;
    }

    if (CTLibKaist.containsCoordination(children.subList(i, size), DELIM_PLUS)) {
      for (; i < size; i++) {
        child = children.get(i);

        if ((label = getConjunctLabel(curr, child)) != null) child.addFTag(label);
      }
    }
  }