Station names in VBB/BVG data are terribly inconsistent, cluttered with abbreviations, phrases to tell identically named places apart, and unhelpful suffixes like , Bahnhof
. parse-vbb-station-name
tries to parse those names into a meaningful structure.
npm install parse-vbb-station-name
const parse = require('parse-vbb-station-name')
console.log(parse('S+U Neukölln (Berlin) [U7]')) // 900078272
{
sbahnUbahn: {type: 'sbahnUbahn', text: 'S+U', offset: 0},
name: {type: 'text', text: 'Neukölln', offset: 4},
differentiators: [
{type: 'differentiator', text: 'Berlin', offset: 14},
],
part: [
{type: 'line', text: 'U7', offset: 23},
],
}
console.log(parse('Eggersdorf (Strausberg), Schule')) // 900320601
{
name: {type: 'text', text: 'Schule', offset: 25},
group: {
type: 'text',
offset: 0,
text: 'Eggersdorf',
differentiators: [
{type: 'differentiator', text: 'Strausberg', offset: 12},
],
},
}
console.log(parse('Abzw. n Schossin, Warsow b Schwerin (Meckl)')) // 900552438
{
name: {type: 'text', text: 'Abzw. n Schossin', offset: 0},
group: {
type: 'text',
offset: 18,
text: 'Warsow',
differentiators: [
{
type: 'differentiator',
offset: 25,
text: 'b Schwerin',
raw: {type: 'differentiator', text: 'Schwerin', offset: 27},
},
{type: 'differentiator', text: 'Meckl', offset: 37},
],
},
}
If you have a question or need support using parse-vbb-station-name
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use the issues page.