LevenshteinRanker#
- class scikitplot.corpus.LevenshteinRanker(*, backend='auto', strict=False, use_normalized_text=True, score_cutoff=0.0)[source]#
Ranker by normalised Levenshtein similarity, with backend provenance.
- Parameters:
- backendstr, default=”auto”
Backend of
scikitplot.levenshtein.rank.- strictbool, default=False
Raise instead of falling back when
backendis unavailable.- use_normalized_textbool, default=True
Compare with
normalized_textwhen a document has one.- score_cutofffloat, default=0.0
Minimum similarity in [0, 1].
- Parameters:
Notes
Build it with
make_levenshtein_ranker. Each hit recordsbackend="levenshtein:<name>", the backend that computed its distance, which can differ from the requested one after a runtime fallback.- __call__(query, documents, config)[source]#
Return the best
config.top_kdocuments forquery.- Parameters:
- querystr
Query text.
- documentssequence of CorpusDocument
Candidates.
- configRetrievalConfig
Supplies
top_k.
- Returns:
- list of RetrievalHit
Ordered as
scikitplot.levenshtein.rankorders them: similarity, then distance, then position.
- Parameters:
- Return type: