Created
April 13, 2019 15:04
-
-
Save philshem/ec506012808e892d356ca2249e9ab712 to your computer and use it in GitHub Desktop.
cleans acronym list from https://github.com/krishnakt031990/Crawl-Wiki-For-Acronyms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding=utf-8 | |
ignore_list = ('Search-Navigation','Tools-What links','Top-','Contents','Magyar') | |
with open('AcronymsFile.csv','r') as inp: | |
data = inp.read().split('\n') | |
with open('clean_AcronymsFile.csv','w') as out: | |
out.write('acronym'+'\t'+'definition'+'\n') | |
for line in data: | |
if not line.startswith(ignore_list): | |
tmp = line.split('-') | |
acronym = tmp[0].strip() | |
definition = '-'.join([x.strip() for x in tmp[1:]]) | |
out.write(acronym+'\t'+definition+'\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment