ftp.nice.ch/pub/next/database/plz/plz.perl.1.3.b.tar.gz#/postleitzahlen/server/abkuerzung.pl

This is abkuerzung.pl in view mode; [Download] [Up]

# Abkuerzen eines Strings nach Vorgabe der Bundespost
# (entnommen aus Postleitzahlenbuch)
# usage: $text_abgekuerzt = &abgekuerzt($some_text);
#############################################################################
#    Copyright (C) 1993
#    Andreas Koppenhoefer (koppenh@dia.informatik.uni-stuttgart.de)
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#############################################################################
# @(#)$Id: abkuerzung.pl,v 1.2 1993/06/15 15:38:36 koppenh Exp $
# $Log: abkuerzung.pl,v $
#    Revision 1.2  1993/06/15  15:38:36  koppenh
#    Neue Release Nummer;
#
#    Revision 1.1.0.1  1993/06/08  19:15:52  koppenh
#    RCSid string korrigiert
#
#############################################################################

# Abkuerzungen der Bundespost

sub abkuerzung {
    local($text) = @_;
    return ($text) unless $text =~ /\w/;
    
    # Abkuerzung von Endungen
    $text =~ s/\Bstraße\b/str/ig;
    $text =~ s/\Bland\b/l/ig;
    $text =~ s/\Bkreis\b/kr/ig;
    $text =~ s/\Bgebirge\b/geb/ig;
    $text =~ s/\Bwald\b/w/ig;
    $text =~ s/\Bfranken\b/fr/ig;
    $text =~ s/\Bholstein\b/holst/ig;
    $text =~ s/\Bbayern\b/bay/ig;
    
    # Abkuerzung von Worten
    $text =~ s/\ba[mn]\b/a/ig;
    $text =~ s/\bauf\b/a/ig;
    $text =~ s/\bde[mnr]\b/d/ig;
    $text =~ s/\bAltmark\b/Altm/ig;
    $text =~ s/\bAnhalt\b/Anh/ig;
    $text =~ s/\bbei\b/b/ig;
    $text =~ s/\bBayern\b/Bay/ig;
    $text =~ s/\bDithmarschen\b/Dithm/ig;
    $text =~ s/\bFränkische\b/Fränk/ig;
    $text =~ s/\bGemeinde\b/Gem/ig;
    $text =~ s/\bHessen\b/Hes/ig;
    $text =~ s/\bHohenzollern\b/Hohenz/ig;
    $text =~ s/\bHolstein\b/Holst/ig;
    $text =~ s/\bHerzogtum\b/Hzgt/ig;
    $text =~ s/\bi[mn]\b/i/ig;
    $text =~ s/\bKreis\b/Kr/ig;
    $text =~ s/\bKyffhäuser\b/Kyffh/ig;
    $text =~ s/\bLauenburg\b/Lauenb/ig;
    $text =~ s/\bMecklenburg\b/Meckl/ig;
    $text =~ s/\bNiedersachs\b/Niedersachs/ig;
    $text =~ s/\bNiederlausitz\b/NL/ig;
    $text =~ s/\bNordbahn\b/Nordb/ig;
    $text =~ s/\bOberpfalz\b/Oberpf/ig;
    $text =~ s/\bOdw\b/Odenw/ig;
    $text =~ s/\bOberlausitz\b/OL/ig;
    $text =~ s/\bOldenburg\b/Oldb/ig;
    $text =~ s/\bPrignitz\b/Prign/ig;
    $text =~ s/\bRheinhessen\b/Rheinhes/ig;
    $text =~ s/\bSachsen\b/Sachs/ig;
    $text =~ s/\bAnhalt\b/Anh/ig;
    $text =~ s/\bSächsische\b/Sächs/ig;
    $text =~ s/\bSchwaben\b/Schwab/ig;
    $text =~ s/\bSchwäbische\b/Schäb/ig;
    $text =~ s/\bSan[ck]t\b/St/ig;
    $text =~ s/\bThüringen\b/Thür/ig;
    $text =~ s/\bUckermark\b/Uckerm/ig;
    $text =~ s/\bUntermark\b/Unterm/ig;
    $text =~ s/\bvor[m]?\b/v/ig;
    $text =~ s/\bwald\b/W/ig;
    $text =~ s/\bWestfalen\b/Westf/ig;
    $text =~ s/\bWürttemberg\b/Württ/ig;

    # entferne Punkte nach einer Abkuerzung
    $text =~ s/(\w)\.$/\1/;
    $text =~ s/(\w)\.\s/\1 /g;

    return ($text);
}

1;

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.