diff --git a/spacy/en/attrs.pxd b/spacy/en/attrs.pxd index 34f8e600b..a21784a20 100644 --- a/spacy/en/attrs.pxd +++ b/spacy/en/attrs.pxd @@ -10,6 +10,7 @@ from ..attrs cimport SUFFIX as _SUFFIX from ..attrs cimport LEMMA as _LEMMA from ..attrs cimport POS as _POS from ..attrs cimport TAG as _TAG +from ..attrs cimport DEP as _DEP cpdef enum: @@ -35,3 +36,4 @@ cpdef enum: LEMMA = _LEMMA POS = _POS TAG = _TAG + DEP = _DEP diff --git a/spacy/tokens.pyx b/spacy/tokens.pyx index e96e69faa..8747cab8a 100644 --- a/spacy/tokens.pyx +++ b/spacy/tokens.pyx @@ -9,7 +9,7 @@ from .vocab cimport EMPTY_LEXEME from .typedefs cimport attr_id_t, attr_t from .typedefs cimport LEMMA from .typedefs cimport ID, ORTH, NORM, LOWER, SHAPE, PREFIX, SUFFIX, LENGTH, CLUSTER -from .typedefs cimport POS, LEMMA +from .typedefs cimport POS, LEMMA, TAG, DEP from .parts_of_speech import UNIV_POS_NAMES from .lexeme cimport check_flag from .spans import Span @@ -25,6 +25,7 @@ cimport cython from cpython.mem cimport PyMem_Malloc, PyMem_Free from libc.string cimport memcpy + DEF PADDING = 5 @@ -40,6 +41,10 @@ cdef attr_t get_token_attr(const TokenC* token, attr_id_t feat_name) nogil: return token.lemma elif feat_name == POS: return token.pos + elif feat_name == TAG: + return token.tag + elif feat_name == DEP: + return token.dep else: return get_lex_attr(token.lex, feat_name) diff --git a/spacy/typedefs.pxd b/spacy/typedefs.pxd index 3c2ee234e..3eefab27d 100644 --- a/spacy/typedefs.pxd +++ b/spacy/typedefs.pxd @@ -81,6 +81,9 @@ cpdef enum attr_id_t: CLUSTER LEMMA POS + TAG + DEP + ENT