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

hotels_classifier.cpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4a21d3cb677f5997c32452468ddeda3e0b386dec (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
#include "search/hotels_classifier.hpp"

#include "search/result.hpp"

namespace search
{
void HotelsClassifier::AddBatch(Results const & results)
{
  if (results.IsEndMarker())
    return;

  for (auto const & result : results)
  {
    ++m_numResults;
    if (result.m_metadata.m_isHotel)
      ++m_numHotels;
  }
}

bool HotelsClassifier::IsHotelQuery() const
{
  // Threshold used to activate hotels mode. Probably is too strict,
  // but we don't have statistics now.
  double const kThreshold = 0.95;

  return m_numResults == 0 ? false : m_numHotels >= kThreshold * m_numResults;
}
}  // namespace search