forked from organicmaps/organicmaps-tmp
[search] Added common Spanish _prefix_ misprints.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
parent
51b20ea661
commit
bdde6e6d50
2 changed files with 32 additions and 1 deletions
|
@ -30,6 +30,9 @@ std::vector<UniString> const kAllowedMisprints = {
|
|||
MakeUniString("ао"),
|
||||
MakeUniString("еиэ"),
|
||||
MakeUniString("шщ"),
|
||||
// Spanish
|
||||
MakeUniString("jh"), // "Jose" <-> "Hose"
|
||||
MakeUniString("fh"), // "Hernández" <-> "Fernández"
|
||||
};
|
||||
|
||||
std::pair<UniString, UniString> const kPreprocessReplacements[] = {
|
||||
|
|
|
@ -559,7 +559,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo_PureCategory)
|
|||
}
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo_ErrorsMade)
|
||||
UNIT_CLASS_TEST(ProcessorTest, RankingInfo_ErrorsMade_1)
|
||||
{
|
||||
TestCity chekhov({0, 0}, "Чеховъ Антонъ Павловичъ", "ru", 100 /* rank */);
|
||||
|
||||
|
@ -605,6 +605,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo_ErrorsMade)
|
|||
|
||||
checkErrors("Cafe Yesenina", ErrorsMade(0));
|
||||
checkErrors("Cafe Jesenina", ErrorsMade(1));
|
||||
/// @see search_string_utils.cpp, kAllowedMisprints
|
||||
// We allow only Y->{E, J, I, U} misprints for the first letter.
|
||||
checkErrors("Cafe Esenina", ErrorsMade(2));
|
||||
|
||||
|
@ -634,6 +635,33 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo_ErrorsMade)
|
|||
checkErrors("лермонтов чеховъ антон павлович", ErrorsMade(2));
|
||||
}
|
||||
|
||||
// https://github.com/organicmaps/organicmaps/issues/5296
|
||||
UNIT_CLASS_TEST(ProcessorTest, RankingInfo_ErrorsMade_2)
|
||||
{
|
||||
TestStreet hernandes({{-0.5, -0.5}, {0, 0}, {0.5, 0.5}}, "José Hernández", "es");
|
||||
|
||||
auto wonderlandId = BuildCountry("Wonderland", [&](TestMwmBuilder & builder)
|
||||
{
|
||||
builder.Add(hernandes);
|
||||
});
|
||||
|
||||
SetViewport(m2::RectD(-1, -1, 1, 1));
|
||||
|
||||
auto checkErrors = [&](string const & query, ErrorsMade const & errorsMade)
|
||||
{
|
||||
auto request = MakeRequest(query, "es");
|
||||
auto const & results = request->Results();
|
||||
|
||||
Rules rules{ExactMatch(wonderlandId, hernandes)};
|
||||
TEST(ResultsMatch(results, rules), (query));
|
||||
TEST_EQUAL(results.size(), 1, (query));
|
||||
TEST_EQUAL(results[0].GetRankingInfo().m_errorsMade, errorsMade, (query));
|
||||
};
|
||||
|
||||
checkErrors("Hose", ErrorsMade(1));
|
||||
checkErrors("Fernández", ErrorsMade(1));
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(ProcessorTest, TestHouseNumbers)
|
||||
{
|
||||
TestCity greenCity({0, 0}, "Зеленоград", "ru", 100 /* rank */);
|
||||
|
|
Loading…
Add table
Reference in a new issue