mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
* Add tests for new subtree method
This commit is contained in:
parent
053814ffc8
commit
a61dacb4e5
19
tests/test_subtree.py
Normal file
19
tests/test_subtree.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from __future__ import unicode_literals
|
||||
from spacy.en import English
|
||||
|
||||
EN = English()
|
||||
|
||||
|
||||
def test_subtrees():
|
||||
sent = EN('The four wheels on the bus turned quickly')
|
||||
wheels = sent[2]
|
||||
bus = sent[5]
|
||||
assert len(list(wheels.lefts)) == 2
|
||||
assert len(list(wheels.rights)) == 1
|
||||
assert len(list(wheels.children)) == 3
|
||||
assert len(list(bus.lefts)) == 1
|
||||
assert len(list(bus.rights)) == 0
|
||||
assert len(list(bus.children)) == 1
|
||||
|
||||
assert len(list(wheels.subtree)) == 6
|
||||
|
Loading…
Reference in New Issue
Block a user