ModErn Text Analysis
META Enumerates Textual Applications
okapi_bm25.h
Go to the documentation of this file.
1 
9 #ifndef META_OKAPI_BM25_H_
10 #define META_OKAPI_BM25_H_
11 
14 
15 namespace meta
16 {
17 namespace index
18 {
19 
37 {
38  public:
40  const static util::string_view id;
41 
43  const static constexpr float default_k1 = 1.2f;
44 
46  const static constexpr float default_b = 0.75f;
47 
49  const static constexpr float default_k3 = 500.0f;
50 
56  okapi_bm25(float k1 = default_k1, float b = default_b,
57  float k3 = default_k3);
58 
63  okapi_bm25(std::istream& in);
64 
68  float score_one(const score_data& sd) override;
69 
70  void save(std::ostream& out) const override;
71 
72  private:
74  const float k1_;
76  const float b_;
78  const float k3_;
79 };
80 
84 template <>
85 std::unique_ptr<ranker> make_ranker<okapi_bm25>(const cpptoml::table&);
86 }
87 }
88 #endif
void save(std::ostream &out) const override
Saves the ranker to a stream.
Definition: okapi_bm25.cpp:36
Definition: ranker.h:226
const float k3_
Query term smoothing.
Definition: okapi_bm25.h:78
static const constexpr float default_k3
Default k3, query term smoothing.
Definition: okapi_bm25.h:49
static const util::string_view id
The identifier for this ranker.
Definition: okapi_bm25.h:40
A non-owning reference to a string.
Definition: string_view.h:51
const float b_
Length normalization.
Definition: okapi_bm25.h:76
okapi_bm25(float k1=default_k1, float b=default_b, float k3=default_k3)
Definition: okapi_bm25.cpp:23
std::unique_ptr< ranker > make_ranker< okapi_bm25 >(const cpptoml::table &)
Specialization of the factory method used to create okapi_bm25 rankers.
Definition: okapi_bm25.cpp:64
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
The Okapi BM25 scoring function.
Definition: okapi_bm25.h:36
static const constexpr float default_b
Default b, length normalization.
Definition: okapi_bm25.h:46
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:40
float score_one(const score_data &sd) override
Definition: okapi_bm25.cpp:45
const float k1_
Doc term smoothing.
Definition: okapi_bm25.h:74
static const constexpr float default_k1
Default k1, doc term smoothing.
Definition: okapi_bm25.h:43