Spaces:
Running
Running
File size: 673 Bytes
4a1df2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
"""
word deletion Transformation
============================================
"""
from .transformation import Transformation
class WordDeletion(Transformation):
"""An abstract class that takes a sentence and transforms it by deleting a
single word.
letters_to_insert (string): letters allowed for insertion into words
"""
def _get_transformations(self, current_text, indices_to_modify):
# words = current_text.words
transformed_texts = []
if len(current_text.words) > 1:
for i in indices_to_modify:
transformed_texts.append(current_text.delete_word_at_index(i))
return transformed_texts
|