Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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="""
|