(self, text: str)
| 23 | self.patterns = patterns |
| 24 | |
| 25 | def chunk(self, text: str) -> list: |
| 26 | paragraphs = [text] |
| 27 | for pattern in self.patterns: |
| 28 | new_paragraphs = [] |
| 29 | for paragraph in paragraphs: |
| 30 | new_paragraphs.extend(re.split(pattern, paragraph)) |
| 31 | paragraphs = new_paragraphs |
| 32 | return paragraphs |
| 33 | |
| 34 | # NLP-based sentence chunking |
| 35 | class NlpSentenceChunking(ChunkingStrategy): |
no outgoing calls
no test coverage detected