diff --git a/spacy/tests/regression/test_issue4002.py b/spacy/tests/regression/test_issue4002.py index d9b509a30..d5d7bc86c 100644 --- a/spacy/tests/regression/test_issue4002.py +++ b/spacy/tests/regression/test_issue4002.py @@ -6,7 +6,6 @@ from spacy.matcher import PhraseMatcher from spacy.tokens import Doc -@pytest.mark.xfail def test_issue4002(en_vocab): """Test that the PhraseMatcher can match on overwritten NORM attributes. """ diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index 7ab1563e9..e9c5a0f1d 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -49,6 +49,10 @@ cdef int bounds_check(int i, int length, int padding) except -1: cdef attr_t get_token_attr(const TokenC* token, attr_id_t feat_name) nogil: if feat_name == LEMMA: return token.lemma + elif feat_name == NORM: + if not token.norm: + return token.lex.norm + return token.norm elif feat_name == POS: return token.pos elif feat_name == TAG: