From 7920ea72b4c6d1e2fc1b367d57e23c62fcb59b3c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 20 Dec 2014 01:43:15 +1100 Subject: [PATCH] * Working parser with the decision memory idea. Disabling that for now, for simplicity --- spacy/syntax/parser.pyx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/spacy/syntax/parser.pyx b/spacy/syntax/parser.pyx index 87057ca41..0b02bf777 100644 --- a/spacy/syntax/parser.pyx +++ b/spacy/syntax/parser.pyx @@ -54,8 +54,8 @@ def get_templates(name): if name == 'zhang': return pf.arc_eager else: - templs = pf.unigrams + pf.s0_n0 + pf.s1_n0 + pf.s0_n1 + pf.n0_n1 + pf.tree_shape + pf.trigrams - return templs + return pf.unigrams + pf.s0_n0 + pf.s1_n0 + pf.s0_n1 + pf.n0_n1 + \ + pf.tree_shape + pf.trigrams cdef class GreedyParser: @@ -134,14 +134,11 @@ cdef class GreedyParser: return n_corr -cdef uint64_t _approx_hash_state(const State* state) except 0: +cdef inline uint64_t _approx_hash_state(const State* state) nogil: cdef int[3] context context[0] = get_s0(state).lex.sic context[1] = get_n0(state).lex.sic - if get_n1(state): - context[2] = get_n1(state).pos - else: - context[2] = 0 + context[2] = get_n1(state).pos if state.i < (state.sent_len - 1) else 0 return hash64(context, sizeof(int) * 3, 0)