ner: re-enable sentence boundary checks

This commit is contained in:
Daniël de Kok 2022-06-09 14:50:47 +02:00
parent 11ae4cc3d3
commit 5fd369b9e9

View File

@ -387,9 +387,9 @@ cdef class Begin:
elif st.B_(1).ent_iob == 3: elif st.B_(1).ent_iob == 3:
# If the next word is B, we can't B now # If the next word is B, we can't B now
return False return False
#elif st.B_(1).sent_start == 1: elif st.B_(1).sent_start == 1:
# # Don't allow entities to extend across sentence boundaries # Don't allow entities to extend across sentence boundaries
# return False return False
# Don't allow entities to start on whitespace # Don't allow entities to start on whitespace
elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE):
return False return False
@ -467,9 +467,9 @@ cdef class In:
# Otherwise, force acceptance, even if we're across a sentence # Otherwise, force acceptance, even if we're across a sentence
# boundary or the token is whitespace. # boundary or the token is whitespace.
return True return True
#elif st.B(1) != -1 and st.B_(1).sent_start == 1: elif st.B(1) != -1 and st.B_(1).sent_start == 1:
# # Don't allow entities to extend across sentence boundaries # Don't allow entities to extend across sentence boundaries
# return False return False
else: else:
return True return True