[search] Increased penalty for error; increased city rank factor.

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako 2022-09-09 09:46:43 +03:00
parent 428a1ed653
commit 094140a356
2 changed files with 34 additions and 3 deletions

View file

@ -28,7 +28,7 @@ double constexpr kCategoriesRank = 1.0000000;
double constexpr kCategoriesFalseCats = -1.0000000;
double constexpr kDistanceToPivot = -0.2123693;
double constexpr kRank = 0.1065355;
double constexpr kRank = 0.15;
double constexpr kPopularity = 1.0000000;
// Decreased this value:
@ -36,7 +36,7 @@ double constexpr kPopularity = 1.0000000;
// - On the other hand, when search for "subway", do we usually prefer famous fast food or metro?
double constexpr kFalseCats = -0.01;
double constexpr kErrorsMade = -0.05;
double constexpr kErrorsMade = -0.15;
double constexpr kMatchedFraction = 0.1876736;
double constexpr kAllTokensUsed = 0.0478513;
double constexpr kExactCountryOrCapital = 0.1247733;
@ -60,7 +60,7 @@ double constexpr kType[] = {
0, // Suburb
-0.02, // Unclassified
0, // Village
0.0073583, // City
0.01, // City
0.0233254, // State
0.1679389, // Country
};

View file

@ -361,4 +361,35 @@ UNIT_CLASS_TEST(MwmTestsFixture, IceCream)
for (size_t i = 0; i < kResultsCount; ++i)
TEST(results[i].GetFeatureID() == results2[i].GetFeatureID(), (results[i], results2[i]));
}
UNIT_CLASS_TEST(MwmTestsFixture, Hilo_City)
{
// Istanbul, Kadikoy.
ms::LatLon const center(40.98647, 29.02552);
SetViewportAndLoadMaps(center);
// Lets start with trailing space here.
// Prefix search is more fuzzy and gives "Hill", "Holo", .. nearby variants.
auto request = MakeRequest("Hilo ");
auto const & results = request->Results();
size_t constexpr kResultsCount = 5; // Hilo city in Hawaii should be at the top.
TEST_GREATER(results.size(), kResultsCount, ());
auto const cityType = classif().GetTypeByPath({"place", "city"});
bool found = false;
for (size_t i = 0; i < kResultsCount; ++i)
{
auto const & r = results[i];
if (r.GetResultType() == search::Result::Type::Feature &&
r.GetString() == "Hilo" &&
EqualClassifType(r.GetFeatureType(), cityType))
{
found = true;
break;
}
}
TEST(found, (results));
}
} // namespace real_mwm_tests