import re def parse_symptoms(symptom_string): pattern = r"([^,]+?)\s*\(([\d\.]+)\)" matches = re.findall(pattern, symptom_string) return [(m[0].strip().lower(), float(m[1])) for m in matches]