Spaces:
Sleeping
Sleeping
Handled input like "sleep anxiety"
Browse files
app.py
CHANGED
|
@@ -68,13 +68,13 @@ def is_valid_input(text):
|
|
| 68 |
if not text or text.strip() == "":
|
| 69 |
return False, "Input cannot be empty. Please provide a meaningful question."
|
| 70 |
|
| 71 |
-
if len(text.strip()) <
|
| 72 |
-
return False, "Input is too short. Please provide
|
| 73 |
|
| 74 |
-
#
|
| 75 |
words = re.findall(r'\b\w+\b', text)
|
| 76 |
-
if len(words) <
|
| 77 |
-
return False, "Input appears incomplete. Please provide a
|
| 78 |
|
| 79 |
return True, "Valid input."
|
| 80 |
|
|
|
|
| 68 |
if not text or text.strip() == "":
|
| 69 |
return False, "Input cannot be empty. Please provide a meaningful question."
|
| 70 |
|
| 71 |
+
if len(text.strip()) < 2:
|
| 72 |
+
return False, "Input is too short. Please provide more context or details."
|
| 73 |
|
| 74 |
+
# Check if the input has at least one valid word
|
| 75 |
words = re.findall(r'\b\w+\b', text)
|
| 76 |
+
if len(words) < 1: # Require at least one recognizable word
|
| 77 |
+
return False, "Input appears incomplete. Please provide a meaningful question."
|
| 78 |
|
| 79 |
return True, "Valid input."
|
| 80 |
|