Ejemplo n.º 1
0
def test_sentence_level_sampler_swap():
    sls = SentenceLevelSampler(types=["swap"])
    text = "我爱你。你爱我。NLP 很有意思。简洁最重要。"
    res = sls.make_samples(text)
    assert len(res) == 2
Ejemplo n.º 2
0
def test_sentence_level_sampler_none_text():
    sls = SentenceLevelSampler()
    text = ""
    assert sls.make_samples(text) == {}
Ejemplo n.º 3
0
def test_sentence_level_sampler_none():
    sls = SentenceLevelSampler([])
    text = "我爱你。你爱我。"
    assert sls.make_samples(text) == {}
Ejemplo n.º 4
0
def test_sentence_level_sampler_single_sent():
    sls = SentenceLevelSampler()
    text = "我爱你。"
    assert len(sls.make_samples(text)) == 4
Ejemplo n.º 5
0
def test_sentence_level_sampler():
    sls = SentenceLevelSampler()
    text = "我爱你。你爱我。"
    res = sls.make_samples(text)
    assert type(res) == dict
    assert len(res) == 4