2018-11-26 14:25:47 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2019-08-20 15:36:34 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"text,lemma",
|
|
|
|
[("aprox.", "aproximadament"), ("pàg.", "pàgina"), ("p.ex.", "per exemple")],
|
|
|
|
)
|
2018-11-26 14:25:47 +00:00
|
|
|
def test_ca_tokenizer_handles_abbr(ca_tokenizer, text, lemma):
|
|
|
|
tokens = ca_tokenizer(text)
|
|
|
|
assert len(tokens) == 1
|
|
|
|
|
|
|
|
|
|
|
|
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."
|