Datasets:
Upload README.md with huggingface_hub
Browse files75 unmodified lines7677787980818210 unmodified lines9394959697989910010110210310475 unmodified lineslater). It downloads the qrels and queries from this dataset and the skills from SRA-Bench:```pythonimport json, re, tempfileimport pandas as pdimport pyterrier as ptfrom huggingface_hub import hf_hub_download10 unmodified linesqueries = queries.rename(columns={"query_id": "qid"})skills = json.load(open(download("WeihangSu/SRA-Bench", "corpus/corpus.json")))# BM25 as in the judgment pool: lowercased, punctuation removed, no stemming or stopwordsdef tokenize(text):return " ".join(re.sub(r"[^\w\s]", " ", text.lower()).split())index = pt.IterDictIndexer(tempfile.mkdtemp(), meta={"docno": 128}, tokeniser="WhitespaceTokeniser",stemmer=None, stopwords=None, properties={"max.term.length": "10000"}).index({"docno": s["skill_id"], "text": tokenize("\n".join(s[k] for k in ("name", "description", "content") if s.get(k)))}for s in skills)bm25 = pt.apply.query(lambda q: tokenize(q["query"])) >> pt.terrier.Retriever(75 unmodified lines7677787980818210 unmodified lines9394959697989910010110210310410575 unmodified lineslater). It downloads the qrels and queries from this dataset and the skills from SRA-Bench:```pythonimport json, reimport pandas as pdimport pyterrier as ptfrom huggingface_hub import hf_hub_download10 unmodified linesqueries = queries.rename(columns={"query_id": "qid"})skills = json.load(open(download("WeihangSu/SRA-Bench", "corpus/corpus.json")))# BM25 as in the judgment pool: lowercased, punctuation removed, no stemming or stopwords. Tokens over 100# characters (base64 strings and the like) are dropped, which keeps the index small.def tokenize(text):return " ".join(w for w in re.sub(r"[^\w\s]", " ", text.lower()).split() if len(w) <= 100)index = pt.IterDictIndexer("./skills_index", overwrite=True, meta={"docno": 128}, tokeniser="WhitespaceTokeniser",stemmer=None, stopwords=None, properties={"max.term.length": "150"}).index({"docno": s["skill_id"], "text": tokenize("\n".join(s[k] for k in ("name", "description", "content") if s.get(k)))}for s in skills)bm25 = pt.apply.query(lambda q: tokenize(q["query"])) >> pt.terrier.Retriever(
README.md+6-5