示例#1
0
def tp_cc(tl):
    tp = get_tlink_dep_path(tl).to_path
    if len(tp) < 3:
        return
    buf = []
    for t in [dn.ref for dn in tp[1:-1]]:
        if t.pos == 'CC':
            buf.append(t.lemma)
    return buf
示例#2
0
def fp_cc(tl):
    fp = get_tlink_dep_path(tl).from_path
    if len(fp) < 3:
        return
    buf = []
    for t in [dn.ref for dn in fp[1:-1]]:
        if t.pos == 'CC':
            buf.append(t.lemma)
    return buf
示例#3
0
def root_pos(tl):
    dp = get_tlink_dep_path(tl)
    try:
        return dp.from_path[-1].ref.pos
    except AttributeError:
        return
示例#4
0
def some_head_both(tl):
    dp = get_tlink_dep_path(tl)
    if len(dp.from_path) != 1 and len(dp.to_path) != 1:
        return 'true'
示例#5
0
def to_head_from(tl):
    dp = get_tlink_dep_path(tl)
    if len(dp.to_path) == 1:
        return 'true'
示例#6
0
def from_head_to(tl):
    dp = get_tlink_dep_path(tl)
    if len(dp.from_path) == 1:
        return 'true'