Created
August 20, 2015 17:12
-
-
Save akdh/516c7a9612c9fcd7a7a3 to your computer and use it in GitHub Desktop.
Converts custom CSV to qrel format
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
import csv | |
import sys | |
VOTE_THRESHOLD = 2 | |
topics = {} | |
next_topic = 900 | |
for row in csv.reader(sys.stdin): | |
if row[1] == 'blah': | |
continue | |
if not row[2].endswith('_vote'): | |
continue | |
if row[1] not in topics: | |
topics[row[1]] = next_topic | |
next_topic += 1 | |
print("%d\t0\t%s\t%d" % (topics[row[1]], row[2].split('_')[0], int(int(row[3]) > VOTE_THRESHOLD))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment