profplate commited on
Commit
88f24ec
·
verified ·
1 Parent(s): 3a4ed3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 into sentences on punctuation or newlines
13
- sentences = [s.strip() for s in re.split(r'[.!?\n]+', text) if len(s.strip()) > 10]
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!"