mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Clean up unused feature templates
This commit is contained in:
parent
411bf377d4
commit
b3157927e6
|
@ -296,151 +296,3 @@ trigrams = (
|
|||
(N0W, N0p, N0lL, N0l2L),
|
||||
(N0p, N0lL, N0l2L),
|
||||
)
|
||||
|
||||
|
||||
arc_eager = (
|
||||
(S0w, S0p),
|
||||
(S0w,),
|
||||
(S0p,),
|
||||
(N0w, N0p),
|
||||
(N0w,),
|
||||
(N0p,),
|
||||
(N1w, N1p),
|
||||
(N1w,),
|
||||
(N1p,),
|
||||
(N2w, N2p),
|
||||
(N2w,),
|
||||
(N2p,),
|
||||
(S0w, S0p, N0w, N0p),
|
||||
(S0w, S0p, N0w),
|
||||
(S0w, N0w, N0p),
|
||||
(S0w, S0p, N0p),
|
||||
(S0p, N0w, N0p),
|
||||
(S0w, N0w),
|
||||
(S0p, N0p),
|
||||
(N0p, N1p),
|
||||
(N0p, N1p, N2p),
|
||||
(S0p, N0p, N1p),
|
||||
(S1p, S0p, N0p),
|
||||
(S0p, S0lp, N0p),
|
||||
(S0p, S0rp, N0p),
|
||||
(S0p, N0p, N0lp),
|
||||
(dist, S0w),
|
||||
(dist, S0p),
|
||||
(dist, N0w),
|
||||
(dist, N0p),
|
||||
(dist, S0w, N0w),
|
||||
(dist, S0p, N0p),
|
||||
(S0w, S0rv),
|
||||
(S0p, S0rv),
|
||||
(S0w, S0lv),
|
||||
(S0p, S0lv),
|
||||
(N0w, N0lv),
|
||||
(N0p, N0lv),
|
||||
(S1w,),
|
||||
(S1p,),
|
||||
(S0lw,),
|
||||
(S0lp,),
|
||||
(S0rw,),
|
||||
(S0rp,),
|
||||
(N0lw,),
|
||||
(N0lp,),
|
||||
(S2w,),
|
||||
(S2p,),
|
||||
(S0l2w,),
|
||||
(S0l2p,),
|
||||
(S0r2w,),
|
||||
(S0r2p,),
|
||||
(N0l2w,),
|
||||
(N0l2p,),
|
||||
(S0p, S0lp, S0l2p),
|
||||
(S0p, S0rp, S0r2p),
|
||||
(S0p, S1p, S2p),
|
||||
(N0p, N0lp, N0l2p),
|
||||
(S0L,),
|
||||
(S0lL,),
|
||||
(S0rL,),
|
||||
(N0lL,),
|
||||
(S1L,),
|
||||
(S0l2L,),
|
||||
(S0r2L,),
|
||||
(N0l2L,),
|
||||
(S0w, S0rL, S0r2L),
|
||||
(S0p, S0rL, S0r2L),
|
||||
(S0w, S0lL, S0l2L),
|
||||
(S0p, S0lL, S0l2L),
|
||||
(N0w, N0lL, N0l2L),
|
||||
(N0p, N0lL, N0l2L),
|
||||
)
|
||||
|
||||
|
||||
label_sets = (
|
||||
(S0w, S0lL, S0l2L),
|
||||
(S0p, S0rL, S0r2L),
|
||||
(S0p, S0lL, S0l2L),
|
||||
(S0p, S0rL, S0r2L),
|
||||
(N0w, N0lL, N0l2L),
|
||||
(N0p, N0lL, N0l2L),
|
||||
)
|
||||
|
||||
extra_labels = (
|
||||
(S0p, S0lL, S0lp),
|
||||
(S0p, S0lL, S0l2L),
|
||||
(S0p, S0rL, S0rp),
|
||||
(S0p, S0rL, S0r2L),
|
||||
(S0p, S0lL, S0rL),
|
||||
(S1p, S0L, S0rL),
|
||||
(S1p, S0L, S0lL),
|
||||
)
|
||||
|
||||
|
||||
# Koo et al (2008) dependency features, using Brown clusters.
|
||||
clusters = (
|
||||
# Koo et al have (head, child) --- we have S0, N0 for both.
|
||||
(S0c4, N0c4),
|
||||
(S0c6, N0c6),
|
||||
(S0c, N0c),
|
||||
(S0p, N0c4),
|
||||
(S0p, N0c6),
|
||||
(S0p, N0c),
|
||||
(S0c4, N0p),
|
||||
(S0c6, N0p),
|
||||
(S0c, N0p),
|
||||
# Siblings --- right arc
|
||||
(S0c4, S0rc4, N0c4),
|
||||
(S0c6, S0rc6, N0c6),
|
||||
(S0p, S0rc4, N0c4),
|
||||
(S0c4, S0rp, N0c4),
|
||||
(S0c4, S0rc4, N0p),
|
||||
# Siblings --- left arc
|
||||
(S0c4, N0lc4, N0c4),
|
||||
(S0c6, N0c6, N0c6),
|
||||
(S0c4, N0lc4, N0p),
|
||||
(S0c4, N0lp, N0c4),
|
||||
(S0p, N0lc4, N0c4),
|
||||
# Grand-child, right-arc
|
||||
(S1c4, S0c4, N0c4),
|
||||
(S1c6, S0c6, N0c6),
|
||||
(S1p, S0c4, N0c4),
|
||||
(S1c4, S0p, N0c4),
|
||||
(S1c4, S0c4, N0p),
|
||||
# Grand-child, left-arc
|
||||
(S0lc4, S0c4, N0c4),
|
||||
(S0lc6, S0c6, N0c6),
|
||||
(S0lp, S0c4, N0c4),
|
||||
(S0lc4, S0p, N0c4),
|
||||
(S0lc4, S0c4, N0p)
|
||||
)
|
||||
|
||||
|
||||
hasty = s0_n0 + n0_n1 + trigrams
|
||||
|
||||
|
||||
def pos_bigrams():
|
||||
kernels = [S2w, S1w, S0w, S0lw, S0rw, N0w, N0lw, N1w]
|
||||
bitags = []
|
||||
for t1, t2 in combinations(kernels, 2):
|
||||
feat = (t1 + 1, t2 + 1)
|
||||
bitags.append(feat)
|
||||
print "Adding %d bitags" % len(bitags)
|
||||
return tuple(bitags)
|
||||
|
|
|
@ -58,9 +58,7 @@ cdef unicode print_state(State* s, list words):
|
|||
|
||||
def get_templates(name):
|
||||
pf = _parse_features
|
||||
if name == 'zhang':
|
||||
return pf.arc_eager
|
||||
elif name == 'ner':
|
||||
if name == 'ner':
|
||||
return pf.ner
|
||||
elif name == 'debug':
|
||||
return pf.unigrams
|
||||
|
|
Loading…
Reference in New Issue
Block a user