I need to extract Gleason scores from a flat file of prostatectomy final diagnostic write-ups. These scores always have the word Gleason and two numbers that add up to anoth
gleason = re.compile("gleason\d+\d=\d")
scores = set()
for record in records:
for line in record.lower().split("\n"):
if "gleason" in line:
scores.add(gleason.match(line.replace(" ", "")).group(0)[7:])