Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
extracting organization names from medical acronyms
reader = csv.DictReader(open('c:\Book1.csv'))
of = open('out.tsv')
writer = csv.writer(of)
orgs = ['center of', 'center for', 'commitee for',
'commitee of', 'organization', 'ministry of', 'ministry for',
'department', ]
for row in reader:
if any(x in row['Definition'].lower() for x in orgs):
# print {row['Acronym']: {'full-form': row['Definition'], 'comment': row['Comments']}}
writer.writerow(row['Acronym'], '\t', row['Definition'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment