<commit_before>#include "feature_data.hpp"
#include "feature_impl.hpp"
#include "classificator.hpp"
#include "feature.hpp"

#include "../base/stl_add.hpp"

#include "../std/bind.hpp"


using namespace feature;

////////////////////////////////////////////////////////////////////////////////////
// TypesHolder implementation
////////////////////////////////////////////////////////////////////////////////////

TypesHolder::TypesHolder(FeatureBase const & f)
: m_size(0), m_geoType(f.GetFeatureType())
{
  f.ForEachTypeRef(*this);
}

string TypesHolder::DebugPrint() const
{
  Classificator const & c = classif();

  string s;
  for (size_t i = 0; i < Size(); ++i)
    s += c.GetFullObjectName(m_types[i]) + "  ";
  return s;
}

void TypesHolder::Remove(uint32_t t)
{
  (void) RemoveIf(EqualFunctor<uint32_t>(t));
}

namespace
{

class UselessTypesChecker
{
  vector<uint32_t> m_types;
public:
  UselessTypesChecker()
  {
    Classificator const & c = classif();

    char const * arr1[][1] = { { "building" }, { "oneway" }, { "lit" } };

    for (size_t i = 0; i < ARRAY_SIZE(arr1); ++i)
      m_types.push_back(c.GetTypeByPath(vector<string>(arr1[i], arr1[i] + 1)));
  }
  bool operator() (uint32_t t) const
  {
    return (find(m_types.begin(), m_types.end(), t) != m_types.end());
  }
};

}
<commit_msg>[categories] “WiFi” category should be the last option when showing feature type.<commit_after>#include "feature_data.hpp"
#include "feature_impl.hpp"
#include "classificator.hpp"
#include "feature.hpp"

#include "../base/stl_add.hpp"

#include "../std/bind.hpp"


using namespace feature;

////////////////////////////////////////////////////////////////////////////////////
// TypesHolder implementation
////////////////////////////////////////////////////////////////////////////////////

TypesHolder::TypesHolder(FeatureBase const & f)
: m_size(0), m_geoType(f.GetFeatureType())
{
  f.ForEachTypeRef(*this);
}

string TypesHolder::DebugPrint() const
{
  Classificator const & c = classif();

  string s;
  for (size_t i = 0; i < Size(); ++i)
    s += c.GetFullObjectName(m_types[i]) + "  ";
  return s;
}

void TypesHolder::Remove(uint32_t t)
{
  (void) RemoveIf(EqualFunctor<uint32_t>(t));
}

namespace
{

class UselessTypesChecker
{
  vector<uint32_t> m_types;

  template <size_t N, size_t M>
  void AddTypes(char const * (&arr)[N][M])
  {
    Classificator const & c = classif();

    for (size_t i = 0; i < N; ++i)
      m_types.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + M)));
  }

public:
  UselessTypesChecker()
  {
    char const * arr1[][1] = {
      { "building" },
      { "oneway" },
      { "lit" },
      { "internet_access" },
    };
    char const * arr2[][2] = {
      { "internet_access", "wlan"},
    };

    AddTypes(arr1);
    AddTypes(arr2);
  }

  bool operator() (uint32_t t) const
  {
    return (find(m_types.begin(), m_types.end(), t) != m_types.end());
  }
};

}

{'fraction_non_alphanumeric': 0.2682425488180884, 'fraction_numerical': 0.011647824597464886, 'mean_word_length': 2.337142857142857, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1325462', 'n_tokens_mistral': 1019, 'n_tokens_neox': 998, 'n_words': 198}