Skip to content

Instantly share code, notes, and snippets.

@kmonsoor
Created April 15, 2016 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmonsoor/3bc1afc36f5110c696d56e587dd07997 to your computer and use it in GitHub Desktop.
Save kmonsoor/3bc1afc36f5110c696d56e587dd07997 to your computer and use it in GitHub Desktop.
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