mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Add POS attribute support in get_attr
This commit is contained in:
parent
bf38b3b883
commit
fd1eeb3102
|
@ -12,6 +12,7 @@ from ..attrs cimport ID, ORTH, NORM, LOWER, SHAPE, PREFIX, SUFFIX, LENGTH, CLUST
|
||||||
from ..attrs cimport POS, LEMMA, TAG, DEP, HEAD, SPACY, ENT_IOB, ENT_TYPE
|
from ..attrs cimport POS, LEMMA, TAG, DEP, HEAD, SPACY, ENT_IOB, ENT_TYPE
|
||||||
from ..parts_of_speech import UNIV_POS_NAMES
|
from ..parts_of_speech import UNIV_POS_NAMES
|
||||||
from ..parts_of_speech cimport CONJ, PUNCT, NOUN
|
from ..parts_of_speech cimport CONJ, PUNCT, NOUN
|
||||||
|
from ..parts_of_speech cimport univ_pos_t
|
||||||
from ..lexeme cimport check_flag
|
from ..lexeme cimport check_flag
|
||||||
from ..lexeme cimport get_attr as get_lex_attr
|
from ..lexeme cimport get_attr as get_lex_attr
|
||||||
from .spans cimport Span
|
from .spans cimport Span
|
||||||
|
@ -327,6 +328,9 @@ cdef class Doc:
|
||||||
elif attr_id == TAG:
|
elif attr_id == TAG:
|
||||||
for i in range(length):
|
for i in range(length):
|
||||||
tokens[i].tag = values[i]
|
tokens[i].tag = values[i]
|
||||||
|
elif attr_id == POS:
|
||||||
|
for i in range(length):
|
||||||
|
tokens[i].pos = <univ_pos_t>values[i]
|
||||||
elif attr_id == DEP:
|
elif attr_id == DEP:
|
||||||
for i in range(length):
|
for i in range(length):
|
||||||
tokens[i].dep = values[i]
|
tokens[i].dep = values[i]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user