EchoTruth / modules /utils.py
lightmate's picture
Upload 2 files
455555b verified
raw
history blame
281 Bytes
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))