2019-01-16 15:45:50 +03:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2019-02-08 16:14:49 +03:00
|
|
|
|
|
|
|
@pytest.mark.parametrize("text", ["(under)"])
|
2019-01-16 15:45:50 +03:00
|
|
|
def test_tokenizer_splits_no_special(sv_tokenizer, text):
|
|
|
|
tokens = sv_tokenizer(text)
|
|
|
|
assert len(tokens) == 3
|
|
|
|
|
|
|
|
|
2019-02-08 16:14:49 +03:00
|
|
|
@pytest.mark.parametrize("text", ["gitta'r", "Björn's", "Lars'"])
|
2019-01-16 15:45:50 +03:00
|
|
|
def test_tokenizer_handles_no_punct(sv_tokenizer, text):
|
|
|
|
tokens = sv_tokenizer(text)
|
|
|
|
assert len(tokens) == 1
|
|
|
|
|
|
|
|
|
2019-02-08 16:14:49 +03:00
|
|
|
@pytest.mark.parametrize("text", ["svart.Gul", "Hej.Världen"])
|
2019-01-16 15:45:50 +03:00
|
|
|
def test_tokenizer_splits_period_infix(sv_tokenizer, text):
|
|
|
|
tokens = sv_tokenizer(text)
|
|
|
|
assert len(tokens) == 3
|
|
|
|
|
|
|
|
|
2019-02-08 16:14:49 +03:00
|
|
|
@pytest.mark.parametrize("text", ["Hej,Världen", "en,två"])
|
2019-01-16 15:45:50 +03:00
|
|
|
def test_tokenizer_splits_comma_infix(sv_tokenizer, text):
|
|
|
|
tokens = sv_tokenizer(text)
|
|
|
|
assert len(tokens) == 3
|
|
|
|
assert tokens[0].text == text.split(",")[0]
|
|
|
|
assert tokens[1].text == ","
|
|
|
|
assert tokens[2].text == text.split(",")[1]
|
|
|
|
|
|
|
|
|
2019-02-08 16:14:49 +03:00
|
|
|
@pytest.mark.parametrize("text", ["svart...Gul", "svart...gul"])
|
2019-01-16 15:45:50 +03:00
|
|
|
def test_tokenizer_splits_ellipsis_infix(sv_tokenizer, text):
|
|
|
|
tokens = sv_tokenizer(text)
|
|
|
|
assert len(tokens) == 3
|