nlpaug
nlpaug copied to clipboard
Issue with Contextual Word Augmentor
File "/workspace/system-paper/main_dsscc_hil.py", line 61, in main_dsscc_hil
main_copy(p)
File "/workspace/system-paper/main_copy_args.py", line 230, in main_copy
contextual_augment(p, aug_percentage[p['dataset']])
File "/workspace/system-paper/contextual_augmenter.py", line 49, in contextual_augment
aug_txt_2 = aug_2.augment(txt)
File "/opt/conda/lib/python3.6/site-packages/nlpaug/base_augmenter.py", line 98, in augment
result = action_fx(clean_data)
File "/opt/conda/lib/python3.6/site-packages/nlpaug/augmenter/word/context_word_embs.py", line 464, in substitute
masked_text = self.model.get_tokenizer().convert_tokens_to_string(head_doc.get_augmented_tokens()).strip()
AttributeError: 'list' object has no attribute 'strip'
I was able to solve the issue by downloading the repo and updating 1 line as follows: line 464 in https://github.com/makcedward/nlpaug/blob/master/nlpaug/augmenter/word/context_word_embs.py
masked_text= self.model.get_tokenizer().convert_tokens_to_string(head_doc.get_augmented_tokens())[0].strip()