Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,8 +9,8 @@ def find_silliest(text):
|
|
| 9 |
if not text or not text.strip():
|
| 10 |
return "Paste some text above first!"
|
| 11 |
|
| 12 |
-
# Split
|
| 13 |
-
sentences = [s.strip() for s in re.split(r'[.!?
|
| 14 |
|
| 15 |
if len(sentences) == 0:
|
| 16 |
return "I need at least a couple of sentences to compare. Paste a longer passage!"
|
|
|
|
| 9 |
if not text or not text.strip():
|
| 10 |
return "Paste some text above first!"
|
| 11 |
|
| 12 |
+
# Split on sentence-ending punctuation followed by whitespace (avoids breaking on "Rep." etc.)
|
| 13 |
+
sentences = [s.strip() for s in re.split(r'(?<=[.!?])\s+(?=[A-Z"])', text) if len(s.strip()) > 30]
|
| 14 |
|
| 15 |
if len(sentences) == 0:
|
| 16 |
return "I need at least a couple of sentences to compare. Paste a longer passage!"
|