Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,7 +171,7 @@ def chunk_text(text, max_chars):
|
|
| 171 |
current_chunk = ""
|
| 172 |
|
| 173 |
# Split the text into sentences based on punctuation followed by whitespace
|
| 174 |
-
sentences = re.split(r"(?<=[
|
| 175 |
|
| 176 |
for sentence in sentences:
|
| 177 |
# If adding this sentence doesn't exceed max_chars, append it to the current chunk
|
|
|
|
| 171 |
current_chunk = ""
|
| 172 |
|
| 173 |
# Split the text into sentences based on punctuation followed by whitespace
|
| 174 |
+
sentences = re.split(r"(?<=[;:,.。、!?])\s+|(?<=[;:,.。、!?])", text)
|
| 175 |
|
| 176 |
for sentence in sentences:
|
| 177 |
# If adding this sentence doesn't exceed max_chars, append it to the current chunk
|