2014-12-16 14:44:43 +03:00
|
|
|
from thinc.typedefs cimport atom_t
|
|
|
|
|
|
|
|
from ._state cimport State
|
2015-06-10 00:23:28 +03:00
|
|
|
from .stateclass cimport StateClass
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
|
2015-06-10 02:39:07 +03:00
|
|
|
cdef int fill_context(atom_t* context, StateClass state) except -1
|
2014-12-16 14:44:43 +03:00
|
|
|
# Context elements
|
|
|
|
|
|
|
|
# Ensure each token's attributes are listed: w, p, c, c6, c4. The order
|
|
|
|
# is referenced by incrementing the enum...
|
|
|
|
|
|
|
|
# Tokens are listed in left-to-right order.
|
|
|
|
#cdef size_t* SLOTS = [
|
|
|
|
# S2w, S1w,
|
|
|
|
# S0l0w, S0l2w, S0lw,
|
|
|
|
# S0w,
|
|
|
|
# S0r0w, S0r2w, S0rw,
|
|
|
|
# N0l0w, N0l2w, N0lw,
|
2015-03-10 20:00:23 +03:00
|
|
|
# P2w, P1w,
|
2014-12-16 14:44:43 +03:00
|
|
|
# N0w, N1w, N2w, N3w, 0
|
|
|
|
#]
|
|
|
|
|
|
|
|
# NB: The order of the enum is _NOT_ arbitrary!!
|
|
|
|
cpdef enum:
|
|
|
|
S2w
|
2014-12-18 01:05:31 +03:00
|
|
|
S2W
|
2014-12-16 14:44:43 +03:00
|
|
|
S2p
|
|
|
|
S2c
|
|
|
|
S2c4
|
|
|
|
S2c6
|
|
|
|
S2L
|
2015-03-10 20:00:23 +03:00
|
|
|
S2_prefix
|
|
|
|
S2_suffix
|
|
|
|
S2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S2_ne_iob
|
|
|
|
S2_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S1w
|
2014-12-18 01:05:31 +03:00
|
|
|
S1W
|
2014-12-16 14:44:43 +03:00
|
|
|
S1p
|
|
|
|
S1c
|
|
|
|
S1c4
|
|
|
|
S1c6
|
|
|
|
S1L
|
2015-03-10 20:00:23 +03:00
|
|
|
S1_prefix
|
|
|
|
S1_suffix
|
|
|
|
S1_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S1_ne_iob
|
|
|
|
S1_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S1rw
|
2014-12-18 01:05:31 +03:00
|
|
|
S1rW
|
2014-12-16 14:44:43 +03:00
|
|
|
S1rp
|
|
|
|
S1rc
|
|
|
|
S1rc4
|
|
|
|
S1rc6
|
|
|
|
S1rL
|
2015-03-10 20:00:23 +03:00
|
|
|
S1r_prefix
|
|
|
|
S1r_suffix
|
|
|
|
S1r_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S1r_ne_iob
|
|
|
|
S1r_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S0lw
|
2014-12-18 01:05:31 +03:00
|
|
|
S0lW
|
2014-12-16 14:44:43 +03:00
|
|
|
S0lp
|
|
|
|
S0lc
|
|
|
|
S0lc4
|
|
|
|
S0lc6
|
|
|
|
S0lL
|
2015-03-10 20:00:23 +03:00
|
|
|
S0l_prefix
|
|
|
|
S0l_suffix
|
|
|
|
S0l_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S0l_ne_iob
|
|
|
|
S0l_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S0l2w
|
2014-12-18 01:05:31 +03:00
|
|
|
S0l2W
|
2014-12-16 14:44:43 +03:00
|
|
|
S0l2p
|
|
|
|
S0l2c
|
|
|
|
S0l2c4
|
|
|
|
S0l2c6
|
|
|
|
S0l2L
|
2015-03-10 20:00:23 +03:00
|
|
|
S0l2_prefix
|
|
|
|
S0l2_suffix
|
|
|
|
S0l2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S0l2_ne_iob
|
|
|
|
S0l2_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S0w
|
2014-12-18 01:05:31 +03:00
|
|
|
S0W
|
2014-12-16 14:44:43 +03:00
|
|
|
S0p
|
|
|
|
S0c
|
|
|
|
S0c4
|
|
|
|
S0c6
|
|
|
|
S0L
|
2015-03-10 20:00:23 +03:00
|
|
|
S0_prefix
|
|
|
|
S0_suffix
|
|
|
|
S0_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S0_ne_iob
|
|
|
|
S0_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2014-12-16 14:44:43 +03:00
|
|
|
S0r2w
|
2014-12-18 01:05:31 +03:00
|
|
|
S0r2W
|
2014-12-16 14:44:43 +03:00
|
|
|
S0r2p
|
|
|
|
S0r2c
|
|
|
|
S0r2c4
|
|
|
|
S0r2c6
|
|
|
|
S0r2L
|
2015-03-10 20:00:23 +03:00
|
|
|
S0r2_prefix
|
|
|
|
S0r2_suffix
|
|
|
|
S0r2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S0r2_ne_iob
|
|
|
|
S0r2_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
S0rw
|
2014-12-18 01:05:31 +03:00
|
|
|
S0rW
|
2014-12-16 14:44:43 +03:00
|
|
|
S0rp
|
|
|
|
S0rc
|
|
|
|
S0rc4
|
|
|
|
S0rc6
|
|
|
|
S0rL
|
2015-03-10 20:00:23 +03:00
|
|
|
S0r_prefix
|
|
|
|
S0r_suffix
|
|
|
|
S0r_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
S0r_ne_iob
|
|
|
|
S0r_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
N0l2w
|
2014-12-18 01:05:31 +03:00
|
|
|
N0l2W
|
2014-12-16 14:44:43 +03:00
|
|
|
N0l2p
|
|
|
|
N0l2c
|
|
|
|
N0l2c4
|
|
|
|
N0l2c6
|
|
|
|
N0l2L
|
2015-03-10 20:00:23 +03:00
|
|
|
N0l2_prefix
|
|
|
|
N0l2_suffix
|
|
|
|
N0l2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
N0l2_ne_iob
|
|
|
|
N0l2_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
N0lw
|
2014-12-18 01:05:31 +03:00
|
|
|
N0lW
|
2014-12-16 14:44:43 +03:00
|
|
|
N0lp
|
|
|
|
N0lc
|
|
|
|
N0lc4
|
|
|
|
N0lc6
|
|
|
|
N0lL
|
2015-03-10 20:00:23 +03:00
|
|
|
N0l_prefix
|
|
|
|
N0l_suffix
|
|
|
|
N0l_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
N0l_ne_iob
|
|
|
|
N0l_ne_type
|
2014-12-16 14:44:43 +03:00
|
|
|
|
|
|
|
N0w
|
2014-12-18 01:05:31 +03:00
|
|
|
N0W
|
2014-12-16 14:44:43 +03:00
|
|
|
N0p
|
|
|
|
N0c
|
|
|
|
N0c4
|
|
|
|
N0c6
|
|
|
|
N0L
|
2015-03-10 20:00:23 +03:00
|
|
|
N0_prefix
|
|
|
|
N0_suffix
|
|
|
|
N0_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
N0_ne_iob
|
|
|
|
N0_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2014-12-16 14:44:43 +03:00
|
|
|
N1w
|
2014-12-18 01:05:31 +03:00
|
|
|
N1W
|
2014-12-16 14:44:43 +03:00
|
|
|
N1p
|
|
|
|
N1c
|
|
|
|
N1c4
|
|
|
|
N1c6
|
|
|
|
N1L
|
2015-03-10 20:00:23 +03:00
|
|
|
N1_prefix
|
|
|
|
N1_suffix
|
|
|
|
N1_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
N1_ne_iob
|
|
|
|
N1_ne_type
|
2015-03-10 20:00:23 +03:00
|
|
|
|
2014-12-16 14:44:43 +03:00
|
|
|
N2w
|
2014-12-18 01:05:31 +03:00
|
|
|
N2W
|
2014-12-16 14:44:43 +03:00
|
|
|
N2p
|
|
|
|
N2c
|
|
|
|
N2c4
|
|
|
|
N2c6
|
|
|
|
N2L
|
2015-03-10 20:00:23 +03:00
|
|
|
N2_prefix
|
|
|
|
N2_suffix
|
|
|
|
N2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
N2_ne_iob
|
|
|
|
N2_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2015-03-10 20:00:23 +03:00
|
|
|
P1w
|
|
|
|
P1W
|
|
|
|
P1p
|
|
|
|
P1c
|
|
|
|
P1c4
|
|
|
|
P1c6
|
|
|
|
P1L
|
|
|
|
P1_prefix
|
|
|
|
P1_suffix
|
|
|
|
P1_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
P1_ne_iob
|
|
|
|
P1_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2015-03-10 20:00:23 +03:00
|
|
|
P2w
|
|
|
|
P2W
|
|
|
|
P2p
|
|
|
|
P2c
|
|
|
|
P2c4
|
|
|
|
P2c6
|
|
|
|
P2L
|
|
|
|
P2_prefix
|
|
|
|
P2_suffix
|
|
|
|
P2_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
P2_ne_iob
|
|
|
|
P2_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2015-03-11 04:26:13 +03:00
|
|
|
E0w
|
|
|
|
E0W
|
|
|
|
E0p
|
|
|
|
E0c
|
|
|
|
E0c4
|
|
|
|
E0c6
|
|
|
|
E0L
|
|
|
|
E0_prefix
|
|
|
|
E0_suffix
|
|
|
|
E0_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
E0_ne_iob
|
|
|
|
E0_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2015-03-11 04:26:13 +03:00
|
|
|
E1w
|
|
|
|
E1W
|
|
|
|
E1p
|
|
|
|
E1c
|
|
|
|
E1c4
|
|
|
|
E1c6
|
|
|
|
E1L
|
|
|
|
E1_prefix
|
|
|
|
E1_suffix
|
|
|
|
E1_shape
|
2015-04-10 06:02:15 +03:00
|
|
|
E1_ne_iob
|
|
|
|
E1_ne_type
|
2015-04-19 11:31:31 +03:00
|
|
|
|
2014-12-16 14:44:43 +03:00
|
|
|
# Misc features at the end
|
|
|
|
dist
|
|
|
|
N0lv
|
|
|
|
S0lv
|
|
|
|
S0rv
|
|
|
|
S1lv
|
|
|
|
S1rv
|
2014-12-18 01:05:31 +03:00
|
|
|
|
|
|
|
S0_has_head
|
|
|
|
S1_has_head
|
|
|
|
S2_has_head
|
|
|
|
|
2014-12-16 14:44:43 +03:00
|
|
|
CONTEXT_SIZE
|