_split(text : string) -> [string] Split the text to wrap into indivisible chunks. Chunks are not quite the same as words; see _wrap_chunks() for full details. As an example, the text Look, goof-ball -- use the -b option! breaks into the following chunks:
(self, text)
| 155 | |
| 156 | |
| 157 | def _split(self, text): |
| 158 | """_split(text : string) -> [string] |
| 159 | |
| 160 | Split the text to wrap into indivisible chunks. Chunks are |
| 161 | not quite the same as words; see _wrap_chunks() for full |
| 162 | details. As an example, the text |
| 163 | Look, goof-ball -- use the -b option! |
| 164 | breaks into the following chunks: |
| 165 | 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ', |
| 166 | 'use', ' ', 'the', ' ', '-b', ' ', 'option!' |
| 167 | if break_on_hyphens is True, or in: |
| 168 | 'Look,', ' ', 'goof-ball', ' ', '--', ' ', |
| 169 | 'use', ' ', 'the', ' ', '-b', ' ', option!' |
| 170 | otherwise. |
| 171 | """ |
| 172 | if self.break_on_hyphens is True: |
| 173 | chunks = self.wordsep_re.split(text) |
| 174 | else: |
| 175 | chunks = self.wordsep_simple_re.split(text) |
| 176 | chunks = [c for c in chunks if c] |
| 177 | return chunks |
| 178 | |
| 179 | def _fix_sentence_endings(self, chunks): |
| 180 | """_fix_sentence_endings(chunks : [string]) |