ModErn Text Analysis
META Enumerates Textual Applications
absolute_discount.h
Go to the documentation of this file.
1 
10 #ifndef META_ABSOLUTE_DISCOUNT_H_
11 #define META_ABSOLUTE_DISCOUNT_H_
12 
15 
16 namespace meta
17 {
18 namespace index
19 {
20 
36 {
37  public:
39  const static util::string_view id;
40 
42  const static constexpr float default_delta = 0.7f;
43 
47  absolute_discount(float delta = default_delta);
48 
53  absolute_discount(std::istream& in);
54 
55  void save(std::ostream& out) const override;
56 
61  float smoothed_prob(const score_data& sd) const override;
62 
67  float doc_constant(const score_data& sd) const override;
68 
69  private:
71  const float delta_;
72 };
73 
78 template <>
79 std::unique_ptr<ranker> make_ranker<absolute_discount>(const cpptoml::table&);
80 }
81 }
82 #endif
static const util::string_view id
The identifier of this ranker.
Definition: absolute_discount.h:39
std::unique_ptr< ranker > make_ranker< absolute_discount >(const cpptoml::table &)
Specialization of the factory method used to create absolute_discount rankers.
Definition: absolute_discount.cpp:53
const float delta_
the absolute discounting parameter
Definition: absolute_discount.h:71
float smoothed_prob(const score_data &sd) const override
Calculates the smoothed probability of a term.
Definition: absolute_discount.cpp:37
A non-owning reference to a string.
Definition: string_view.h:51
void save(std::ostream &out) const override
Saves the ranker to a stream.
Definition: absolute_discount.cpp:30
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
float doc_constant(const score_data &sd) const override
A document-dependent constant.
Definition: absolute_discount.cpp:45
absolute_discount(float delta=default_delta)
Definition: absolute_discount.cpp:19
static const constexpr float default_delta
Default value of delta.
Definition: absolute_discount.h:42
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:40
Implements the absolute discounting smoothing method.
Definition: absolute_discount.h:35