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