| |
- file_read_strings(path)
- Read a file into a list of strings. If the file cannot be
read, print an error message and return an empty list.
- file_write_strings(path, lst)
- Write a list of strings (or things that can be converted to
strings) to a file. If the file cannot be written, print an
error message.
path: A file path
lst: A list of strings or things that can be converted to strings.
- read_qrels(path)
- Read a file in .qrels format. Return it as a list [qid, eid, rel].
- read_queries(path)
- Read a file in .qry format. Return it as a dict of qid:query.
- read_rankings(path)
- Get a list of rankings for a set of queries. Each ranking is
a list of (score, externalId) tuples.
queries: A dict of {query_id:query_string}.
- str_to_num(obj)
- Convert strings that look like numbers to int or float. If applied
to a dict, conversion is done for values but not keys.
|