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

hotels_classifier.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 205548f87451c757e68c66f669f7353fc9c58a83 (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
#pragma once

#include <cstdint>
#include <vector>

namespace search
{
class Result;
class Results;

// A binary classifier that can be used in conjunction with search
// engine to decide whether the query is related to hotel search.
//
// Two ways we use to decide whether the user was searching for hotels:
// 1. We may infer it from the query text.
// 2. We may infer it from the query results: if the majority are hotels,
//    probably the query was too.
//
// *NOTE* This class is NOT thread safe.
class HotelsClassifier
{
public:
  void Add(Result const & result);

  // The types are parsed from the original query in search::Processor.
  void PrecheckHotelQuery(std::vector<uint32_t> const & types);

  void Clear();

  bool IsHotelResults() const;

private:
  uint64_t m_numHotels = 0;
  uint64_t m_numResults = 0;
  bool m_looksLikeHotelQuery = false;
};
}  // namespace search