[conspire] slovenly writing (punctuation, capitalization, ...) (was: Re: Fade and open Neutrals)

Michael Paoli Michael.Paoli at cal.berkeley.edu
Fri Apr 17 02:55:52 PDT 2020


> From: "Rick Moen" <rick at linuxmafia.com>
> Subject: Re: [conspire] Fade and open Neutrals
> Date: Tue, 14 Apr 2020 23:46:51 -0700

> 1.  Slovenly punctuation, e.g., 'dont' and 'tv'.  You know where your
> apostrophe and shift keys are.  It's in your interest to remember to
> use them, because otherwise the impression you give is that you
> don't care whether you are just spewing poorly composed crud in
> public.

Ah, egad, yes, stuff like that makes things difficult/painful/distracting
to (try and) read.

Once upon a time I had a pen-pal ... including in electronic forms.
Though I cared to read their stuff, the writing was very painfully
horrible.  So horrible in fact, that I wrote a program to more-or-less
correct many of the more/most common annoyances in their writing.
Not 100% foolproof(/fool resistant) auto-correct(/mangle) only
goes so far.

Haven't used or looked at that code in years, ... anyway, for the
curious:
$ expand -t 4 < reformat
#!/usr/bin/perl

$^W=1;
use strict;
use Getopt::Long;

#vi(1) se tabstop=4

Getopt::Long::Configure (
     "posix_default", # start with POSIX (compatible) defaults
     "bundling", # then tweak as seems fitting
);

my $help=undef;
my $case=undef;
my $usage=undef;
my $case=undef;

GetOptions (
     "help|h|?" => \$help,
     "case|c" => \$case,
) or die "$0: bad option(s), aborting\n${usage}aborting";

my $usage="usage: $0 [--help|-h|-?] [--case|-c] [file ...]";
my $helptext=<<""
$usage
     --help|-h|-?
         Help - provide some basic usage information, overrides other
         options.
     --case|-c
         also apply case conversions
     file - file(s) to process (defaults to stdin)

;
$usage="$usage\n";

# detabify
$usage=~s/\t/    /og;
$helptext=~s/\t/    /og;

if($help){
     print "$helptext" or
         exit 1;
     exit 0;
};

while(<>){
     chomp;
                                         # generally (there are exceptions)
     s/([.!?])(?![]) .!?]|$)/\1  /go;    # two spaces after sentence end
     s/([,;])(?![]) ,;]|$)/\1 /go;       # space after , or ;
     s/&(?! |&|$)/& /go;                 # space after &
     s/([^ &])&/\1 &/go;                 # space before &
     s/([[:alpha:]][.!?]*)\(/\1 (/go;    # space before (
     s/\)([[:alpha:]])/) \1/go;          # space after )
     s/( |^|^~)(i)(m)(?=[.!? ]|$)/\1\2'\3/igo;   # im --> i'm
     s/( |^|^~)(don)(t)(?=[.!? ]|$)/\1\2'\3/igo; # dont --> don't

     if($case){
                                         # if we're doing case conversions ...
                                         # generally (there are exceptions)
         s/[[:upper:]]/\l$&/go;                      # to lowercase
         s/(^|[.!?] +)[[:lower:]]/\U$&/go;           # sentence start upper
         s/( |^|^~)i(?=[.!? ]|$)/\1I/go;             # i --> I
         s/( |^|^~)i'(ll|m|ve)(?=[.!? ]|$)/\1I'\2/go;# i'll/i'm/i've  
--> I'll/I'm/I've
     };

     print "$_\n";
};
$




More information about the conspire mailing list