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 
14 
15 namespace meta
16 {
17 namespace index
18 {
19 
38 {
39  public:
41  const static util::string_view id;
42 
44  const static constexpr float default_lambda = 0.7f;
45 
49  jelinek_mercer(float lambda = default_lambda);
50 
55  jelinek_mercer(std::istream& in);
56 
57  void save(std::ostream& out) const override;
58 
63  float smoothed_prob(const score_data& sd) const override;
64 
69  float doc_constant(const score_data& sd) const override;
70 
71  private:
73  const float lambda_;
74 };
75 
80 template <>
81 std::unique_ptr<ranker> make_ranker<jelinek_mercer>(const cpptoml::table&);
82 }
83 }
84 
85 #endif
static const util::string_view id
The identifier for this ranker.
Definition: jelinek_mercer.h:41
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:51
float doc_constant(const score_data &sd) const override
A document-dependent constant.
Definition: jelinek_mercer.cpp:44
A non-owning reference to a string.
Definition: string_view.h:51
static const constexpr float default_lambda
Default value of lambda.
Definition: jelinek_mercer.h:44
const float lambda_
the JM parameter
Definition: jelinek_mercer.h:73
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retrieval, data mining, and other applications of text processing.
Definition: analyzer.h:25
Scores documents according to one of three different smoothed language model scoring methods describe...
Definition: lm_ranker.h:25
void save(std::ostream &out) const override
Saves the ranker to a stream.
Definition: jelinek_mercer.cpp:29
jelinek_mercer(float lambda=default_lambda)
Definition: jelinek_mercer.cpp:18
float smoothed_prob(const score_data &sd) const override
Calculates the smoothed probability of a term.
Definition: jelinek_mercer.cpp:36
Implements the Jelinek-Mercer smoothed ranking model.
Definition: jelinek_mercer.h:37
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:40