2017-04-06 19:48:45 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2018-11-27 03:09:36 +03:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"text,lemma",
|
|
|
|
[
|
|
|
|
("aprox.", "aproximadamente"),
|
|
|
|
("esq.", "esquina"),
|
|
|
|
("pág.", "página"),
|
|
|
|
("p.ej.", "por ejemplo"),
|
|
|
|
],
|
|
|
|
)
|
2018-07-25 00:38:44 +03:00
|
|
|
def test_es_tokenizer_handles_abbr(es_tokenizer, text, lemma):
|
2017-04-06 19:48:45 +03:00
|
|
|
tokens = es_tokenizer(text)
|
|
|
|
assert len(tokens) == 1
|
|
|
|
|
|
|
|
|
2018-07-25 00:38:44 +03:00
|
|
|
def test_es_tokenizer_handles_exc_in_text(es_tokenizer):
|
2017-04-06 19:48:45 +03:00
|
|
|
text = "Mariano Rajoy ha corrido aprox. medio kilómetro"
|
|
|
|
tokens = es_tokenizer(text)
|
|
|
|
assert len(tokens) == 7
|
|
|
|
assert tokens[4].text == "aprox."
|