2017-04-06 16:48:45 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2018-07-24 21:38:44 +00:00
|
|
|
@pytest.mark.parametrize('text,lemma', [
|
|
|
|
("aprox.", "aproximadamente"),
|
|
|
|
("esq.", "esquina"),
|
|
|
|
("pág.", "página"),
|
|
|
|
("p.ej.", "por ejemplo")])
|
|
|
|
def test_es_tokenizer_handles_abbr(es_tokenizer, text, lemma):
|
2017-04-06 16:48:45 +00:00
|
|
|
tokens = es_tokenizer(text)
|
|
|
|
assert len(tokens) == 1
|
|
|
|
assert tokens[0].lemma_ == lemma
|
|
|
|
|
|
|
|
|
2018-07-24 21:38:44 +00:00
|
|
|
def test_es_tokenizer_handles_exc_in_text(es_tokenizer):
|
2017-04-06 16:48:45 +00:00
|
|
|
text = "Mariano Rajoy ha corrido aprox. medio kilómetro"
|
|
|
|
tokens = es_tokenizer(text)
|
|
|
|
assert len(tokens) == 7
|
|
|
|
assert tokens[4].text == "aprox."
|
|
|
|
assert tokens[4].lemma_ == "aproximadamente"
|