[search] Improve search synonyms spanish

Signed-off-by: patepelo <developing.anton@gmail.com>
This commit is contained in:
patepelo
2025-11-13 01:13:23 +07:00
committed by x7z4w
parent 6d0111b434
commit e862da648e

View File

@@ -3,8 +3,8 @@
#include "search/ranking_utils.hpp"
#include "search/token_range.hpp"
#include <unordered_map>
#include <sstream>
#include <unordered_map>
namespace search
{
@@ -18,38 +18,77 @@ namespace
unordered_map<string, vector<string>> const kSynonyms = {
/// @todo Should process synonyms with errors like "blvrd" -> "blvd".
/// @see HouseOnStreetSynonymsWithMisprints test.
{"1", {"pierwszy", "pierwsza", "un", "una", "pierwsze", "primo", "واحد", "حادى", "احد"}},
{"1st", {"first"}},
{"", {"primo"}},
{"20", {"venti", "عشرين", "عشرون"}},
{"25", {"venticinque", "خمسه و عشرون", "خمس و عشرين"}},
{"2", {"due", "drugi", "drugie", "druga", "اثنان", "اثنين"}},
{"2nd", {"second"}},
{"3", {"trzecia", "trzecie", "tre", "trzeci", "ثلاث"}},
{"3rd", {"third"}},
{"4", {"quattro", "اربع"}},
{"4th", {"fourth"}},
{"5", {"cinque", "خمس"}},
{"5th", {"fifth"}},
{"6", {"sei", "ست"}},
{"6th", {"sixth"}},
{"7", {"sette", "سبع"}},
{"7th", {"seventh"}},
{"8", {"otto", "ثمان", "ثمانيه"}},
{"8th", {"eighth"}},
{"9", {"nove", "تسع"}},
{"9th", {"ninth"}},
{"10a", {"décima"}},
{"10o", {"décimo"}},
{"10th", {"tenth"}},
{"11a", {"undécima", "decimoprimera"}},
{"11o", {"undécimo", "decimoprimero"}},
{"11th", {"eleventh"}},
{"12a", {"duodécima", "decimosegunda"}},
{"12o", {"duodécimo", "decimosegundo"}},
{"12th", {"twelfth"}},
{"13a", {"decimotercera"}},
{"13o", {"decimotercero"}},
{"13th", {"thirteenth"}},
{"14a", {"decimocuarta"}},
{"14o", {"decimocuarto"}},
{"14th", {"fourteenth"}},
{"15a", {"decimoquinta"}},
{"15o", {"decimoquinto"}},
{"15th", {"fifteenth"}},
{"16a", {"decimosexta"}},
{"16o", {"decimosexto"}},
{"16th", {"sixteenth"}},
{"17a", {"decimoséptima"}},
{"17o", {"decimoséptimo"}},
{"17th", {"seventeenth"}},
{"18a", {"decimoctava"}},
{"18o", {"decimoctavo"}},
{"18th", {"eighteenth"}},
{"19a", {"decimonovena"}},
{"19o", {"decimonoveno"}},
{"19th", {"nineteenth"}},
{"1a", {"primera"}},
{"1o", {"primo", "primero"}},
{"1",
{"pierwszy", "pierwsza", "un", "una", "uno", "pierwsze", "primo", "primer", "primero", "واحد", "حادى", "احد"}},
{"", {"primo", "primero"}},
{"1st", {"first"}},
{"20th", {"twentieth"}},
{"20", {"venti", "veinte", "عشرين", "عشرون"}},
{"25", {"venticinque", "خمسه و عشرون", "خمس و عشرين"}},
{"2a", {"segunda"}},
{"2", {"due", "drugi", "drugie", "druga", "dos", "segunda", "segundo", "اثنان", "اثنين"}},
{"2nd", {"second"}},
{"2o", {"segundo"}},
{"3a", {"tercera"}},
{"3o", {"tercero"}},
{"3rd", {"third"}},
{"3", {"trzecia", "trzecie", "tre", "trzeci", "tres", "tercera", "tercero", "ثلاث"}},
{"4a", {"cuarta"}},
{"4o", {"cuarto"}},
{"4", {"quattro", "cuatro", "cuarta", "cuarto", "اربع"}},
{"4th", {"fourth"}},
{"5a", {"quinta"}},
{"5", {"cinque", "cinco", "quinta", "quinto", "خمس"}},
{"5o", {"quinto"}},
{"5th", {"fifth"}},
{"6a", {"sexta"}},
{"6o", {"sexto"}},
{"6", {"sei", "seis", "sexta", "secto", "ست"}},
{"6th", {"sixth"}},
{"7a", {"séptima"}},
{"7o", {"séptimo"}},
{"7", {"sette", "siete", "séptima", "séptima", "سبع"}},
{"7th", {"seventh"}},
{"8a", {"octava"}},
{"8o", {"octavo"}},
{"8", {"otto", "ocho", "octava", "octavo", "ثمان", "ثمانيه"}},
{"8th", {"eighth"}},
{"9a", {"novena"}},
{"9o", {"noveno"}},
{"9", {"nove", "nueve", "تسع", "nueve", "novena", "noveno"}},
{"9th", {"ninth"}},
{"a", {"am", "auto-estrada", "aikštė"}},
{"abe", {"abbaye"}},
{"accs", {"access"}},
@@ -96,7 +135,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"arb", {"arboleda"}},
{"arc", {"arcade", "arcades"}},
{"arq", {"arquiteto", "arquitecto"}},
{"arqº", {"arquiteto", "arquitecto"}},
{"arqo", {"arquiteto", "arquitecto"}},
{"arral", {"arrabal"}},
{"arry", {"arroyo"}},
{"art", {"anciennes routes", "ancienne route"}},
@@ -114,8 +153,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"auto", {"autopista"}},
{"autop", {"autopista"}},
{"autov", {"autovía", "autovia"}},
{"avª", {"avenida"}},
{"av", {"avinguda", "avenida", "avenue"}},
{"ava", {"avenida"}},
{"avda", {"avinguda", "avenida"}},
{"avd", {"avinguda", "avenida"}},
{"ave", {"avenue"}},
@@ -164,7 +203,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"blvrd", {"boulevard"}},
{"bnc", {"barranc"}},
{"bnd", {"bend"}},
{"", {"bairro"}},
{"bo", {"barrio"}},
{"boul", {"boulevard"}},
{"bpa", {"biskupa", "biskup"}},
@@ -203,9 +241,11 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"byp", {"bypass"}},
{"bywy", {"byway"}},
{"cac", {"cacique"}},
{"cª", {"companhia"}},
{"ca", {"compañía anónima","companhia", "compañía"}},
{"cad", {"cadde"}},
{"cal", {"calea"}},
{"cale", {"cale"}},
{"call", {"calleja", "callejón"}},
{"callej", {"callejón"}},
{"cam", {"caminho", "camino"}},
{"campg", {"camping"}},
@@ -223,13 +263,11 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"cav", {"cavée"}},
{"cbtiz", {"cobertizo"}},
{"cc", {"calçada", "centro comercial"}},
{"call", {"calleja", "callejón"}},
{"c", {"cesta", "carrer", "calle", "centre"}},
{"cckq", {"căn cứ không quân"}},
{"ccnh", {"calçadinha"}},
{"cct", {"circuit"}},
{"ccvcn", {"circunvalación"}},
{"cad", {"cadde"}},
{"cd", {"cadde", "caddesi"}},
{"", {"cao đẳng"}},
{"cds", {"cul-de-sac"}},
@@ -331,8 +369,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"crtil", {"carretil"}},
{"crtjo", {"cortijo"}},
{"csac", {"cul-de-sac"}},
{"cs", {"cross"}},
{"čs", {"československé", "československého", "československých"}},
{"cs", {"cross"}},
{"csg", {"crossing"}},
{"csl", {"casal"}},
{"čsl", {"československej", "československé", "československého", "československých"}},
@@ -352,6 +390,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"cty", {"city", "công ty"}},
{"cty cp", {"công ty cổ phần"}},
{"ctyd", {"courtyard"}},
{"cuarta", {"4", "4a"}},
{"cuarto", {"4", "4o"}},
{"cutt", {"cutting"}},
{"cv", {"công viên", "cove", "cave"}},
{"cve", {"curve"}},
@@ -360,7 +400,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"cway", {"causeway"}},
{"cyd", {"courtyard"}},
{"czada", {"calzada"}},
{"dª", {"dona"}},
{"da", {"dona"}},
{"dars", {"darse"}},
{"dav", {"deutscher alpenverein"}},
{"d´", {"de"}},
@@ -388,7 +428,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"dom", {"domaine", "domaines"}},
{"dq", {"duque"}},
{"dra", {"doctora", "doutora"}},
{"drª", {"doutora"}},
{"dr", {"doktora", "doktorky", "doktor", "dokter", "doctor", "drive", "doutora", "doutor", "doktora"}},
{"drec", {"drecera"}},
{"drs", {"doctorandus"}},
@@ -419,8 +458,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"egl", {"église"}},
{"égl", {"église"}},
{"ehem", {"ehemalige", "ehemaliger", "ehemaliges"}},
{"eighth", {"8th"}},
{"eighteenth", {"18th"}},
{"eighth", {"8th"}},
{"elb", {"elbow"}},
{"eleventh", {"11th"}},
{"emb", {"embaixador"}},
@@ -430,10 +469,10 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"en", {"estrada nacional", "enceinte"}},
{"enf", {"enfermeiro"}},
{"enfo", {"enfermeiro"}},
{"enfº", {"enfermeiro"}},
{"engª", {"engenheira"}},
{"enfo", {"enfermeiro"}},
{"enga", {"engenheira"}},
{"eng", {"engenheira", "engenheiro"}},
{"engº", {"engenheiro"}},
{"engo", {"engenheiro"}},
{"entd", {"entrada"}},
{"ent", {"entrance"}},
{"entl", {"entresòl"}},
@@ -482,10 +521,10 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"ff", {"freiwillige feuerwehr"}},
{"fg", {"faubourg"}},
{"fh", {"fachhochschule", "forsthaus"}},
{"fit", {"firetrail"}},
{"fifth", {"5th"}},
{"fifteenth", {"15th"}},
{"fifth", {"5th"}},
{"first", {"1st"}},
{"fit", {"firetrail"}},
{"flat", {"flat"}},
{"fl", {"flat"}},
{"fnd", {"fundătura"}},
@@ -493,8 +532,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"fon", {"fontaine"}},
{"form", {"forum", "formation"}},
{"fos", {"fosses", "fosse"}},
{"fourth", {"4th"}},
{"fourteenth", {"14th"}},
{"fourth", {"4th"}},
{"foyr", {"foyer"}},
{"fr", {"father", "frontage", "frei"}},
{"frm", {"ferme", "fermes"}},
@@ -540,7 +579,9 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"gpt", {"groupement"}},
{"gra", {"grange"}},
{"grg", {"gymnasium und realgymnasium"}},
{"gr", {"grande rue", "grandes rues", "gracht", "grandrue", "gränd", "graben", "grovet", "gränden", "grove", "großes", "große", "großer"}},
{"gr",
{"grande rue", "grandes rues", "gracht", "grandrue", "gränd", "graben", "grovet", "gränden", "grove", "großes",
"große", "großer"}},
{"gri", {"grille"}},
{"grim", {"grimpette"}},
{"grnd", {"ground"}},
@@ -593,11 +634,11 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"ii", {"seconda", "drugi", "druga", "secondo", "segundo", "drugie"}},
{"ile", {"île"}},
{"ima", {"irmã"}},
{"imª", {"irmã"}},
{"ima", {"irmã"}},
{"im", {"irmã", "irmão"}},
{"imm", {"immeubles", "immeuble"}},
{"imo", {"irmão"}},
{"imº", {"irmão"}},
{"imo", {"irmão"}},
{"imp", {"impasse", "impasses"}},
{"ind", {"industrial"}},
{"inf", {"infante"}},
@@ -750,26 +791,28 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"mw", {"mews"}},
{"mwy", {"motorway"}},
{"mz", {"manzana"}},
{"nábr", {"nábrežie"}},
{"nábř", {"nábřeží"}},
{"nábr", {"nábrežie"}},
{"nac", {"nacional"}},
{"nám", {"námestie", "náměstí"}},
{"n:a", {"norra"}},
{"nª", {"nossa"}},
{"na", {"nossa"}},
{"nd", {"niedere", "niederes", "niederer"}},
{"ndr", {"nordre"}},
{"ne", {"northeast"}},
{"nh", {"nhà hát"}},
{"nhs", {"national high school"}},
{"ninth", {"9th"}},
{"nineteenth", {"19th"}},
{"ninth", {"9th"}},
{"nk", {"nook"}},
{"nms", {"neue mittelschule"}},
{"n", {"nowy", "nowa", "nossa", "norra", "número", "north", "nosso", "nacional", "nowe"}},
{"", {"niederösterreichischer", "niederösterreichisches", "niederösterreich", "niederösterreichische"}},
{"nº", {"número"}},
{"no", {"número"}},
{"nook", {"nook"}},
{"nördl", {"nördlicher", "nördliche", "nördliches"}},
{"novena", {"9", "9a"}},
{"noveno", {"9", "9o"}},
{"no", {"சாலை", "salai", "nomor", "vazhi", "வழி"}},
{"np", {"nationalpark", "national park"}},
{"nra", {"national recreation area"}},
@@ -789,6 +832,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"öav", {"österreichischer alpenverein"}},
{"obj", {"objekt"}},
{"ob", {"oberer", "obere", "oberes"}},
{"octava", {"8", "8a"}},
{"octavo", {"8", "8o"}},
{"ögv", {"österreichischer gebirgsverein"}},
{"olv", {"onze-lieve-vrouw"}},
{"o", {"ob"}},
@@ -828,7 +873,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"pcp", {"police community precinct"}},
{"pc", {"praça"}},
{"", {"praça"}},
{"pctª", {"praceta"}},
{"pcta", {"praceta"}},
{"pct", {"precinct", "praceta"}},
{"pda", {"pujada"}},
{"pde", {"parade"}},
@@ -850,8 +895,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"piaz", {"piazza"}},
{"pim", {"petite impasse"}},
{"pi", {"polígon industrial"}},
{"pj", {"polícia judiciária"}},
{"pje", {"pasaje"}},
{"pj", {"polícia judiciária"}},
{"pkg", {"parking"}},
{"pkld", {"parklands"}},
{"pko", {"puistikko"}},
@@ -882,7 +927,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"pol. ind", {"polígon industrial"}},
{"pol", {"polígon"}},
{"pont", {"ponts", "pont"}},
{"po", {"post office"}},
{"po", {"post office", "paseo"}},
{"por", {"porucznika", "porucznik", "poručíka"}},
{"porq", {"portique", "portiques"}},
{"port", {"port"}},
@@ -898,9 +943,11 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"pre", {"pré"}},
{"presid", {"presidente"}},
{"pres", {"president"}},
{"primera", {"1", "1a"}},
{"primero", {"1", "1o"}},
{"prk", {"purok"}},
{"prm", {"promenade"}},
{"profª", {"professora"}},
{"profa", {"professora"}},
{"prof", {"professora", "professor", "profesora", "profesorky", "profesor"}},
{"proj", {"projectada", "projetada"}},
{"prolng", {"prolongamento"}},
@@ -949,6 +996,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"qt", {"quảng trường"}},
{"quad", {"quad"}},
{"qua", {"quartier"}},
{"quinta", {"5", "5a"}},
{"quinto", {"5", "5o"}},
{"qu", {"quelle", "quai"}},
{"qy", {"quay", "quays"}},
{"qys", {"quays"}},
@@ -956,7 +1005,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"raid", {"raidillon"}},
{"rang", {"rang"}},
{"ra", {"ramble"}},
{"rª", {"ribeira"}},
{"ra", {"ribeira"}},
{"ras", {"rautatieasema"}},
{"rbla", {"rambla"}},
{"rbra", {"ribera"}},
@@ -978,13 +1027,12 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"rem", {"rempart"}},
{"rep", {"representative"}},
{"resid", {"residencial"}},
{"res", {"reservation", "reserve", "reservoir", "résidence", "résidences", "residencias", "residencia"}},
{"rest", {"rest"}},
{"res", {"reservation", "reserve", "reservoir", "résidence", "résidences", "residencias", "residencia", "residencial"}},
{"rge", {"range"}},
{"rg", {"range"}},
{"rgwy", {"ridgeway"}},
{"rh", {"rhein", "rạp hát"}},
{"ribª", {"ribeira"}},
{"riba", {"ribeira"}},
{"rib", {"ribeirão", "ribeira"}},
{"ri", {"rise"}},
{"rise", {"rise"}},
@@ -1024,8 +1072,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"sanat", {"sanatorio"}},
{"santu", {"santuario"}},
{"sarg", {"sargento"}},
{"sª", {"senhora"}},
{"sa", {"sociedade anónima"}},
{"sa", {"sociedade anónima", "sociedad anónima","senhora"}},
{"s:a", {"södra"}},
{"savinj", {"savinjski"}},
{"sbg", {"salzburger", "salzburg"}},
@@ -1045,12 +1092,18 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"second", {"2nd"}},
{"sect", {"sector"}},
{"sedra", {"sendera"}},
{"segunda", {"2", "2a"}},
{"segundo", {"2", "2o"}},
{"send", {"sendero"}},
{"sen", {"sente", "senator", "sentiers", "sentier", "sentes"}},
{"sent", {"sentier"}},
{"seventh", {"7th"}},
{"seventeenth", {"17th"}},
{"séptima", {"7", "7a"}},
{"séptimo", {"7", "7o"}},
{"se", {"southeast"}},
{"seventeenth", {"17th"}},
{"seventh", {"7th"}},
{"sexta", {"6", "6a"}},
{"sexto", {"6", "6o"}},
{"sgda", {"sagrada"}},
{"sg", {"schottergrube", "sungai", "sandgrube"}},
{"sgt", {"sagrat", "sergeant"}},
@@ -1059,8 +1112,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"shun", {"shunt"}},
{"shwy", {"state highway"}},
{"sídl", {"sídlisko", "sídliště"}},
{"sixth", {"6th"}},
{"sixteenth", {"16th"}},
{"sixth", {"6th"}},
{"sk", {"sokak", "sokağı"}},
{"skv", {"skveras"}},
{"slj", {"sobre-loja"}},
@@ -1087,14 +1140,12 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"spl", {"splaiul"}},
{"sp", {"strada provinciale", "szkoła podstawowa", "splaiul", "spodnja", "spodnji", "spitze", "spodnje"}},
{"sq", {"square", "superquadra"}},
{"srª", {"senhora"}},
{"sra", {"senhora", "senora", "señora"}},
{"sr", {"srednje", "strada regionale", "senior", "srednja", "senhor", "srednji", "señor", "sister", "state route"}},
{"s", {"santo", "senhora", "sant'", "santa", "south", "são", "san", "södra", "senhor", "see"}},
{"ss", {"simpang susun", "santi", "strada statale", "saints"}},
{"śś", {"świętych", "święci"}},
{"s:ta", {"sankta"}},
{"stª", {"santa"}},
{"sta", {"santa", "station"}},
{"stas", {"santas"}},
{"staz", {"stazione"}},
@@ -1105,7 +1156,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"sth", {"south"}},
{"stn", {"station"}},
{"sto", {"santo"}},
{"stº", {"santo"}},
{"stos", {"santos"}},
{"strada", {"strada"}},
{"stra", {"strand", "strada"}},
@@ -1136,6 +1186,8 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"tcty", {"tổng công ty"}},
{"ten", {"tenente"}},
{"tenth", {"10th"}},
{"tercera", {"3", "3a"}},
{"tercero", {"3", "3o"}},
{"term", {"terminal"}},
{"terr", {"terrace"}},
{"ter", {"terrace"}},
@@ -1359,6 +1411,33 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"туп", {"тупик", "тупік"}},
{"ул", {"улица"}},
{"ш", {"шаша", "шосе", "шоссе"}},
{"اثنان", {"2"}},
{"اثنين", {"2"}},
{"احد", {"1"}},
{"اربع", {"4"}},
{"الاحد", {"الحد"}},
{"التلات", {"الثلاثاء"}},
{"الثلاثاء", {"التلات"}},
{"الحد", {"الاحد"}},
{"تسع", {"9"}},
{"ثلاث", {"3"}},
{"ثمان", {"8"}},
{"ثمانيه", {"8"}},
{"ج", {"جامعه"}},
{"حادى", {"1"}},
{"ح", {"حى"}},
{"خمس", {"5"}},
{"د", {"دكتور"}},
{"سبع", {"7"}},
{"ست", {"6"}},
{"ش", {"شارع"}},
{"ط", {"طريق"}},
{"عشر", {"10"}},
{"عشرون", {"20"}},
{"عشرين", {"20"}},
{"ع", {"عماره"}},
{"م", {"ميدان", "مجاوره", "محطه", "موقف"}},
{"واحد", {"1"}},
{"ইউপি", {"ইউনিয়ন পরিষদ"}},
{"একনেক", {"জাতীয় অর্থনৈতিক পরিষদের নির্বাহী কমিটি"}},
{"টেশিস", {"টেলিফোন শিল্প সংস্থা"}},
@@ -1379,7 +1458,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"", {"医療法人"}},
{"", {"合同会社"}},
{"", {"合名会社"}},
{"", {"国立大学法人", "公立大学法人","大学"}},
{"", {"国立大学法人", "公立大学法人", "大学"}},
{"", {"学校法人"}},
{"", {"小学校"}},
{"", {"有限会社"}},
@@ -1390,33 +1469,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"", {"銀行"}},
{"高校", {"高等学校"}},
{"", {"高等学校"}},
{"ش", {"شارع"}},
{"ط", {"طريق"}},
{"م", {"ميدان", "مجاوره", "محطه", "موقف"}},
{"د", {"دكتور"}},
{"ج", {"جامعه"}},
{"ح", {"حى"}},
{"ع", {"عماره"}},
{"احد", {"1"}},
{"واحد", {"1"}},
{"حادى", {"1"}},
{"اثنين", {"2"}},
{"اثنان", {"2"}},
{"ثلاث", {"3"}},
{"اربع", {"4"}},
{"خمس", {"5"}},
{"ست", {"6"}},
{"سبع", {"7"}},
{"ثمان", {"8"}},
{"ثمانيه", {"8"}},
{"تسع", {"9"}},
{"عشر", {"10"}},
{"عشرين", {"20"}},
{"عشرون", {"20"}},
{"الحد", {"الاحد"}},
{"الاحد", {"الحد"}},
{"التلات", {"الثلاثاء"}},
{"الثلاثاء", {"التلات"}},
};
} // namespace