| 1 | ## -*- Mode: CPerl -*- | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## File: DTA::CAB::Format::Raw::Perl.pm | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Description: Datum parser: raw untokenized text (pure-perl hack) | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | package DTA::CAB::Format::Raw::Perl; | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use DTA::CAB::Format; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use DTA::CAB::Format::Raw::Base; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use DTA::CAB::Datum ':all'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Encode qw(encode decode); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | ## Globals | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | our @ISA = qw(DTA::CAB::Format::Raw::Base); | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | DTA::CAB::Format->registerFormat(name=>__PACKAGE__, short=>'raw-perl', filenameRegex=>qr/\.(?i:raw-perl|txt-perl)$/); | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ## %ABBREVS | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ## + default abbreviations | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ## + set below | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | our (%ABBREVS); | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ## Constructors etc. | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ## $fmt = CLASS_OR_OBJ->new(%args) | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ## + object structure: assumed HASH | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ## { | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ## ##-- Input | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ## doc => $doc, ##-- buffered input document | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ## abbrevs => \%abbrevs, ##-- hash of known abbrevs (default: \%ABBREVS) | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ## ##-- Output | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ## outbuf => $stringBuffer, ##-- buffered output: DISABLED | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ## #level => $formatLevel, ##-- n/a | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ## ##-- Common | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ## utf8 => $bool, | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $that = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $fmt = bless({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ##-- common | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | utf8 => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ##-- input | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | doc => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | abbrevs => \%ABBREVS, | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ##-- output | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | #outbuf => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ##-- user args | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | }, ref($that)||$that); | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return $fmt; | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ## Methods: Persistence | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ## @keys = $class_or_obj->noSaveKeys() | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ## + returns list of keys not to be saved | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ## + default just returns empty list | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub noSaveKeys { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
noSaveKeys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | return (shift->SUPER::noSaveKeys(), qw(doc outbuf)); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ## Methods: Input | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ##-------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ## Methods: Input: Input selection | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ## $fmt = $fmt->close() | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | delete($_[0]{doc}); | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return $_[0]->SUPER::close(@_[1..$#_]); | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ## $fmt = $fmt->fromString( $string) | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ## $fmt = $fmt->fromString(\$string) | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ## + select input from string $string | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub fromString { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fromString: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $fmt = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $fmt->close(); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | return $fmt->parseRawString(ref($_[0]) ? $_[0] : \$_[0]); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ## $fmt = $fmt->fromFh($fh) | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ## + override calls $fmt->fromFh_str() | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub fromFh { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fromFh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | return $_[0]->fromFh_str(@_[1..$#_]); | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ##-------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ## Methods: Input: Local | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ## $fmt = $fmt->parseRawString(\$str) | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ## + guts for fromString(): parse string $str into local document buffer. | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub parseRawString { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parseRawString: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my ($fmt,$src) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | utf8::decode($$src) if ($fmt->{utf8} && !utf8::is_utf8($$src)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$fmt->{"utf8"} and not utf8::is_utf8($$src)
MC/DC0%0/2
$fmt->{"utf8"} and not utf8::is_utf8($$src)
$fmt->{"utf8"}
not utf8::is_utf8($$src)
Truth table0%0/3
A and not(B)
A= $fmt->{"utf8"}B= not utf8::is_utf8($$src)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ##-- step 1: basic tokenization | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my (@toks); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | while ($$src =~ m/( | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | (?:([[:alpha:]_\-\#\@]+)[\-¬](?:\n\s*)([[:alpha:]_\-\#\@]+)) ##-- line-broken alphabetics | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | | (?i:[IVXLCDM\#\@]+\.) ##-- dotted roman numerals (hack) | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | | (?:[[:alpha:]\#\@]\.) ##-- dotted single-letter abbreviations | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | | (?:[[:digit:]\#\@]+[[:alpha:]_\#\@]+) ##-- numbers with optional alphabetic suffixes | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | | (?:[\-\+]?[[:digit:]_\#\@]*[[:digit:]_\,\.\#\@]+) ##-- comma- and\/or dot-separated numbers | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | | (?:\,\,|\`\`|\'\'|\-+|\.\.+|\[Formel\]) ##-- special punctuation sequences | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | | (?:[[:alpha:]_\-¬\#\@]+) ##-- "normal" alphabetics (with "#", "@" ~= unknown) | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | | (?:[[:punct:]]+) ##-- "normal" punctuation characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | | (?:[^[:punct:][:digit:][:space:]]+) ##-- "strange" alaphbetic tokens | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | | (?:\S+) ##-- HACK: anything else | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | /xsg) | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | push(@toks, (defined($2) ? "$2$3" : $1)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | ##-- step 2: abbreviation & eos detection | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $abbrevs = $fmt->{abbrevs}; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $s = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my @sents = ($s); | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my ($toki); | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | for ($toki=0; $toki <= $#toks; $toki++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if (exists($abbrevs->{$toks[$toki]}) && $toki < $#toks && $toks[$toki+1] eq '.') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
exists $$abbrevs{$toks[$toki]} and $toki < $#toks and $toks[$toki + 1] eq "."
exists $$abbrevs{$toks[$toki]} and $toki < $#toks
MC/DC0%0/3
exists $$abbrevs{$toks[$toki]} and $toki < $#toks and $toks[$toki + 1] eq "."
exists $$abbrevs{$toks[$toki]}
$toki < $#toks
$toks[$toki + 1] eq "."
Truth table0%0/4
A and B and C
A= exists $$abbrevs{$toks[$toki]}B= $toki < $#toksC= $toks[$toki + 1] eq "."
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ##-- abbreviation | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | push(@$s, "$toks[$toki]."); | |||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $toki++; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | elsif ($toks[$toki] =~ /^[\.\?\!]+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ##-- sentence-final punctuation | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | push(@$s, $toks[$toki]); | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | push(@sents, $s=[]); | |||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ##-- normal token | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | push(@$s, $toks[$toki]); | |||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | pop(@sents) if (!@{$sents[$#sents]}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ##-- step 3: build doc | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | foreach (@sents) { | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | @$_ = map { {text=>$_} } @$_; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $fmt->{doc} = bless({body=>[map { {tokens=>$_} } @sents]}, 'DTA::CAB::Document'); | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return $fmt; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ##-------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ## Methods: Input: Generic API | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ## $doc = $fmt->parseDocument() | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub parseDocument { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parseDocument: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | return $_[0]{doc}; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ## Methods: Output | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | ## + output not supported | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ##-------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ## Methods: Output: Generic | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ## $type = $fmt->mimeType() | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ## + default returns text/plain | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub mimeType { return 'text/plain'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mimeType: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ## $ext = $fmt->defaultExtension() | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ## + returns default filename extension for this format | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub defaultExtension { return '.raw'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defaultExtension: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ##============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ## Initialization | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ## @ABBREVS: most frequent 128 abbreviations from DTA (as of Wed, 01 Dec 2010 11:26:04 +0100) | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | ## + derived from file ../automata/eqlemma/dta-abbrevs.nontrivial.tfa | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ## - itself derived by hand from ../automata/eqlemma/cab.toka.db, ../automata/words/dta-words.tf | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ## using Lingua::TT hackery and Data::Dumper | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | my @ABBREVS = | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 'Abb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | "Ab\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 'Anm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 'Ann', | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 'Arch', | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 'Art', | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 'Aufl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 'Bd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 'Bde', | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 'Br', | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 'Cap', | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 'Ch', | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 'Chr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 'Co', | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 'Cod', | ||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 'Ctr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | "Di\x{17f}\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 'Dr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 'Ew', | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 'Fig', | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 'Fr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | "Ge\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | "Ge\x{17f}ch", | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 'Gr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 'Hist', | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 'Hr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 'Hrn', | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 'Jahrh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 'Journ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 'Kap', | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 'Kilogr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | "K\x{f6}nigl", | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 'Lib', | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 'Lit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 'Matth', | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 'Mill', | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 'Mr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 'No', | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 'Nov', | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 'Nr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 'Num', | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 'Ol', | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 'Pal', | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 'Pf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 'Pfd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 'Pfr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 'Plut', | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 'Prof', | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 'Proz', | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | "Re\x{17f}cr", | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 'Sal', | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 'Sept', | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 'Sr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 'St', | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 'StGB', | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 'Staatsr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 'Tab', | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 'Taf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 'Th', | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 'Thl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 'Thlr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 'Tit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 'Tom', | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 'Verf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 'Vergl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 'Vgl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 'Vol', | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 'Zeitschr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 'Ziff', | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 'acc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 'adj', | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | "ag\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 'ahd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 'altn', | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | "angel\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 'art', | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 'betr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 'cap', | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 'cit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 'dat', | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 'dergl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 'dgl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 'diss', | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 'ed', | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 'engl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 'eod', | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 'etc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 'fem', | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 'ff', | ||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 'fg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 'fig', | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 'fl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 'fr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 'geb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 'gl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 'goth', | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 'gr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 'griech', | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 'jun', | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 'ker', | ||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 'lat', | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 'lib', | ||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 'lit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 305 | "ma\x{17f}c", | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 'med', | ||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 'mhd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 'min', | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 'nat', | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 'neutr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 'nhd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 'nom', | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 'pag', | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 'part', | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 'pl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 'pr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 'praes', | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 'praet', | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | "prae\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 'resp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 'sing', | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 'tab', | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 'urspr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 'vergl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 'vgl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | "zu\x{17f}", | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | "\x{17f}t", | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | "\x{17f}ub\x{17f}t", | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | "usw", | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | %ABBREVS = map {($_=>undef)} @ABBREVS; | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | 1; ##-- be happy | |||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||