Skip to content

Commit

Permalink
🚑️ Reduce boundingbox radius for station creation
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin committed Feb 28, 2025
1 parent ce0f9a8 commit 8eb399e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions app/Helpers/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ public static function simplifyStationName(string $stationName): string {
'GLEIS',
'PLATFORM',
'GL',
'BAHNHOF',
'GARE',
'STATION',
];
foreach ($removals as $prefix) {
$stationName = str_replace($prefix, '', $stationName);
}

// 5. Replace common words
$replacements = [
'CENTRALSTATION' => 'HBF',
'CENTRAL STATION' => 'HBF',
'GARECENTRALE' => 'HBF',
'GARE CENTRALE' => 'HBF',
'HAUPTBAHNHOF' => 'HBF',
' BAHNHOF' => 'BF',
'HLAVN NDRA' => 'HBF', // Hlavní nádraží without special characters
'HLN' => 'HBF', // Hlavní nádraží abbreviation
'CENTRALE' => 'HBF',
'CENTRAL' => 'HBF',
'HAUPT' => 'HBF', // Hauptbahnhof
'HLAVN NDRA' => 'HBF', // Hlavní nádraží without special characters
'HLN' => 'HBF', // Hlavní nádraží abbreviation
];
foreach ($replacements as $search => $replace) {
$stationName = str_replace($search, $replace, $stationName);
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/Helpers/FormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ public static function stationNameProvider(): array {
['Halle (Saale) Central Station (FlixTrain)', 'HALLESAALEHBF'],
['Bad Hersfeld (FlixTrain)', 'BADHERSFELD'],
['Frankfurt (Main) Süd (FlixTrain)', 'FRANKFURTMAINSD'],
['Hauptfriedhof, Südeingang, Musterstadt', 'HAUPTFRIEDHOFSDEINGANG'],
['Bahnhofsvorplatz, Musterstadt', 'BAHNHOFSVORPLATZ'],
['Hauptfriedhof, Südeingang, Musterstadt', 'HBFFRIEDHOFSDEINGANG'],
['Bahnhofsvorplatz, Musterstadt', 'SVORPLATZ'],
['Praha Hl.n', 'PRAHAHBF'],
['Berlin Hbf (tief)', 'BERLINHBF'],
['Stuttgart Hbf (oben)', 'STUTTGARTHBF'],
['Tieflehn (tief)', 'LEHN'],
['München Hbf Gl.27-36', 'MNCHENHBF'],
['Albtalbahnhof', 'ALBTAL'],
];
}

Expand Down

0 comments on commit 8eb399e

Please sign in to comment.