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

feat(poland): classifying more addresses for poland #174

Merged
merged 16 commits into from
Aug 15, 2023
Merged
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
2 changes: 1 addition & 1 deletion classifier/PlaceClassifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PlaceClassifier extends WordClassifier {
setup () {
// load index tokens
this.index = {}
libpostal.load(this.index, ['fr', 'de', 'en'], 'place_names.txt')
libpostal.load(this.index, ['fr', 'de', 'en', 'pl'], 'place_names.txt')
libpostal.generatePlurals(this.index)
}

Expand Down
2 changes: 1 addition & 1 deletion classifier/PostcodeClassifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const dictPath = path.join(__dirname, `../resources/chromium-i18n/ssl-address`)
// const countryCodes = fs.readdirSync(dictPath)
// .filter(p => p.endsWith('.json'))
// .map(p => p.split('.')[0])
const countryCodes = ['us', 'gb', 'fr', 'de', 'es', 'pt', 'au', 'nz', 'kr', 'jp', 'in', 'ru', 'br', 'nl']
const countryCodes = ['us', 'gb', 'fr', 'de', 'es', 'pt', 'au', 'nz', 'kr', 'jp', 'in', 'ru', 'br', 'nl', 'pl']

class PostcodeClassifier extends WordClassifier {
setup () {
Expand Down
2 changes: 1 addition & 1 deletion classifier/StreetPrefixClassifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const libpostal = require('../resources/libpostal/libpostal')

// prefix languages
// languages which use a street prefix instead of a suffix
const prefix = ['fr', 'ca', 'es', 'pt', 'ro']
const prefix = ['fr', 'ca', 'es', 'pt', 'ro', 'pl']

class StreetPrefixClassifier extends WordClassifier {
setup () {
Expand Down
2 changes: 1 addition & 1 deletion classifier/StreetSuffixClassifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const libpostal = require('../resources/libpostal/libpostal')

// prefix languages
// languages which use a street prefix instead of a suffix
const prefix = ['fr', 'ca', 'es', 'pt', 'ro']
const prefix = ['fr', 'ca', 'es', 'pt', 'ro', 'pl']

class StreetSuffixClassifier extends WordClassifier {
setup () {
Expand Down
38 changes: 38 additions & 0 deletions classifier/scheme/street.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,44 @@ module.exports = [
}
]
},
{
// Aleja Wojska Polskiego
confidence: 0.91,
Class: StreetClassification,
scheme: [
{
is: ['StreetPrefixClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['PlaceClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['AlphaClassification', 'GivenNameClassification', 'PersonClassification'],
not: ['StreetClassification', 'StreetPrefixClassification']
}
]
},
{
// Aleja 11 Listopada
confidence: 0.84,
Class: StreetClassification,
scheme: [
{
is: ['StreetPrefixClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['NumericClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['AlphaClassification', 'GivenNameClassification', 'PersonClassification'],
not: ['StreetClassification', 'StreetPrefixClassification']
}
]
},
{
// Boulevard du Général Charles De Gaulle
confidence: 0.81,
Expand Down
1 change: 1 addition & 0 deletions resources/pelias/dictionaries/libpostal/pl/place_names.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wojsko|wojska|wojsk
1 change: 1 addition & 0 deletions resources/pelias/dictionaries/libpostal/pl/synonyms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
polskiego|polski|pol
22 changes: 22 additions & 0 deletions test/address.pol.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ const testcase = (test, common) => {
{ street: 'Szewska' }, { housenumber: '6' },
{ locality: 'Kraków' }
])

assert('aleja Wojska Polskiego 178', [
{ street: 'aleja Wojska Polskiego' }, { housenumber: '178' }
])

assert('aleja 29 listopada 11', [
{ street: 'aleja 29 listopada' }, { housenumber: '11' }
])

assert('aleja Wojska 178', [
{ street: 'aleja Wojska' }, { housenumber: '178' }
])

assert('Ulica Strzelecka 12, Nowy Sącz', [
{ street: 'Ulica Strzelecka' }, { housenumber: '12' },
{ locality: 'Nowy Sącz' }
])

assert('Żorska 11, 47-400', [
{ street: 'Żorska' }, { housenumber: '11' },
{ postcode: '47-400' }
])
}

module.exports.all = (tape, common) => {
Expand Down
Loading