From 763ef015753664c3eaa7173746609df79f0c4994 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 28 Apr 2015 23:25:09 +0200 Subject: [PATCH] * Fix two bugs in feature calculation --- spacy/syntax/_parse_features.pyx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spacy/syntax/_parse_features.pyx b/spacy/syntax/_parse_features.pyx index 5be8ce2ca..2582d768d 100644 --- a/spacy/syntax/_parse_features.pyx +++ b/spacy/syntax/_parse_features.pyx @@ -51,8 +51,8 @@ cdef inline void fill_token(atom_t* context, const TokenC* token) nogil: # What we're doing here is picking a number where all bits are 1, e.g. # 15 is 1111, 63 is 111111 and doing bitwise AND, so getting all bits in # the source that are set to 1. - context[4] = token.lex.cluster & 63 - context[5] = token.lex.cluster & 15 + context[4] = token.lex.cluster & 15 + context[5] = token.lex.cluster & 63 context[6] = token.dep if has_head(token) else 0 context[7] = token.lex.prefix context[8] = token.lex.suffix @@ -102,7 +102,7 @@ cdef int fill_context(atom_t* context, State* state) except -1: if state.stack_len >= 2: context[S1_has_head] = has_head(get_s1(state)) + 1 if state.stack_len >= 3: - context[S2_has_head] = has_head(get_s2(state)) + context[S2_has_head] = has_head(get_s2(state)) + 1 ner = ( @@ -290,6 +290,7 @@ s0_n1 = ( (S0c6, S0p, N1c6, N1p), ) + n0_n1 = ( (N0W, N0p, N1W, N1p), (N0W, N0p, N1p),