From 2007ef6b747d810166ec1c02a2b6c0177956ac6c Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Fri, 8 Dec 2017 14:00:49 +0300 Subject: [PATCH] [search] Commented out the relaxed parsing for streets. --- search/geocoder.cpp | 6 +- .../processor_test.cpp | 188 +++++++++--------- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/search/geocoder.cpp b/search/geocoder.cpp index 01cb38cb4e..a4656e9060 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -1041,12 +1041,12 @@ void Geocoder::CreateStreetsLayerAndMatchLowerLayers(BaseContext & ctx, layer.m_sortedFeatures = &sortedFeatures; ScopedMarkTokens mark(ctx.m_tokens, BaseContext::TOKEN_TYPE_STREET, prediction.m_tokenRange); - size_t const numEmitted = ctx.m_numEmitted; +// size_t const numEmitted = ctx.m_numEmitted; MatchPOIsAndBuildings(ctx, 0 /* curToken */); // A relaxed best effort parse: at least show the street if we can find one. - if (numEmitted == ctx.m_numEmitted) - FindPaths(ctx); +// if (numEmitted == ctx.m_numEmitted) +// FindPaths(ctx); } void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken) diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index f892b5ac42..ba5d71cd51 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -194,15 +194,15 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) { TRules rules = {ExactMatch(wonderlandId, feynmanHouse), ExactMatch(wonderlandId, lantern1), ExactMatch(wonderlandId, firstAprilStreet)}; - TEST(ResultsMatch("feynman street 1", rules), ()); +// TEST(ResultsMatch("feynman street 1", rules), ()); } { TRules rules = {ExactMatch(wonderlandId, bohrHouse), ExactMatch(wonderlandId, hilbertHouse), ExactMatch(wonderlandId, lantern1), ExactMatch(wonderlandId, firstAprilStreet)}; - TEST(ResultsMatch("bohr street 1", rules), ()); +// TEST(ResultsMatch("bohr street 1", rules), ()); } { - TEST(ResultsMatch("bohr street 1 unit 3", {ExactMatch(wonderlandId, bohrStreet1)}), ()); +// TEST(ResultsMatch("bohr street 1 unit 3", {ExactMatch(wonderlandId, bohrStreet1)}), ()); } { TRules rules = {ExactMatch(wonderlandId, lantern1), ExactMatch(wonderlandId, lantern2)}; @@ -211,7 +211,7 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) { TRules rules = {ExactMatch(wonderlandId, feynmanHouse), ExactMatch(wonderlandId, feynmanStreet)}; - TEST(ResultsMatch("wonderland los alamos feynman 1 unit 1 ", rules), ()); +// TEST(ResultsMatch("wonderland los alamos feynman 1 unit 1 ", rules), ()); } { // It's possible to find Descartes house by name. @@ -228,12 +228,12 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) { TRules rules = {ExactMatch(wonderlandId, bornHouse), ExactMatch(wonderlandId, firstAprilStreet)}; - TEST(ResultsMatch("long pond 1st april street 8 ", rules), ()); +// TEST(ResultsMatch("long pond 1st april street 8 ", rules), ()); } { TRules rules = {ExactMatch(wonderlandId, terranceHouse), ExactMatch(wonderlandId, stradaDrive)}; - TEST(ResultsMatch("Toronto strada drive 155", rules), ()); +// TEST(ResultsMatch("Toronto strada drive 155", rules), ()); } } @@ -487,27 +487,27 @@ UNIT_CLASS_TEST(ProcessorTest, TestHouseNumbers) { TRules rules{ExactMatch(countryId, building0), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград генералова к100 ", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград генералова к100 ", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building1), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград генералова к200 ", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград генералова к200 ", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building1), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград к200 генералова ", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград к200 генералова ", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building2), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград 300 строение 400 генералова ", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград 300 строение 400 генералова ", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград генералова строе 300", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград генералова строе 300", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building2), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Зеленоград генералова 300 строе", "ru", rules), ()); +// TEST(ResultsMatch("Зеленоград генералова 300 строе", "ru", rules), ()); } } @@ -586,11 +586,11 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes) { TRules rules{ExactMatch(countryId, building28), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Долгопрудный первомайская 28а ", "ru", rules), ()); +// TEST(ResultsMatch("Долгопрудный первомайская 28а ", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building28), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Долгопрудный первомайская 28а, 141701", "ru", rules), ()); +// TEST(ResultsMatch("Долгопрудный первомайская 28а, 141701", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building28), ExactMatch(countryId, building29), @@ -599,7 +599,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes) } { TRules rules{ExactMatch(countryId, building31), ExactMatch(countryId, street)}; - TEST(ResultsMatch("Долгопрудный первомайская 141702", "ru", rules), ()); +// TEST(ResultsMatch("Долгопрудный первомайская 141702", "ru", rules), ()); } { TRules rules{ExactMatch(countryId, building28), ExactMatch(countryId, building29), @@ -935,16 +935,16 @@ UNIT_CLASS_TEST(ProcessorTest, FuzzyMatch) TRules rulesWithoutStreet = {ExactMatch(id, bar)}; TRules rules = {ExactMatch(id, bar), ExactMatch(id, street)}; TEST(ResultsMatch("москва черчилль", "ru", rulesWithoutStreet), ()); - TEST(ResultsMatch("москва ленинградский черчилль", "ru", rules), ()); - TEST(ResultsMatch("москва ленинградский паб черчилль", "ru", rules), ()); +// TEST(ResultsMatch("москва ленинградский черчилль", "ru", rules), ()); +// TEST(ResultsMatch("москва ленинградский паб черчилль", "ru", rules), ()); - TEST(ResultsMatch("масква лининградский черчиль", "ru", rules), ()); - TEST(ResultsMatch("масква ленинргадский черчиль", "ru", rules), ()); +// TEST(ResultsMatch("масква лининградский черчиль", "ru", rules), ()); +// TEST(ResultsMatch("масква ленинргадский черчиль", "ru", rules), ()); // Too many errors, can't do anything. TEST(ResultsMatch("масква лениноргадсский чирчиль", "ru", TRules{}), ()); - TEST(ResultsMatch("моксва ленинргадский черчиль", "ru", rules), ()); +// TEST(ResultsMatch("моксва ленинргадский черчиль", "ru", rules), ()); TEST(ResultsMatch("food", "ru", rulesWithoutStreet), ()); TEST(ResultsMatch("foood", "ru", rulesWithoutStreet), ()); @@ -1025,7 +1025,7 @@ UNIT_CLASS_TEST(ProcessorTest, StopWords) { TEST(ResultsMatch("la motviderie ", "fr", TRules{}), ()); - TEST(ResultsMatch("la la le la la la ", "fr", {ExactMatch(id, street)}), ()); +// TEST(ResultsMatch("la la le la la la ", "fr", {ExactMatch(id, street)}), ()); TEST(ResultsMatch("la la le la la la", "fr", TRules{}), ()); } } @@ -1086,7 +1086,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestWeirdTypes) TEST(ResultsMatch("東京 除細動器 ", "ja", onlyFirst), ()); // City + street + category. - TEST(ResultsMatch("東京 竹下通り 除細動器 ", "ja", firstWithStreet), ()); +// TEST(ResultsMatch("東京 竹下通り 除細動器 ", "ja", firstWithStreet), ()); } { @@ -1216,93 +1216,93 @@ UNIT_CLASS_TEST(ProcessorTest, CityBoundarySmoke) } } -// Tests for the non-strict aspects of retrieval. -// Currently, the only possible non-strictness is that -// some tokens in the query may be ignored, -// which results in a pruned parse tree for the query. -UNIT_CLASS_TEST(ProcessorTest, RelaxedRetrieval) -{ - string const countryName = "Wonderland"; - TestCountry country(m2::PointD(10.0, 10.0), countryName, "en"); +/// / Tests for the non-strict aspects of retrieval. +// // Currently, the only possible non-strictness is that +// // some tokens in the query may be ignored, +// // which results in a pruned parse tree for the query. +// UNIT_CLASS_TEST(ProcessorTest, RelaxedRetrieval) +// { +// string const countryName = "Wonderland"; +// TestCountry country(m2::PointD(10.0, 10.0), countryName, "en"); - TestCity city({{-10.0, -10.0}, {10.0, -10.0}, {10.0, 10.0}, {-10.0, 10.0}} /* boundary */, - "Sick City", "en", 255 /* rank */); +// TestCity city({{-10.0, -10.0}, {10.0, -10.0}, {10.0, 10.0}, {-10.0, 10.0}} /* boundary */, +// "Sick City", "en", 255 /* rank */); - TestStreet street(vector{m2::PointD(-1.0, 0.0), m2::PointD(1.0, 0.0)}, "Queer Street", - "en"); - TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street, "en"); - TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street, "en"); - TestBuilding building2(m2::PointD(2.0, 0.0), "named building", "" /* house number */, "en"); - TestBuilding building3(m2::PointD(3.0, 0.0), "named building", "", "en"); +// TestStreet street(vector{m2::PointD(-1.0, 0.0), m2::PointD(1.0, 0.0)}, "Queer Street", +// "en"); +// TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street, "en"); +// TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street, "en"); +// TestBuilding building2(m2::PointD(2.0, 0.0), "named building", "" /* house number */, "en"); +// TestBuilding building3(m2::PointD(3.0, 0.0), "named building", "", "en"); - TestPOI poi0(m2::PointD(-1.0, 0.0), "Farmacia de guardia", "en"); - poi0.SetTypes({{"amenity", "pharmacy"}}); +// TestPOI poi0(m2::PointD(-1.0, 0.0), "Farmacia de guardia", "en"); +// poi0.SetTypes({{"amenity", "pharmacy"}}); - // A poi inside building2. - TestPOI poi2(m2::PointD(2.0, 0.0), "Post box", "en"); - poi2.SetTypes({{"amenity", "post_box"}}); +// // A poi inside building2. +// TestPOI poi2(m2::PointD(2.0, 0.0), "Post box", "en"); +// poi2.SetTypes({{"amenity", "post_box"}}); - auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { - builder.Add(street); - builder.Add(building0); - builder.Add(building1); - builder.Add(poi0); - }); - RegisterCountry(countryName, m2::RectD(m2::PointD(-10.0, -10.0), m2::PointD(10.0, 10.0))); +// auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { +// builder.Add(street); +// builder.Add(building0); +// builder.Add(building1); +// builder.Add(poi0); +// }); +// RegisterCountry(countryName, m2::RectD(m2::PointD(-10.0, -10.0), m2::PointD(10.0, 10.0))); - auto worldId = BuildWorld([&](TestMwmBuilder & builder) { - builder.Add(country); - builder.Add(city); - }); +// auto worldId = BuildWorld([&](TestMwmBuilder & builder) { +// builder.Add(country); +// builder.Add(city); +// }); - { - TRules rulesStrict = {ExactMatch(countryId, building0)}; - TRules rulesRelaxed = {ExactMatch(countryId, street)}; +// { +// TRules rulesStrict = {ExactMatch(countryId, building0)}; +// TRules rulesRelaxed = {ExactMatch(countryId, street)}; - // "street" instead of "street-building" - TEST(ResultsMatch("queer street 0 ", rulesStrict), ()); - TEST(ResultsMatch("queer street ", rulesRelaxed), ()); - TEST(ResultsMatch("queer street 2 ", rulesRelaxed), ()); - } +// // "street" instead of "street-building" +// TEST(ResultsMatch("queer street 0 ", rulesStrict), ()); +// TEST(ResultsMatch("queer street ", rulesRelaxed), ()); +// TEST(ResultsMatch("queer street 2 ", rulesRelaxed), ()); +// } - { - TRules rulesStrict = {ExactMatch(countryId, poi0), ExactMatch(countryId, street)}; - TRules rulesRelaxed = {ExactMatch(countryId, street)}; +// { +// TRules rulesStrict = {ExactMatch(countryId, poi0), ExactMatch(countryId, street)}; +// TRules rulesRelaxed = {ExactMatch(countryId, street)}; - // "country-city-street" instead of "country-city-street-poi" - TEST(ResultsMatch("wonderland sick city queer street pharmacy ", rulesStrict), ()); - TEST(ResultsMatch("wonderland sick city queer street school ", rulesRelaxed), ()); - } +// // "country-city-street" instead of "country-city-street-poi" +// TEST(ResultsMatch("wonderland sick city queer street pharmacy ", rulesStrict), ()); +// TEST(ResultsMatch("wonderland sick city queer street school ", rulesRelaxed), ()); +// } - { - TRules rulesStrict = {ExactMatch(countryId, street)}; - TRules rulesRelaxed = {}; +// { +// TRules rulesStrict = {ExactMatch(countryId, street)}; +// TRules rulesRelaxed = {}; - // Cities and larger toponyms should not be relaxed. - // "city" instead of "city-street" - TEST(ResultsMatch("sick city queer street ", rulesStrict), ()); - TEST(ResultsMatch("sick city sick street ", rulesRelaxed), ()); - } +// // Cities and larger toponyms should not be relaxed. +// // "city" instead of "city-street" +// TEST(ResultsMatch("sick city queer street ", rulesStrict), ()); +// TEST(ResultsMatch("sick city sick street ", rulesRelaxed), ()); +// } - { - TRules rulesStrict = {ExactMatch(countryId, street)}; - TRules rulesRelaxed = {}; +// { +// TRules rulesStrict = {ExactMatch(countryId, street)}; +// TRules rulesRelaxed = {}; - // Should not be relaxed. - // "country-city" instead of "country-city-street" - TEST(ResultsMatch("wonderland sick city queer street ", rulesStrict), ()); - TEST(ResultsMatch("wonderland sick city other street ", rulesRelaxed), ()); - } +// // Should not be relaxed. +// // "country-city" instead of "country-city-street" +// TEST(ResultsMatch("wonderland sick city queer street ", rulesStrict), ()); +// TEST(ResultsMatch("wonderland sick city other street ", rulesRelaxed), ()); +// } - { - TRules rulesStrict = {ExactMatch(countryId, poi0)}; - TRules rulesRelaxed = {}; +// { +// TRules rulesStrict = {ExactMatch(countryId, poi0)}; +// TRules rulesRelaxed = {}; - // Should not be relaxed. - // "city" instead of "city-poi" - TEST(ResultsMatch("sick city pharmacy ", rulesStrict), ()); - TEST(ResultsMatch("sick city library ", rulesRelaxed), ()); - } -} +// // Should not be relaxed. +// // "city" instead of "city-poi" +// TEST(ResultsMatch("sick city pharmacy ", rulesStrict), ()); +// TEST(ResultsMatch("sick city library ", rulesRelaxed), ()); +// } +// } } // namespace } // namespace search