Mofe commited on
Commit
a855f45
1 Parent(s): 36c4567

Made changes

Browse files
Files changed (1) hide show
  1. ciral.py +2 -2
ciral.py CHANGED
@@ -56,7 +56,7 @@ def load_queries(_file):
56
  with open(_file, encoding="utf-8") as query_file:
57
  for line in query_file:
58
  line = line.strip()
59
- id, query = line.split('\t')
60
  queries[id] = query
61
  return queries
62
 
@@ -68,7 +68,7 @@ def load_qrels(_file):
68
  with open(_file, encoding="utf-8") as qrel_file:
69
  for line in qrel_file:
70
  line = line.strip()
71
- qid, _, docid, rel = line.split('\t')
72
  qrels[qid][docid] = int(rel)
73
  #print(qrels)
74
  return qrels
 
56
  with open(_file, encoding="utf-8") as query_file:
57
  for line in query_file:
58
  line = line.strip()
59
+ id, query = (line.split('\t')) if len(line.split('\t')) == 2 else ("", "")
60
  queries[id] = query
61
  return queries
62
 
 
68
  with open(_file, encoding="utf-8") as qrel_file:
69
  for line in qrel_file:
70
  line = line.strip()
71
+ qid, _, docid, rel = (line.split('\t')) if len(line.split('\t')) == 4 else ("", "", "",False)
72
  qrels[qid][docid] = int(rel)
73
  #print(qrels)
74
  return qrels