SearchConfig#
- class scikitplot.corpus.SearchConfig(top_k=10, match_mode='semantic', semantic_threshold=0.0, keyword_threshold=0.0, hybrid_alpha=0.5, rrf_k=60, use_normalized_text=True, case_sensitive=False, backend='auto', annoy_n_trees=10, annoy_metric='angular', annoy_search_k=-1, annoy_impl='auto', annoy_dtype=None, annoy_index_dtype=None)[source]#
Configuration for similarity search.
- Parameters:
- top_kint
Maximum results to return.
- match_modestr
One of
"strict","keyword","semantic","hybrid".- semantic_thresholdfloat
Minimum cosine similarity for SEMANTIC results.
- keyword_thresholdfloat
Minimum keyword overlap for KEYWORD results.
- hybrid_alphafloat
Weight for semantic scores in HYBRID mode (0 = pure keyword, 1 = pure semantic). Default 0.5 (equal weight).
- rrf_kint
Reciprocal rank fusion constant. Default 60 (standard).
- use_normalized_textbool
Use
normalized_textfor matching when available.- case_sensitivebool
Case-sensitive matching in STRICT mode.
- backendstr
Dense ANN backend selector for SEMANTIC/HYBRID modes. One of
"auto"(default; resolves to Annoy when available, else FAISS, Voyager, or exact brute-force),"annoy","faiss","voyager","bruteforce". An explicitly named backend that is not installed raises at build time rather than silently degrading.- annoy_n_treesint
Annoy tree count (accuracy/size trade-off) when the Annoy backend is used. Higher is more accurate and larger. Default 10.
- annoy_metricstr
Annoy distance metric. Default
"angular"(cosine-like); scores are always reported as cosine similarity regardless of metric.- annoy_search_kint
Annoy query-time node budget.
-1(default) lets Annoy choose.- annoy_implstr
Which Annoy index class to use:
"auto"(default; high-levelscikitplot.annoy.Indexfirst, else the Cythonscikitplot.annoy._annoy.Index),"highlevel", or"cython".- annoy_dtypestr or None
Embedding precision for the Cython Annoy class (e.g.
"float32","float64"). Ignored by the high-level class. DefaultNone.- annoy_index_dtypestr or None
Item-id integer width for the Cython Annoy class (e.g.
"int32","uint64") for very large corpora. Ignored otherwise. DefaultNone.
- Parameters:
top_k (int)
match_mode (str)
semantic_threshold (float)
keyword_threshold (float)
hybrid_alpha (float)
rrf_k (int)
use_normalized_text (bool)
case_sensitive (bool)
backend (str)
annoy_n_trees (int)
annoy_metric (str)
annoy_search_k (int)
annoy_impl (str)
annoy_dtype (str | None)
annoy_index_dtype (str | None)
Notes
User note: For RAG pipelines,
match_mode="hybrid"with default settings provides a good balance. For exact citation matching, usematch_mode="strict". To force a specific ANN library, set e.g.backend="annoy"and tuneannoy_n_trees.