parse-vbb-station-name

    2.1.2 • Public • Published

    parse-vbb-station-name

    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 version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

    Installing

    npm install parse-vbb-station-name

    Usage

    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},
    		],
    	},
    }

    Contributing

    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.

    Install

    npm i parse-vbb-station-name

    DownloadsWeekly Downloads

    3

    Version

    2.1.2

    License

    ISC

    Unpacked Size

    34.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • derhuerst