spaCy/tests/parser/test_conjuncts.py

34 lines
971 B
Python
Raw Normal View History

2015-04-16 23:40:53 +00:00
"""Test the Token.conjuncts property"""
from __future__ import unicode_literals
import pytest
def orths(tokens):
return [t.orth_ for t in tokens]
2015-06-07 17:08:04 +00:00
#def test_simple_two(EN):
# tokens = EN('I lost money and pride.', tag=True, parse=True)
# pride = tokens[4]
# assert orths(pride.conjuncts) == ['money', 'pride']
# money = tokens[2]
2015-06-07 17:31:16 +00:00
# assert orths(money.conjuncts) == ['money', 'pride']
2015-04-16 23:40:53 +00:00
#def test_comma_three(EN):
# tokens = EN('I found my wallet, phone and keys.')
# keys = tokens[-2]
# assert orths(keys.conjuncts) == ['wallet', 'phone', 'keys']
# wallet = tokens[3]
# assert orths(wallet.conjuncts) == ['wallet', 'phone', 'keys']
2015-04-16 23:40:53 +00:00
# This is failing due to parse errors
#def test_and_three():
# tokens = NLU('I found my wallet and phone and keys.')
# keys = tokens[-2]
# assert orths(keys.conjuncts) == ['wallet', 'phone', 'keys']
# wallet = tokens[3]
# assert orths(wallet.conjuncts) == ['wallet', 'phone', 'keys']