mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
test augmenter
This commit is contained in:
@@ -37,4 +37,19 @@ def import_textattack():
|
|||||||
|
|
||||||
register_test(import_textattack, name='import textattack',
|
register_test(import_textattack, name='import textattack',
|
||||||
output_file='local_tests/sample_outputs/empty_file.txt',
|
output_file='local_tests/sample_outputs/empty_file.txt',
|
||||||
desc='Makes sure the textattack module can be imported')
|
desc='Makes sure the textattack module can be imported')
|
||||||
|
#
|
||||||
|
# test: import augmenter
|
||||||
|
#
|
||||||
|
def use_embedding_augmenter():
|
||||||
|
from textattack.augmentation import EmbeddingAugmenter
|
||||||
|
augmenter = EmbeddingAugmenter()
|
||||||
|
s = 'There is nothing either good or bad, but thinking makes it so.'
|
||||||
|
augmented_text_list = augmenter.augment(s)
|
||||||
|
augmented_s = 'There is nothing either good or unfavourable, but thinking makes it so.'
|
||||||
|
assert augmented_s in augmented_text_list
|
||||||
|
|
||||||
|
|
||||||
|
register_test(use_embedding_augmenter, name='use EmbeddingAugmenter',
|
||||||
|
output_file='local_tests/sample_outputs/empty_file.txt',
|
||||||
|
desc='Imports EmbeddingAugmenter and augments a single sentence')
|
||||||
Reference in New Issue
Block a user