(self, ids, strip_eos=False, strip_padding=False)
| 205 | return ret[::-1] if self._reverse else ret |
| 206 | |
| 207 | def decode(self, ids, strip_eos=False, strip_padding=False): |
| 208 | if strip_padding and self.pad() in list(ids): |
| 209 | pad_pos = list(ids).index(self.pad()) |
| 210 | ids = ids[:pad_pos] |
| 211 | if strip_eos and self.eos() in list(ids): |
| 212 | eos_pos = list(ids).index(self.eos()) |
| 213 | ids = ids[:eos_pos] |
| 214 | return " ".join(self.decode_list(ids)) |
| 215 | |
| 216 | def decode_list(self, ids): |
| 217 | seq = reversed(ids) if self._reverse else ids |
nothing calls this directly
no test coverage detected