CorpusIndexRetriever#
- class scikitplot.mcp.CorpusIndexRetriever(embedder, index, *, match_mode='hybrid', strict=False)[source]#
Text-level retriever over a corpus
RetrievalIndex: hybrid by default.- Parameters:
- embedderEmbedder or None
Embeds the query for the dense leg — the same model that embedded the corpus.
Noneonly withmatch_mode='keyword'.- indexRetrievalIndex
A built corpus index. Its own configuration (fusion constant, weights, backend) is kept; only
match_modeandtop_kare set per query.- match_mode{‘hybrid’, ‘keyword’, ‘semantic’}, optional
Which evidence paths the corpus runs. Default
'hybrid': BM25 and dense, fused by rank inside the corpus.- strictbool, optional
Re-raise failures instead of reporting them as a failed leg.
- Raises:
- ValueError
If
match_modeis not one of the offered modes, or no embedder is given for a mode that needs one.
- Parameters:
Notes
User. Dense search blurs identifiers and error strings; keyword search misses paraphrase. Hybrid runs both and fuses them by rank, which is why a query such as
roc_auc_scoreand one such as “area under the ROC curve” both find the right page.Developer. The server’s Corpus+Annoy backend built an index that already holds a BM25 leg (
RetrievalIndex.buildalways constructs it) and then used only the vector seam, so the MCP surface could never serve hybrid retrieval although every piece existed (finding CX-04). Fusion is not re-implemented here: corpus owns retrieval semantics, and its per-leg account is carried intoRetrievalOutcome, so a hybrid query whose dense leg could not run is reporteddegradedrather than passed off as a complete result.