ModErn Text Analysis
META Enumerates Textual Applications
jelinek_mercer.h
Go to the documentation of this file.
1 
9 #ifndef META_JELINEK_MERCER_H_
10 #define META_JELINEK_MERCER_H_
11 
12 #include "index/ranker/lm_ranker.h"
14 
15 namespace meta
16 {
17 namespace index
18 {
19 
27 {
28  public:
30  const static std::string id;
31 
33  const static constexpr double default_lambda = 0.7;
34 
38  jelinek_mercer(double lambda = default_lambda);
39 
44  double smoothed_prob(const score_data& sd) const override;
45 
50  double doc_constant(const score_data& sd) const override;
51 
52  private:
54  const double lambda_;
55 };
56 
61 template <>
62 std::unique_ptr<ranker> make_ranker<jelinek_mercer>(const cpptoml::table&);
63 }
64 }
65 
66 #endif
std::unique_ptr< ranker > make_ranker< jelinek_mercer >(const cpptoml::table &)
Specialization of the factory method used to create jelinek_mercer rankers.
Definition: jelinek_mercer.cpp:37
double smoothed_prob(const score_data &sd) const override
Calculates the smoothed probability of a term.
Definition: jelinek_mercer.cpp:22
static const constexpr double default_lambda
Default value of lambda.
Definition: jelinek_mercer.h:33
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
Scores documents according to one of three different smoothed language model scoring methods describe...
Definition: lm_ranker.h:24
double doc_constant(const score_data &sd) const override
A document-dependent constant.
Definition: jelinek_mercer.cpp:30
Implements the Jelinek-Mercer smoothed ranking model.
Definition: jelinek_mercer.h:26
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:39
const double lambda_
the JM parameter
Definition: jelinek_mercer.h:54
static const std::string id
The identifier for this ranker.
Definition: jelinek_mercer.h:30
jelinek_mercer(double lambda=default_lambda)
Definition: jelinek_mercer.cpp:17