Commit | Line | Data |
---|---|---|
9f68db38 LW |
1 | #!/usr/bin/perl |
2 | ||
3 | while (<>) { | |
4 | next if /^\./; | |
5 | next if /^From / .. /^$/; | |
6 | next if /^Path: / .. /^$/; | |
7 | s/^\W+//; | |
8 | push(@ary,split(' ')); | |
9 | while ($#ary > 1) { | |
10 | $a = $p; | |
11 | $p = $n; | |
12 | $w = shift(@ary); | |
13 | $n = $num{$w}; | |
14 | if ($n eq '') { | |
15 | push(@word,$w); | |
16 | $n = pack('S',$#word); | |
17 | $num{$w} = $n; | |
18 | } | |
19 | $lookup{$a . $p} .= $n; | |
20 | } | |
21 | } | |
22 | ||
23 | for (;;) { | |
24 | $n = $lookup{$a . $p}; | |
25 | ($foo,$n) = each(lookup) if $n eq ''; | |
26 | $n = substr($n,int(rand(length($n))) & 0177776,2); | |
27 | $a = $p; | |
28 | $p = $n; | |
29 | ($w) = unpack('S',$n); | |
30 | $w = $word[$w]; | |
31 | $col += length($w) + 1; | |
32 | if ($col >= 65) { | |
33 | $col = 0; | |
34 | print "\n"; | |
35 | } | |
36 | else { | |
37 | print ' '; | |
38 | } | |
39 | print $w; | |
40 | if ($w =~ /\.$/) { | |
41 | if (rand() < .1) { | |
42 | print "\n"; | |
43 | $col = 80; | |
44 | } | |
45 | } | |
46 | } |