mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
24 lines
752 B
Python
24 lines
752 B
Python
|
# coding: utf-8
|
||
|
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
|
||
|
@pytest.mark.parametrize('text,lemma', [("aprox.", "aproximadament"),
|
||
|
("pàg.", "pàgina"),
|
||
|
("p.ex.", "per exemple")
|
||
|
])
|
||
|
def test_ca_tokenizer_handles_abbr(ca_tokenizer, text, lemma):
|
||
|
tokens = ca_tokenizer(text)
|
||
|
assert len(tokens) == 1
|
||
|
assert tokens[0].lemma_ == lemma
|
||
|
|
||
|
|
||
|
def test_ca_tokenizer_handles_exc_in_text(ca_tokenizer):
|
||
|
text = "La Núria i el Pere han vingut aprox. a les 7 de la tarda."
|
||
|
tokens = ca_tokenizer(text)
|
||
|
assert len(tokens) == 15
|
||
|
assert tokens[7].text == "aprox."
|
||
|
assert tokens[7].lemma_ == "aproximadament"
|