* Bug fixes to ner.pyx

This commit is contained in:
Matthew Honnibal 2015-06-10 06:57:41 +02:00
parent 90a3add8d7
commit 18cc326dc0

View File

@ -180,8 +180,8 @@ cdef class Begin:
@staticmethod @staticmethod
cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1:
cdef int g_act = gold.ner[s.i].move cdef int g_act = gold.ner[s.B(0)].move
cdef int g_tag = gold.ner[s.i].label cdef int g_tag = gold.ner[s.B(0)].label
if g_act == MISSING: if g_act == MISSING:
return 0 return 0
@ -210,9 +210,9 @@ cdef class In:
@staticmethod @staticmethod
cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1:
move = IN move = IN
cdef int next_act = gold.ner[s.i+1].move if s.i < s.sent_len else OUT cdef int next_act = gold.ner[s.B(1)].move if s.B(0) < s.length else OUT
cdef int g_act = gold.ner[s.i].move cdef int g_act = gold.ner[s.B(0)].move
cdef int g_tag = gold.ner[s.i].label cdef int g_tag = gold.ner[s.B(0)].label
cdef bint is_sunk = _entity_is_sunk(s, gold.ner) cdef bint is_sunk = _entity_is_sunk(s, gold.ner)
if g_act == MISSING: if g_act == MISSING:
@ -251,8 +251,8 @@ cdef class Last:
cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1:
move = LAST move = LAST
cdef int g_act = gold.ner[s.i].move cdef int g_act = gold.ner[s.B(0)].move
cdef int g_tag = gold.ner[s.i].label cdef int g_tag = gold.ner[s.B(0)].label
if g_act == MISSING: if g_act == MISSING:
return 0 return 0
@ -290,8 +290,8 @@ cdef class Unit:
@staticmethod @staticmethod
cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1:
cdef int g_act = gold.ner[s.i].move cdef int g_act = gold.ner[s.B(0)].move
cdef int g_tag = gold.ner[s.i].label cdef int g_tag = gold.ner[s.B(0)].label
if g_act == MISSING: if g_act == MISSING:
return 0 return 0
@ -319,8 +319,8 @@ cdef class Out:
@staticmethod @staticmethod
cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1: cdef int cost(StateClass s, const GoldParseC* gold, int label) except -1:
cdef int g_act = gold.ner[s.i].move cdef int g_act = gold.ner[s.B(0)].move
cdef int g_tag = gold.ner[s.i].label cdef int g_tag = gold.ner[s.B(0)].label
if g_act == MISSING: if g_act == MISSING: