ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Static Public Attributes | List of all members
meta::index::language_model_ranker Class Referenceabstract

Scores documents according to one of three different smoothed language model scoring methods described in "A Study of Smoothing Methods for Language Models Applied to Ad Hoc Information Retrieval" by Zhai and Lafferty, 2001. More...

#include <lm_ranker.h>

Inheritance diagram for meta::index::language_model_ranker:
meta::index::ranking_function meta::index::ranker meta::index::absolute_discount meta::index::dirichlet_prior meta::index::jelinek_mercer

Public Member Functions

float score_one (const score_data &sd) override
 
float initial_score (const score_data &sd) const override
 Computes the constant contribution to the score of a particular document. More...
 
virtual float smoothed_prob (const score_data &sd) const =0
 Calculates the smoothed probability of a term. More...
 
virtual float doc_constant (const score_data &sd) const =0
 A document-dependent constant. More...
 
virtual ~language_model_ranker ()=default
 Default destructor.
 
- Public Member Functions inherited from meta::index::ranking_function
virtual std::vector< search_resultrank (ranker_context &ctx, uint64_t num_results, const filter_function_type &filter) override final
 Scores a query using a document-at-a-time strategy. More...
 
- Public Member Functions inherited from meta::index::ranker
template<class ForwardIterator , class Function = bool (*)(doc_id)>
std::vector< search_resultscore (inverted_index &idx, ForwardIterator begin, ForwardIterator end, uint64_t num_results=10, Function &&filter=passthrough)
 
std::vector< search_resultscore (inverted_index &idx, const corpus::document &query, uint64_t num_results=10, const filter_function_type &filter=[](doc_id) { return true;})
 
virtual ~ranker ()=default
 Default destructor.
 
virtual void save (std::ostream &out) const =0
 Saves the ranker to a stream. More...
 

Static Public Attributes

static const util::string_view id = "language-model"
 The identifier for this ranker.
 

Additional Inherited Members

- Public Types inherited from meta::index::ranker
using filter_function_type = std::function< bool(doc_id did)>
 
- Static Public Member Functions inherited from meta::index::ranker
static bool passthrough (doc_id)
 

Detailed Description

Scores documents according to one of three different smoothed language model scoring methods described in "A Study of Smoothing Methods for Language Models Applied to Ad Hoc Information Retrieval" by Zhai and Lafferty, 2001.

Member Function Documentation

§ score_one()

float meta::index::language_model_ranker::score_one ( const score_data sd)
overridevirtual
Parameters
sd

Implements meta::index::ranking_function.

§ initial_score()

float meta::index::language_model_ranker::initial_score ( const score_data sd) const
overridevirtual

Computes the constant contribution to the score of a particular document.

Parameters
sdThe score_data for the query

Reimplemented from meta::index::ranking_function.

§ smoothed_prob()

virtual float meta::index::language_model_ranker::smoothed_prob ( const score_data sd) const
pure virtual

Calculates the smoothed probability of a term.

Parameters
sd

Implemented in meta::index::jelinek_mercer, meta::index::absolute_discount, and meta::index::dirichlet_prior.

§ doc_constant()

virtual float meta::index::language_model_ranker::doc_constant ( const score_data sd) const
pure virtual

A document-dependent constant.

Parameters
sd

Implemented in meta::index::jelinek_mercer, meta::index::absolute_discount, and meta::index::dirichlet_prior.


The documentation for this class was generated from the following files: