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