From 5fd369b9e90053607bf684f68127021c5dbc6f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Thu, 9 Jun 2022 14:50:47 +0200 Subject: [PATCH] ner: re-enable sentence boundary checks --- spacy/pipeline/_parser_internals/ner.pyx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spacy/pipeline/_parser_internals/ner.pyx b/spacy/pipeline/_parser_internals/ner.pyx index 308da3593..9ad809763 100644 --- a/spacy/pipeline/_parser_internals/ner.pyx +++ b/spacy/pipeline/_parser_internals/ner.pyx @@ -387,9 +387,9 @@ cdef class Begin: elif st.B_(1).ent_iob == 3: # If the next word is B, we can't B now return False - #elif st.B_(1).sent_start == 1: - # # Don't allow entities to extend across sentence boundaries - # return False + elif st.B_(1).sent_start == 1: + # Don't allow entities to extend across sentence boundaries + return False # Don't allow entities to start on whitespace elif Lexeme.get_struct_attr(st.B_(0).lex, IS_SPACE): return False @@ -467,9 +467,9 @@ cdef class In: # Otherwise, force acceptance, even if we're across a sentence # boundary or the token is whitespace. return True - #elif st.B(1) != -1 and st.B_(1).sent_start == 1: - # # Don't allow entities to extend across sentence boundaries - # return False + elif st.B(1) != -1 and st.B_(1).sent_start == 1: + # Don't allow entities to extend across sentence boundaries + return False else: return True