* Move context functions to header, inlining them.

This commit is contained in:
Matthew Honnibal 2014-12-07 21:59:04 +11:00
parent 91e8d9ea1c
commit 5fe5e6e66b
2 changed files with 16 additions and 16 deletions

View File

@ -46,4 +46,19 @@ cpdef enum:
N_FIELDS N_FIELDS
cdef int fill_context(atom_t[N_FIELDS] context, const int i, TokenC* tokens) except -1 cdef inline void fill_context(atom_t* context, const int i, const TokenC* tokens) nogil:
_fill_from_token(&context[P2_sic], &tokens[i-2])
_fill_from_token(&context[P1_sic], &tokens[i-1])
_fill_from_token(&context[W_sic], &tokens[i])
_fill_from_token(&context[N1_sic], &tokens[i+1])
_fill_from_token(&context[N2_sic], &tokens[i+2])
cdef inline void _fill_from_token(atom_t* context, const TokenC* t) nogil:
context[0] = t.lex.sic
context[1] = t.lex.cluster
context[2] = t.lex.shape
context[3] = t.lex.prefix
context[4] = t.lex.suffix
context[5] = t.pos
context[6] = t.sense

View File

@ -1,16 +1 @@
cdef int fill_context(atom_t[N_FIELDS] context, const int i, TokenC* tokens) except -1:
_fill_from_token(&context[P2_sic], &tokens[i-2])
_fill_from_token(&context[P1_sic], &tokens[i-1])
_fill_from_token(&context[W_sic], &tokens[i])
_fill_from_token(&context[N1_sic], &tokens[i+1])
_fill_from_token(&context[N2_sic], &tokens[i+2])
cdef inline void _fill_from_token(atom_t[N_FIELDS] context, const TokenC* t) nogil:
context[0] = t.lex.sic
context[1] = t.lex.cluster
context[2] = t.lex.shape
context[3] = t.lex.prefix
context[4] = t.lex.suffix
context[5] = t.pos
context[6] = t.sense