Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Spanish street suffix synonyms #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions integration/analyzer_peliasPhrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports.tests.analyze = function(test, common){
assertAnalysis( 'asciifolding', 'ł', ['l']);
assertAnalysis( 'asciifolding', 'ɰ', ['m']);
assertAnalysis( 'trim', ' f ', ['f'] );
assertAnalysis( 'stop_words (disabled)', 'a st b ave c', ['0:a', '1:st', '1:street', '2:b', '3:ave', '3:avenue', '3:av', '4:c'] );
assertAnalysis( 'ampersand', 'a and b', ['0:a', '1:and', '1:&', '2:b']);
assertAnalysis( 'ampersand', 'a & b', ['0:a', '1:&', '1:and', '1:und', '2:b']);
assertAnalysis( 'ampersand', 'a and & and b', ['0:a', '1:and', '1:&', '2:&', '2:and', '2:und', '3:and', '3:&', '4:b']);
Expand Down Expand Up @@ -68,7 +67,10 @@ module.exports.tests.functional = function(test, common){
]);

assertAnalysis( 'address', '101 geocode pl', [
'0:101', '1:geocode', '2:pl', '2:place', '2:platz'
'0:101',
'1:geocode',
'2:pca', '2:pl', '2:placa', '2:place', '2:platz',
'2:plaza', '2:plca', '2:plza', '2:pza'
]);

// both terms should map to same tokens
Expand Down
45 changes: 45 additions & 0 deletions synonyms/street_suffix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,48 @@ bruecke, brucke, br
bahnhof, bhf, bf
chaussee, ch
platz, pl

# Spanish street suffixes
antic cami,ant cami
antiga carretera,actra,actra
autopista,auto,autop,autp,auto,autop,autp
autovia,autov,autv,autov,autv
avenida,av
avinguda,av,avd,avda,avgda,agda,avgda
baixada,bda,bajada,bda,bajada
barranc,bnc,barranco,bnc,barranco
calçada,cda,calzada,cda,calzada
cami,camino
carrer,carr,c,car,cl,calle
carrera,carra,ctra,crt,crta,crtra,carret,cra,carra,ctra,crt,crta,crtra,carret
carrerada,ca
carrero,cro,carro,carr,carrero,carro,carr
carretera,ctra,ctra
cinturo,cint,cinto
circumval lacio,cval,circunvalacion,circunvalacion
corredor,cdor
corriol,crol
costa,cos,cuesta
diagonal,diag,diag
drecera,drec
eix,eje
entrada,entr
gran via,gv,g v
passadis,pdis,pasadizo
passatge,ptge,ptg,pge,pstg,pasage,ptge,ptg,pge,pstg,pasage
psg,passeig,pg,pje,paseo,passeig,pg,pje,paseo
passera,psera
placa,pl,pca,plca,plaza,pza,plza,placa
placeta,plta
portal,ptal
pujada,pda
rambla,rbla,rbl
rambleta,rblt
riera,ra
ronda,rda
rotonda,rtda
sortida,sort,salida,slda,sort,salida,slda
transversal,trval,trvsal,trval,trvsal
travessera,trav,travesera,trav,travesera
travessia,trv,trav,travesia
via,v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets be sure to test this before we merge it. One character synonyms can probably have large and surprising impacts on both performance and result quality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

45 changes: 44 additions & 1 deletion test/fixtures/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,50 @@
"bruecke,brucke,br",
"bahnhof,bhf,bf",
"chaussee,ch",
"platz,pl"
"platz,pl",
"antic cami,ant cami",
"antiga carretera,actra,actra",
"autopista,auto,autop,autp,auto,autop,autp",
"autovia,autov,autv,autov,autv",
"avenida,av",
"avinguda,av,avd,avda,avgda,agda,avgda",
"baixada,bda,bajada,bda,bajada",
"barranc,bnc,barranco,bnc,barranco",
"calçada,cda,calzada,cda,calzada",
"cami,camino",
"carrer,carr,c,car,cl,calle",
"carrera,carra,ctra,crt,crta,crtra,carret,cra,carra,ctra,crt,crta,crtra,carret",
"carrerada,ca",
"carrero,cro,carro,carr,carrero,carro,carr",
"carretera,ctra,ctra",
"cinturo,cint,cinto",
"circumval lacio,cval,circunvalacion,circunvalacion",
"corredor,cdor",
"corriol,crol",
"costa,cos,cuesta",
"diagonal,diag,diag",
"drecera,drec",
"eix,eje",
"entrada,entr",
"gran via,gv,g v",
"passadis,pdis,pasadizo",
"passatge,ptge,ptg,pge,pstg,pasage,ptge,ptg,pge,pstg,pasage",
"psg,passeig,pg,pje,paseo,passeig,pg,pje,paseo",
"passera,psera",
"placa,pl,pca,plca,plaza,pza,plza,placa",
"placeta,plta",
"portal,ptal",
"pujada,pda",
"rambla,rbla,rbl",
"rambleta,rblt",
"riera,ra",
"ronda,rda",
"rotonda,rtda",
"sortida,sort,salida,slda,sort,salida,slda",
"transversal,trval,trvsal,trval,trvsal",
"travessera,trav,travesera,trav,travesera",
"travessia,trv,trav,travesia",
"via,v"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ module.exports.tests.streetSynonymFilter = function(test, common) {
var filter = s.analysis.filter.street_suffix;
t.equal(filter.type, 'synonym');
t.true(Array.isArray(filter.synonyms));
t.equal(filter.synonyms.length, 127);
t.equal(filter.synonyms.length, 170);
t.end();
});
};
Expand Down