コード例 #1
0
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
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
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
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
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
def root_pos(tl):
    dp = get_tlink_dep_path(tl)
    try:
        return dp.from_path[-1].ref.pos
    except AttributeError:
        return
コード例 #4
0
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
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
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
def to_head_from(tl):
    dp = get_tlink_dep_path(tl)
    if len(dp.to_path) == 1:
        return 'true'
コード例 #6
0
ファイル: tlink_feature.py プロジェクト: yaocheng-cs/tlink
def from_head_to(tl):
    dp = get_tlink_dep_path(tl)
    if len(dp.from_path) == 1:
        return 'true'