Skip to content

Instantly share code, notes, and snippets.

@saurabhvyas
Created December 1, 2017 10:31
Show Gist options
  • Save saurabhvyas/bd7dcb4157f1984145c9789d621862bc to your computer and use it in GitHub Desktop.
Save saurabhvyas/bd7dcb4157f1984145c9789d621862bc to your computer and use it in GitHub Desktop.
wiki_resume
in_file = "/media/saurabh/New Volume/Untitled Folder/final.txt"
out_file = "/media/saurabh/New Volume/Untitled Folder/final_out.txt"
replacement = dict([(cp, cp.replace(' ', '_')) for cp in concepts])
with open(in_file) as infile, open(out_file, 'a') as file:
for index,line in enumerate(infile):
for concept_phrase in concepts:
line = line.replace(concept_phrase, replacement[concept_phrase])
file.write(line + '\n' )
if ( index%10000 == 0):
print (index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment