mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Add test for new Span.to_array method
This commit is contained in:
parent
dea229c634
commit
4fda02c7e6
|
@ -2,6 +2,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from ..util import get_doc
|
||||
from ...attrs import ORTH, LENGTH
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -96,3 +97,12 @@ def test_spans_by_character(doc):
|
|||
assert span1.start_char == span2.start_char
|
||||
assert span1.end_char == span2.end_char
|
||||
assert span2.label_ == 'GPE'
|
||||
|
||||
|
||||
def test_span_to_array(doc):
|
||||
span = doc[1:-2]
|
||||
arr = span.to_array([ORTH, LENGTH])
|
||||
assert arr.shape == (len(span), 2)
|
||||
assert arr[0, 0] == span[0].orth
|
||||
assert arr[0, 1] == len(span[0])
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user