| 304 | return tokens[offset:] + tokens[0:offset] |
| 305 | |
| 306 | def apply(self, tokens): |
| 307 | if self.permute_sent_ratio > 0.0: |
| 308 | tokens = self.permute_sentences(tokens, self.permute_sent_ratio) |
| 309 | |
| 310 | if self.mask_ratio > 0.0: |
| 311 | tokens = self.whole_word_mask(tokens, self.mask_ratio) |
| 312 | |
| 313 | if self.insert_ratio > 0.0: |
| 314 | tokens = self.insertion_noise(tokens, self.insert_ratio) |
| 315 | |
| 316 | if self.rotate_ratio > 0.0: |
| 317 | tokens = self.rolling_noise(tokens, self.rotate_ratio) |
| 318 | return tokens |
| 319 | |
| 320 | def __repr__(self): |
| 321 | cls_name = type(self).__name__ |