Skip to content

Commit c1b0cb6

Browse files
authored
feat(fr): bis/ter housenumber suffixes (#180)
1 parent 85314bf commit c1b0cb6

File tree

5 files changed

+42
-4
lines changed

5 files changed

+42
-4
lines changed

classifier/scheme/subdivision.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const HouseNumberClassification = require('../../classification/HouseNumberClassification')
2+
3+
module.exports = [
4+
{
5+
// 10 bis / 10 ter
6+
confidence: 0.99,
7+
Class: HouseNumberClassification,
8+
scheme: [
9+
{
10+
is: ['HouseNumberClassification'],
11+
not: ['IntersectionClassification']
12+
},
13+
{
14+
is: ['StopWordClassification'],
15+
not: ['IntersectionClassification', 'PunctuationClassification']
16+
}
17+
]
18+
}
19+
]

parser/AddressParser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class AddressParser extends Parser {
7878
new CompositeClassifier(require('../classifier/scheme/street')),
7979
new CompositeClassifier(require('../classifier/scheme/venue')),
8080
new CompositeClassifier(require('../classifier/scheme/intersection')),
81+
new CompositeClassifier(require('../classifier/scheme/subdivision')),
8182

8283
// additional classifiers which act on unclassified tokens
8384
new CentralEuropeanStreetNameClassifier()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bis
2+
ter

test/address.fra.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@ const testcase = (test, common) => {
117117
assert(`Esplanade de la Liberté`, [{ street: 'Esplanade de la Liberté' }])
118118
assert(`Esplanade du Géneral de Gaulle`, [{ street: 'Esplanade du Géneral de Gaulle' }])
119119
assert(`Esplanade Méditerranée`, [{ street: 'Esplanade Méditerranée' }])
120+
121+
// bis/ter housenumber prefixes
122+
assert(`1 bis Av. Amélie, 92320 Châtillon, France`, [
123+
{ housenumber: '1 bis' },
124+
{ street: 'Av. Amélie' },
125+
{ postcode: '92320' },
126+
{ locality: 'Châtillon' },
127+
{ country: 'France' }
128+
])
129+
assert(`1 ter Av. Amélie, 92320 Châtillon, France`, [
130+
{ housenumber: '1 ter' },
131+
{ street: 'Av. Amélie' },
132+
{ postcode: '92320' },
133+
{ locality: 'Châtillon' },
134+
{ country: 'France' }
135+
])
120136
}
121137

122138
module.exports.all = (tape, common) => {

test/address.usa.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,23 @@ const testcase = (test, common) => {
217217
]], false)
218218

219219
// NYC Boroughs
220-
assert('866 E 178th St, Bronx, NY 10460, USA', [[
220+
assert('866 E 178th St, Bronx, NY 10460, USA', [
221221
{ housenumber: '866' },
222222
{ street: 'E 178th St' },
223223
{ locality: 'Bronx' },
224224
{ region: 'NY' },
225225
{ postcode: '10460' },
226226
{ country: 'USA' }
227-
]], false)
227+
])
228228

229-
assert('866 E 178th St, Staten Island, NY 10460, USA', [[
229+
assert('866 E 178th St, Staten Island, NY 10460, USA', [
230230
{ housenumber: '866' },
231231
{ street: 'E 178th St' },
232232
{ locality: 'Staten Island' },
233233
{ region: 'NY' },
234234
{ postcode: '10460' },
235235
{ country: 'USA' }
236-
]], false)
236+
])
237237

238238
// 'Massachusetts' and 'MA' should be interchangeable and both
239239
// forms should allow 'Boston' to be parsed as a locality.

0 commit comments

Comments
 (0)