File size: 205 Bytes
16d3318
 
 
 
 
 
1
2
3
4
5
6
7
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]