From efee29816222048bab260f96ac748c728b4d8e5b Mon Sep 17 00:00:00 2001 From: vng Date: Mon, 16 Mar 2015 19:22:38 +0300 Subject: [PATCH] =?UTF-8?q?[classificator]=20Treat=20amenity-atm=20as=20?= =?UTF-8?q?=E2=80=9Csecondary=E2=80=9D=20type.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- indexer/feature_data.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index e29b144b30..fa37b9bcba 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -44,6 +44,7 @@ namespace class UselessTypesChecker { vector m_types; + size_t m_count1; template void AddTypes(char const * (&arr)[N][M]) @@ -57,6 +58,10 @@ class UselessTypesChecker public: UselessTypesChecker() { + // Fill types that will be taken into account last, + // when we have many types for POI. + + // 1-arity char const * arr1[][1] = { { "building" }, { "hwtag" }, @@ -64,12 +69,31 @@ public: }; AddTypes(arr1); + m_count1 = m_types.size(); + + // 2-arity + char const * arr2[][2] = { + { "amenity", "atm" } + }; + + AddTypes(arr2); } bool operator() (uint32_t t) const { + auto const end1 = m_types.begin() + m_count1; + + // check 2-arity types + ftype::TruncValue(t, 2); + if (find(end1, m_types.end(), t) != m_types.end()) + return true; + + // check 1-arity types ftype::TruncValue(t, 1); - return (find(m_types.begin(), m_types.end(), t) != m_types.end()); + if (find(m_types.begin(), end1, t) != end1) + return true; + + return false; } }; @@ -80,7 +104,7 @@ void TypesHolder::SortBySpec() if (m_size < 2) return; - // do very simple thing - put "very common" types to the end + // Put "very common" types to the end of possible PP-description types. static UselessTypesChecker checker; (void) RemoveIfKeepValid(m_types, m_types + m_size, bind(cref(checker), _1)); }