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

The pivoted document length normalization ranking function. More...

#include <pivoted_length.h>

Inheritance diagram for meta::index::pivoted_length:
meta::index::ranking_function meta::index::ranker

Public Member Functions

 pivoted_length (float s=default_s)
 
 pivoted_length (std::istream &in)
 Loads a pivoted_length ranker from a stream. More...
 
float score_one (const score_data &sd) override
 
void save (std::ostream &out) const override
 Saves the ranker to a stream. More...
 
- Public Member Functions inherited from meta::index::ranking_function
virtual float initial_score (const score_data &sd) const
 Computes the constant contribution to the score of a particular document. More...
 
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.
 

Static Public Attributes

static const util::string_view id = "pivoted-length"
 Identifier for this ranker.
 
static const constexpr float default_s = 0.2f
 Default value of s parameter.
 

Private Attributes

const float s_
 s parameter for pivoted_length normalization
 

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

The pivoted document length normalization ranking function.

See also
Amit Singal, Chris Buckley, and Mandar Mitra. Pivoted document length normalization. SIGIR '96, pages 21-29.

Required config parameters:

[ranker]
method = "pivoted-length"

Optional config parameters:

s = 0.2

Constructor & Destructor Documentation

§ pivoted_length() [1/2]

meta::index::pivoted_length::pivoted_length ( float  s = default_s)
Parameters
s

§ pivoted_length() [2/2]

meta::index::pivoted_length::pivoted_length ( std::istream &  in)

Loads a pivoted_length ranker from a stream.

Parameters
inThe stream to read from

Member Function Documentation

§ score_one()

float meta::index::pivoted_length::score_one ( const score_data sd)
overridevirtual
Parameters
sdthe score_data for this query

Implements meta::index::ranking_function.

§ save()

void meta::index::pivoted_length::save ( std::ostream &  out) const
overridevirtual

Saves the ranker to a stream.

This should save the ranker's id, followed by any parameters needed for reconstruction.

Implements meta::index::ranker.


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