TermCoverageGrader#
- class scikitplot.corpus.TermCoverageGrader(top_k=3, accept=0.8, reject=0.3)[source]#
Grade hits by the share of the query’s words their text contains.
coverage = |query words found in the top hits| / |query words|, with words\w+lower-cased and counted once. Coverage at or aboveacceptiscorrect; at or belowrejectisincorrect; between isambiguous. No hits, or a query without a word, isincorrectwith score 0.- Parameters:
- top_kint, default=3
Hits whose text is read.
- acceptfloat, default=0.8
Coverage from which the evidence is
correct.- rejectfloat, default=0.3
Coverage up to which it is
incorrect; belowaccept.
- Raises:
- TypeError, ValueError
If
top_kis not a positive int or the thresholds are not0 <= reject < accept <= 1.
- Parameters:
Examples
>>> from types import SimpleNamespace as NS >>> from scikitplot.corpus import TermCoverageGrader >>> hit = NS(doc=NS(text="chunk spans are slices of the source")) >>> TermCoverageGrader()("chunk spans", [hit]).grade.value 'correct' >>> TermCoverageGrader()("chunk embeddings cache", [hit]).grade.value 'ambiguous'