()
| 116 | |
| 117 | |
| 118 | def test_chinese_morphonym_character_swap(): |
| 119 | from textattack.augmentation import Augmenter |
| 120 | from textattack.transformations.word_swaps.chn_transformations import ( |
| 121 | ChineseMorphonymCharacterSwap, |
| 122 | ) |
| 123 | |
| 124 | augmenter = Augmenter( |
| 125 | transformation=ChineseMorphonymCharacterSwap(), |
| 126 | pct_words_to_swap=0.1, |
| 127 | transformations_per_example=5, |
| 128 | ) |
| 129 | s = "自然语言处理。" |
| 130 | augmented_text_list = augmenter.augment(s) |
| 131 | augmented_s = "自然语言处埋。" |
| 132 | assert augmented_s or s in augmented_text_list |
| 133 | |
| 134 | |
| 135 | def test_chinese_word_swap_hownet(): |
nothing calls this directly
no test coverage detected