Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ranx/data_structures/qrels.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def __init__(self, qrels: Dict[str, Dict[str, int]] = None, name: str = None):
# Doc IDs
doc_ids = [list(doc.keys()) for doc in qrels.values()]
max_len = max(len(y) for x in doc_ids for y in x)
dtype = f"<U{max_len}"
width = 1 << (max_len - 1).bit_length() if max_len > 1 else 1
dtype = f"<U{width}"
doc_ids = TypedList([np.array(x, dtype=dtype) for x in doc_ids])

# Scores
Expand Down
3 changes: 2 additions & 1 deletion ranx/data_structures/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def __init__(self, run: Dict[str, Dict[str, float]] = None, name: str = None):
# Doc IDs
doc_ids = [list(doc.keys()) for doc in run.values()]
max_len = max(len(y) for x in doc_ids for y in x)
dtype = f"<U{max_len}"
width = 1 << (max_len - 1).bit_length() if max_len > 1 else 1
dtype = f"<U{width}"
doc_ids = TypedList([np.array(x, dtype=dtype) for x in doc_ids])

# Scores
Expand Down