#!/usr/bin/perl # fix odd question marks in downloaded documents. while (<>) { chomp; # Definite abbreviations s/y\?d/y'd/g; s/n\?t/n't/g; # One word surrounded by question marks - can be done better s/(\s*)\?(\S+)\?(\s*)/$1"$2"$3/g; s/^\?(\S+)\?\s/"$1" /g; s/\s\?(\S+)\?$/ "$1"/g; s/\s\?(\S+)\?([:punct:]*)/ "$1"$2/g; # Might be abbreviations s/ O\?/ O'/g; s/\?d /'d /g; s/\?d$/'d/; s/\?s /'s /g; s/\?s$/'s/; s/\?m /'m /g; s/\?m$/'m/; s/\?t /'t /g; s/\?t$/'t/; s/\?ve /'ve /g; s/\?ve$/'ve/; s/\?ll /'ll /g; s/\?ll$/'ll/; s/\?re /'re /g; s/\?re$/'re/; s/ \? / -- /g; s/ \?$/ --/g; s/^\? /-- /g; # question mark just before punctuation #s/\?([:punct:]*)/"$1/g; # question mark between two words, no spaces s/([:alphanum:]+)\?([:alphanum:]+)/$1 -- $2/g; print "$_\n"; } exit(0);