JSPM

db-clean-station-name

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q48822F
  • License ISC

Remove noise and fix common typographic errors in Deutsche Bahn (German railways) station names.

Package Exports

  • db-clean-station-name

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (db-clean-station-name) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

db-clean-station-name

Remove noise and common typographic issues from Deutsche Bahn (DB, german railways) station names, returned e.g. by the db-hafas module. For a list of changes that are applied to names, see the rules section.

npm version Build Status Greenkeeper badge license chat on gitter

Installation

npm install db-clean-station-name

Usage

const cleanStationName = require('db-clean-station-name')

const noisy = 'Berlin Yorckstr. S2 U7 (S+U)'
const cleaned = cleanStationName(noisy)
console.log(cleaned) // 'Berlin Yorckstraße'

Rules

The module applies a specific set of rules, which were test-run against a dataset of ≈250,000 station names. The matches column in the following table specifies how many of those station names a rule could be applied to at least once. Samples for each rule were checked manually for QA.

Rule Example Matches
Fix typographically incorrect apostrophes Up`n KiwittUp’n Kiwitt ≈100
Replace non-round braces Bersarinplatz [Weidenweg]Bersarinplatz (Weidenweg) ≈100
Fix whitespace for braces Frankfurt(Main)HbfFrankfurt (Main) Hbf ≈2100
Fix whitespace for punctuation and slashes St.GeorgSt. Georg, Landau a.d. IsarLandau a.d. Isar ≈700
Replace generic abbreviations: Abzw., b., Ri. Abzw. BaalbornAbzweig Baalborn, Garching b. MünchenGarching bei München ≈10000
Replace most common location abbreviations: Thür, Württ, Meckl, … Note that this rule will probably be replaced by a more generic location-parsing rule at some point Minden(Westf)Minden (Westfalen) ≈5000
Replace Str. with Straße Bülowstr.Bülowstraße, Willy-Brandt-Str.Willy-Brandt-Straße ≈22000
Remove defined set of line and product names: U1, (U), (Bus), (S 1), … Alexanderplatz (U) U5 U8, BerlinAlexanderplatz, Berlin, Budberg (B63), WerlBudberg (B63), Werl ≈700

There are some additional rules which aren't listed here, but those only affect a handful of stations or fix the result of other rules (e.g. removing duplicate whitespace).

What this module doesn't fix yet: Location name inconsistencies, e.g. Berlin Jungfernheide vs. Jungfernheide, Berlin

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.