summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-12-20 10:28:46 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-12-20 10:28:46 +0100
commit81806b59e1ebe7ea1f69a6ba0a192e483df0b594 (patch)
treeabc278f0d3e85c010ac4fb4adf2979ed4bc4add9 /scripts
Initial commit
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