| import re | |
| def clean_text(text): | |
| """Removes unnecessary spaces, special characters, and formats text properly.""" | |
| return re.sub(r'\s+', ' ', text).strip() | |
| def normalize_score(score): | |
| """Ensures the score is within the range 0 to 1.""" | |
| return max(0, min(score, 1)) | |