Returns the next previous chunk in the sentence with the given type.
(self, type=None)
| 424 | i += 1 |
| 425 | |
| 426 | def previous(self, type=None): |
| 427 | """ Returns the next previous chunk in the sentence with the given type. |
| 428 | """ |
| 429 | i = self.start-1 |
| 430 | while i > 0: |
| 431 | if self.sentence[i].chunk is not None and type in (self.sentence[i].chunk.type, None): |
| 432 | return self.sentence[i].chunk |
| 433 | i -= 1 |
| 434 | |
| 435 | # Chunk.string and unicode(Chunk) are Unicode strings. |
| 436 | # repr(Chunk) is a Python string (with Unicode characters encoded). |