// ============================= Get Stanford labels =============================
@Override
protected String getDEPLabel(CTNode C, CTNode P, CTNode p)
{
CTNode c = C.c2d.getPhraseHead();
CTNode d = C.c2d.getDependencyHead();
String label;
// function tags
if (hasAdverbialTag(C))
{
if (C.isPTagAny(CTLibEn.PTAG_S, CTLibEn.PTAG_SBAR, CTLibEn.PTAG_SINV))
return DEPLibEn.DEP_ADVCL;
if (C.isPTagAny(CTLibEn.PTAG_NML, CTLibEn.PTAG_NP, CTLibEn.PTAG_QP))
return DEPLibEn.DEP_NPADVMOD;
}
if ((label = getSubjectLabel(C, d)) != null)
return label;
// coordination
if (C.isPTag(CTLibEn.PTAG_UCP))
{
c.addFTags(C.getFTags());
return getDEPLabel(c, P, p);
}
// complements
if (P.isPTagAny(CTLibEn.PTAG_VP, CTLibEn.PTAG_SINV, CTLibEn.PTAG_SQ))
{
if (isAcomp(C)) return DEPLibEn.DEP_ACOMP;
if ((label = getObjectLabel(C)) != null) return label;
if (isOprd(C)) return DEPLibEn.DEP_OPRD;
if (isXcomp(C)) return DEPLibEn.DEP_XCOMP;
if (isCcomp(C)) return DEPLibEn.DEP_CCOMP;
if ((label = getAuxLabel(C)) != null) return label;
}
if (P.isPTagAny(CTLibEn.PTAG_ADJP, CTLibEn.PTAG_ADVP))
{
if (isXcomp(C)) return DEPLibEn.DEP_XCOMP;
if (isCcomp(C)) return DEPLibEn.DEP_CCOMP;
}
if (P.isPTagAny(CTLibEn.PTAG_NML, CTLibEn.PTAG_NP, CTLibEn.PTAG_WHNP))
{
if (isNfmod(C)) return isInfMod(C) ? DEPLibEn.DEP_INFMOD : DEPLibEn.DEP_PARTMOD;
if (isRcmod(C)) return DEPLibEn.DEP_RCMOD;
if (isCcomp(C)) return DEPLibEn.DEP_CCOMP;
}
if (isPoss(C, P))
return DEPLibEn.DEP_POSS;
// simple labels
if ((label = getSimpleLabel(C)) != null)
return label;
// default
if (P.isPTagAny(CTLibEn.PTAG_PP, CTLibEn.PTAG_WHPP))
{
if (p.getParent() == C.getParent()) // p and C are siblings
{
if (p.getSiblingId() < C.getSiblingId())
return getPmodLabel(C, d);
}
else // UCP
{
if (p.getFirstTerminal().getTerminalId() < C.getFirstTerminal().getTerminalId())
return getPmodLabel(C, d);
}
}
if (C.isPTag(CTLibEn.PTAG_SBAR) || isXcomp(C) || (P.isPTag(CTLibEn.PTAG_PP) && CTLibEn.isClause(C)))
return DEPLibEn.DEP_ADVCL;
if (C.isPTagAny(CTLibEn.PTAG_S, CTLibEn.PTAG_SINV, CTLibEn.PTAG_SQ, CTLibEn.PTAG_SBARQ))
return DEPLibEn.DEP_CCOMP;
if (P.isPTag(CTLibEn.PTAG_QP))
{
if (C.isPTagAny(CTLibEn.POS_CD))
return DEPLibEn.DEP_NUMBER;
else
return DEPLibEn.DEP_QUANTMOD;
}
if (P.isPTagAny(CTLibEn.PTAG_NML, CTLibEn.PTAG_NP, CTLibEn.PTAG_NX, CTLibEn.PTAG_WHNP) || CTLibEn.isNoun(p))
return getNmodLabel(C);
if (c != null)
{
if ((label = getSimpleLabel(c)) != null)
return label;
if (d.isPTag(CTLibEn.POS_IN))
return DEPLibEn.DEP_PREP;
if (CTLibEn.isAdverb(d))
return DEPLibEn.DEP_ADVMOD;
}