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 
12 #include "index/ranker/ranker.h"
14 
15 namespace meta
16 {
17 namespace index
18 {
19 
23 class okapi_bm25 : public ranker
24 {
25  public:
27  const static std::string id;
28 
30  const static constexpr double default_k1 = 1.2;
31 
33  const static constexpr double default_b = 0.75;
34 
36  const static constexpr double default_k3 = 500.0;
37 
43  okapi_bm25(double k1 = default_k1, double b = default_b,
44  double k3 = default_k3);
45 
49  double score_one(const score_data& sd) override;
50 
51  private:
53  const double k1_;
55  const double b_;
57  const double k3_;
58 };
59 
63 template <>
64 std::unique_ptr<ranker> make_ranker<okapi_bm25>(const cpptoml::table&);
65 }
66 }
67 #endif
const double b_
Length normalization.
Definition: okapi_bm25.h:55
const double k3_
Query term smoothing.
Definition: okapi_bm25.h:57
A ranker scores a query against all the documents in an inverted index, returning a list of documents...
Definition: ranker.h:41
static const constexpr double default_k1
Default k1, doc term smoothing.
Definition: okapi_bm25.h:30
static const constexpr double default_b
Default b, length normalization.
Definition: okapi_bm25.h:33
okapi_bm25(double k1=default_k1, double b=default_b, double k3=default_k3)
Definition: okapi_bm25.cpp:18
static const constexpr double default_k3
Default k3, query term smoothing.
Definition: okapi_bm25.h:36
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:42
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
The Okapi BM25 scoring function.
Definition: okapi_bm25.h:23
static const std::string id
The identifier for this ranker.
Definition: okapi_bm25.h:27
A score_data object contains information needed to evaluate a ranking function.
Definition: score_data.h:39
const double k1_
Doc term smoothing.
Definition: okapi_bm25.h:53
double score_one(const score_data &sd) override
Definition: okapi_bm25.cpp:23