(self, chunk: List[int])
| 72 | return merged_splits |
| 73 | |
| 74 | def _split_chunk(self, chunk: List[int]) -> List[List[int]]: |
| 75 | result = [] |
| 76 | for i in range(0, len(chunk), self._chunk_size - self._chunk_overlap): |
| 77 | new_chunk = chunk[i:i + self._chunk_size] |
| 78 | if len(new_chunk) > self._chunk_overlap: # 只有当 chunk 长度大于 overlap 时才添加 |
| 79 | result.append(new_chunk) |
| 80 | return result |
| 81 | |
| 82 | def _enforce_overlap(self, chunks: List[List[int]]) -> List[List[int]]: |
| 83 | result = [] |