<commit_before>#pragma once

#include "indexer/feature_decl.hpp"

#include "coding/hex.hpp"

#include <chrono>
#include <cstdint>
#include <memory>
#include <sstream>
#include <string>
#include <string>
#include <vector>

#define DECLARE_VISITOR(...)          \
  template <typename Visitor>         \
  void Visit(Visitor & visitor)       \
  {                                   \
    __VA_ARGS__;                      \
  }                                   \
  template <typename Visitor>         \
  void Visit(Visitor & visitor) const \
  {                                   \
    __VA_ARGS__;                      \
  }

namespace ugc
{
using TranslationKey = std::string;
using Time = std::chrono::time_point<std::chrono::system_clock>;

enum class Sentiment
{
  Positive,
  Negative
};

inline std::string DebugPrint(Sentiment const & sentiment)
{
  switch (sentiment)
  {
  case Sentiment::Positive: return "Positive";
  case Sentiment::Negative: return "Negative";
  }
}

inline uint32_t ToDaysSinceEpoch(Time const & time)
{
  auto const hours = std::chrono::duration_cast<std::chrono::hours>(time.time_since_epoch());
  return static_cast<uint32_t>(hours.count()) / 24;
}

inline Time FromDaysSinceEpoch(uint32_t days)
{
  auto const hours = std::chrono::hours(days * 24);
  return Time(hours);
}

inline uint32_t DaysAgo(Time const & time)
{
  auto const now = std::chrono::system_clock::now();
  if (now < time)
    return 0;
  return std::chrono::duration_cast<std::chrono::hours>(now - time).count() / 24;
}

struct RatingRecord
{
  RatingRecord() = default;
  RatingRecord(TranslationKey const & key, float const value) : m_key(key), m_value(value) {}

  DECLARE_VISITOR(visitor(m_key, "key"), visitor.VisitRating(m_value, "value"))

  bool operator==(RatingRecord const & rhs) const
  {
    return m_key == rhs.m_key && m_value == rhs.m_value;
  }

  friend std::string DebugPrint(RatingRecord const & ratingRecord)
  {
    std::ostringstream os;
    os << "RatingRecord [ " << ratingRecord.m_key << " " << ratingRecord.m_value << " ]";
    return os.str();<commit_msg>[ugc] Warning fix.<commit_after>#pragma once

#include "indexer/feature_decl.hpp"

#include "coding/hex.hpp"

#include <chrono>
#include <cstdint>
#include <memory>
#include <sstream>
#include <string>
#include <string>
#include <vector>

#define DECLARE_VISITOR(...)          \
  template <typename Visitor>         \
  void Visit(Visitor & visitor)       \
  {                                   \
    __VA_ARGS__;                      \
  }                                   \
  template <typename Visitor>         \
  void Visit(Visitor & visitor) const \
  {                                   \
    __VA_ARGS__;                      \
  }

namespace ugc
{
using TranslationKey = std::string;
using Time = std::chrono::time_point<std::chrono::system_clock>;

enum class Sentiment
{
  Positive,
  Negative
};

inline std::string DebugPrint(Sentiment const & sentiment)
{
  switch (sentiment)
  {
  case Sentiment::Positive: return "Positive";
  case Sentiment::Negative: return "Negative";
  }
}

inline uint32_t ToDaysSinceEpoch(Time const & time)
{
  auto const hours = std::chrono::duration_cast<std::chrono::hours>(time.time_since_epoch());
  return static_cast<uint32_t>(hours.count()) / 24;
}

inline Time FromDaysSinceEpoch(uint32_t days)
{
  auto const hours = std::chrono::hours(days * 24);
  return Time(hours);
}

inline uint32_t DaysAgo(Time const & time)
{
  auto const now = std::chrono::system_clock::now();
  if (now < time)
    return 0;
  auto const h = std::chrono::duration_cast<std::chrono::hours>(now - time).count() / 24;
  return static_cast<uint32_t>(h);
}

struct RatingRecord
{
  RatingRecord() = default;
  RatingRecord(TranslationKey const & key, float const value) : m_key(key), m_value(value) {}

  DECLARE_VISITOR(visitor(m_key, "key"), visitor.VisitRating(m_value, "value"))

  bool operator==(RatingRecord const & rhs) const
  {
    return m_key == rhs.m_key && m_value == rhs.m_value;
  }

  friend std::string DebugPrint(RatingRecord const & ratingRecord)
  {
    std::ostringstream os;
    os << "RatingRecord [ " << ratingRecord.m_key << " " << ratingRecord.m_value << " ]";
    return os.str();
{'fraction_non_alphanumeric': 0.13287541449549975, 'fraction_numerical': 0.007579346281383231, 'mean_word_length': 3.0488974113135185, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4174577', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1355, 'n_words': 295}