MCPcopy
hub / github.com/QData/TextAttack / test_chinese_word_swap_masked

Function test_chinese_word_swap_masked

tests/test_transformations.py:152–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150
151
152def test_chinese_word_swap_masked():
153 from textattack.augmentation import Augmenter
154 from textattack.transformations.word_swaps.chn_transformations import (
155 ChineseWordSwapMaskedLM,
156 )
157
158 augmenter = Augmenter(
159 transformation=ChineseWordSwapMaskedLM(),
160 pct_words_to_swap=0.1,
161 transformations_per_example=5,
162 )
163 s = "自然语言处理。"
164 augmented_text_list = augmenter.augment(s)
165 augmented_s = "自然语言文字。"
166 assert augmented_s or s in augmented_text_list

Callers

nothing calls this directly

Calls 3

augmentMethod · 0.95
AugmenterClass · 0.90

Tested by

no test coverage detected