Skip to content

Instantly share code, notes, and snippets.

@BernardoGO
Created October 1, 2016 19:41
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 BernardoGO/646509ef6041ad654f42cabddd4851b2 to your computer and use it in GitHub Desktop.
Save BernardoGO/646509ef6041ad654f42cabddd4851b2 to your computer and use it in GitHub Desktop.
Fix trec file for eval
fixed = ""
with open('trec10.res') as f:
previous = ""
for line in f:
print(line)
if line.split()[2] == previous:
continue
previous = line.split("\t")[2]
fixed += line
text_file = open("output.txt", "w")
text_file.write(fixed)
text_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment