Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ranking_info.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2668ea0f45d441461362d9122cc90d554eee3d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once

#include "search/model.hpp"
#include "search/pre_ranking_info.hpp"
#include "search/ranking_utils.hpp"

#include <cstddef>
#include <cstdint>
#include <ostream>
#include <string>
#include <utility>

class FeatureType;

namespace search
{
struct RankingInfo
{
  static double const kMaxDistMeters;

  static void PrintCSVHeader(std::ostream & os);

  void ToCSV(std::ostream & os) const;

  // Returns rank calculated by a linear model. Large values
  // correspond to important features.
  double GetLinearModelRank() const;

  size_t GetErrorsMade() const;

  // Distance from the feature to the pivot point.
  double m_distanceToPivot = kMaxDistMeters;

  // Rank of the feature.
  uint8_t m_rank = 0;

  // Popularity rank of the feature.
  uint8_t m_popularity = 0;

  // Confidence and UGC rating.
  std::pair<uint8_t, float> m_rating = {0, 0.0f};

  // Score for the feature's name.
  NameScore m_nameScore = NAME_SCORE_ZERO;

  // Number of typos.
  ErrorsMade m_errorsMade;

  // True iff all tokens that are not stop-words
  // were used when retrieving the feature.
  bool m_allTokensUsed = true;

  // Search type for the feature.
  Model::Type m_type = Model::TYPE_COUNT;

  // True if all of the tokens that the feature was matched by
  // correspond to this feature's categories.
  bool m_pureCats = false;

  // True if none of the tokens that the feature was matched by
  // corresponds to this feature's categories although all of the
  // tokens are categorial ones.
  bool m_falseCats = false;

  // True iff the request is categorial.
  bool m_categorialRequest = false;

  // True iff the feature has a name.
  bool m_hasName = false;
};

std::string DebugPrint(RankingInfo const & info);
}  // namespace search