summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/acronyms.pl47
-rwxr-xr-xscripts/acronyms.sh5
2 files changed, 52 insertions, 0 deletions
diff --git a/scripts/acronyms.pl b/scripts/acronyms.pl
new file mode 100755
index 0000000..d78afad
--- /dev/null
+++ b/scripts/acronyms.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use 5.010;
+
+my $re_line = qr{
+ ^
+ (?<acronym> [A-Z]{2}[A-Z ]{0,3} )
+ \s
+ (?<name> .+)
+ $
+}x;
+
+say <<'EOF';
+package Travel::Status::DE::IRIS::Acronyms;
+
+use strict;
+use warnings;
+use 5.010;
+use utf8;
+
+our $VERSION = '0.00';
+
+my @acronyms = (
+EOF
+
+while (my $line = <STDIN>) {
+ chomp $line;
+
+ if ($line =~ $re_line) {
+ my ($acronym, $name) = @+{qw{acronym name}};
+ $name =~ s{'}{\\'}g;
+
+ printf("\t['%s','%s'],\n", $acronym, $name);
+ }
+}
+
+say <<'EOF';
+);
+
+sub get_acronyms {
+ return @acronyms;
+}
+
+1;
+EOF
diff --git a/scripts/acronyms.sh b/scripts/acronyms.sh
new file mode 100755
index 0000000..a6bd3ca
--- /dev/null
+++ b/scripts/acronyms.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+curl -s http://www.db-netz.de/file/2361656/data/betriebsstellen.pdf \
+| pdftotext -raw - - | perl scripts/acronyms.pl \
+> lib/Travel/Status/DE/IRIS/Acronyms.pm