Anshviradiya commited on
Commit
d51476d
·
verified ·
1 Parent(s): e47dd69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -25,10 +25,17 @@ os.environ["UNSTRUCTURED_DISABLE_INFERENCE"] = "true"
25
  # ==================== QUESTION SPLITTER ====================
26
  def split_questions(text):
27
  text = text.replace("\n", " ").strip()
28
- questions = re.split(r'(?<=[?])\s+', text)
 
 
 
 
 
 
29
  return [q.strip() for q in questions if q.strip()]
30
 
31
 
 
32
  # ==================== PROMPT ====================
33
  PROMPT = PromptTemplate(
34
  template="""
 
25
  # ==================== QUESTION SPLITTER ====================
26
  def split_questions(text):
27
  text = text.replace("\n", " ").strip()
28
+
29
+ # Split on ? OR . only if the dot is NOT part of a number like "1."
30
+ questions = re.split(
31
+ r'(?<!\d)(?<=[?.])\s*',
32
+ text
33
+ )
34
+
35
  return [q.strip() for q in questions if q.strip()]
36
 
37
 
38
+
39
  # ==================== PROMPT ====================
40
  PROMPT = PromptTemplate(
41
  template="""