ModErn Text Analysis
META Enumerates Textual Applications
dirichlet_prior.h
Go to the documentation of this file.
1 
9 #ifndef META_DIRICHLET_PRIOR_H_
10 #define META_DIRICHLET_PRIOR_H_
11 
12 #include "index/ranker/lm_ranker.h"
14 
15 namespace meta
16 {
17 namespace index
18 {
19 
24 {
25  public:
27  const static std::string id;
28 
30  const static constexpr double default_mu = 2000;
31 
35  dirichlet_prior(double mu = default_mu);
36 
41  double smoothed_prob(const score_data& sd) const override;
42 
47  double doc_constant(const score_data& sd) const override;
48 
49  private:
51  const double mu_;
52 };
53 
58 template <>
59 std::unique_ptr<ranker> make_ranker<dirichlet_prior>(const cpptoml::table&);
60 }
61 }
62 #endif
dirichlet_prior(double mu=default_mu)
Definition: dirichlet_prior.cpp:17
double doc_constant(const score_data &sd) const override
A document-dependent constant.
Definition: dirichlet_prior.cpp:30
std::unique_ptr< ranker > make_ranker< dirichlet_prior >(const cpptoml::table &)
Specialization of the factory method used to create dirichlet_prior rankers.
Definition: dirichlet_prior.cpp:37
static const std::string id
Identifier for this ranker.
Definition: dirichlet_prior.h:27
static const constexpr double default_mu
Default value of mu.
Definition: dirichlet_prior.h:30
const double mu_
the Dirichlet prior parameter
Definition: dirichlet_prior.h:51
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 smoothed_prob(const score_data &sd) const override
Calculates the smoothed probability of a term.
Definition: dirichlet_prior.cpp:22
Implements Bayesian smoothing with a Dirichlet prior.
Definition: dirichlet_prior.h:23
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:39