diff options
Diffstat (limited to 'run.py')
-rwxr-xr-x | run.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -22,7 +22,10 @@ def match(value, terms): return False def run(queries, line): - query, _, dbpediaid, _, relevance, method = line.split('\t') + try: + query, _, dbpediaid, _, relevance, method = line.split('\t') + except ValueError: # For qrels.txt + query, _, dbpediaid, relevance = line.split('\t') terms = queries[query].split() try: result = get(dbpediaid) @@ -33,8 +36,8 @@ def run(queries, line): for value in values: if match(value, terms): matches += 1 - print('{}\t{}\t{}\t{}\t{}\t{}\n'.format( - query, dbpediaid, relevance, field, len(values), matches)) + print('{}\t{}\t{}\t{}\t{}\t{}'.format( + query, dbpediaid, float(relevance), field, len(values), matches)) except Exception as e: print(dbpediaid) print(e) |