2019-02-04 09:37:19 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
2021-09-27 12:42:30 +00:00
|
|
|
"text,expected_tokens",
|
|
|
|
[
|
|
|
|
("d'un", ["d'", "un"]),
|
|
|
|
("s'ha", ["s'", "ha"]),
|
|
|
|
("del", ["d", "el"]),
|
|
|
|
("cantar-te", ["cantar", "-te"]),
|
|
|
|
("-hola", ["-", "hola"]),
|
|
|
|
],
|
2019-02-04 09:37:19 +00:00
|
|
|
)
|
|
|
|
def test_contractions(ca_tokenizer, text, expected_tokens):
|
2021-07-02 07:48:26 +00:00
|
|
|
"""Test that the contractions are split into two tokens"""
|
2019-02-04 09:37:19 +00:00
|
|
|
tokens = ca_tokenizer(text)
|
|
|
|
assert len(tokens) == 2
|
2019-02-04 21:39:25 +00:00
|
|
|
assert [t.text for t in tokens] == expected_tokens
|