mirror of https://github.com/explosion/spaCy.git
Fix Doc.to_array when only one string attr provided
This commit is contained in:
parent
301fb2bb60
commit
7e7116cdf7
|
@ -28,7 +28,7 @@ from ..attrs cimport LENGTH, POS, LEMMA, TAG, DEP, HEAD, SPACY, ENT_IOB
|
||||||
from ..attrs cimport ENT_TYPE, SENT_START
|
from ..attrs cimport ENT_TYPE, SENT_START
|
||||||
from ..parts_of_speech cimport CCONJ, PUNCT, NOUN, univ_pos_t
|
from ..parts_of_speech cimport CCONJ, PUNCT, NOUN, univ_pos_t
|
||||||
from ..util import normalize_slice
|
from ..util import normalize_slice
|
||||||
from ..compat import is_config, copy_reg, pickle
|
from ..compat import is_config, copy_reg, pickle, basestring_
|
||||||
from .. import about
|
from .. import about
|
||||||
from .. import util
|
from .. import util
|
||||||
from .underscore import Underscore
|
from .underscore import Underscore
|
||||||
|
@ -571,7 +571,8 @@ cdef class Doc:
|
||||||
cdef np.ndarray[attr_t, ndim=1] attr_ids
|
cdef np.ndarray[attr_t, ndim=1] attr_ids
|
||||||
cdef np.ndarray[attr_t, ndim=2] output
|
cdef np.ndarray[attr_t, ndim=2] output
|
||||||
# Handle scalar/list inputs of strings/ints for py_attr_ids
|
# Handle scalar/list inputs of strings/ints for py_attr_ids
|
||||||
if not hasattr(py_attr_ids, '__iter__'):
|
if not hasattr(py_attr_ids, '__iter__') \
|
||||||
|
and not isinstance(py_attr_ids, basestring_):
|
||||||
py_attr_ids = [py_attr_ids]
|
py_attr_ids = [py_attr_ids]
|
||||||
|
|
||||||
# Allow strings, e.g. 'lemma' or 'LEMMA'
|
# Allow strings, e.g. 'lemma' or 'LEMMA'
|
||||||
|
|
Loading…
Reference in New Issue