Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.emacs Subject: Re: ALL CAPS-->Mixed case converter? Message-ID: <9467@jpl-devvax.JPL.NASA.GOV> Date: 11 Sep 90 19:48:14 GMT References: <3245@nems.dt.navy.mil> <1990Sep11.185353.26919@tc.fluke.COM> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 207 Here's what Peter Yee uses to translate the NASA articles he posts. No doubt he has a more up-to-date exception list by now. Larry Wall lwall@jpl-devvax.jpl.nasa.gov #!/bin/sh : make a subdirectory, cd to it, and run this through sh. echo 'If this kit is complete, "End of kit" will echo at the end' echo Extracting unuc sed >unuc <<'!STUFFY!FUNK!' -e 's/X//' X#!/usr/bin/perl X Xprint STDERR "Loading proper nouns...\n"; Xopen(DICT,"/usr/dict/words") || die "Can't find /usr/dict/words: $!\n"; Xwhile () { X if (/^[A-Z]/) { X chop; X ($lower = $_) =~ y/A-Z/a-z/; X $proper{$lower} = $_; X } X} Xclose DICT; Xprint STDERR "Loading exceptions...\n"; X Xopen(PATS,"unuc.pats") || die "Can't find unuc.pats: $!\n"; X X$prog = <<'EOT'; Xwhile (<>) { X next if /[a-z]/; X y/A-Z/a-z/; X s/(\w+)/$proper{$1} ? $proper{$1} : $1/eg; X s/^(\s*)([a-z])/$1 . (($tmp = $2) =~ y:a-z:A-Z:,$tmp)/e; X s/([-.?!]["']?(\n\s*| \s*)["']?)([a-z])/$1 . (($tmp = $3) =~ y:a-z:A-Z:,$tmp)/eg; X s/\b([b-df-hj-np-tv-xz]+)\b/(($tmp = $1) =~ y:a-z:A-Z:,$tmp)/eg; X s/([a-z])'([SDT])\b/$1 . "'" . (($tmp = $2) =~ y:A-Z:a-z:,$tmp)/eg; XEOT Xwhile () { X chop; X next if /^$/; X next if /^#/; X if (! /;$/) { X $foo = $_; X $foo =~ y/A-Z/a-z/; X print STDERR "Dup $_\n" if $proper{$foo}; X $foo =~ s/([^\w ])/\\$1/g; X $foo =~ s/ /(\\s+)/g; X $foo = "\\b" . $foo if $foo =~ /^\w/; X $foo .= "\\b" if $foo =~ /\w$/; X $i = 0; X ($bar = $_) =~ s/ /'$' . ++$i/eg; X $_ = "s/$foo/$bar/gi;"; X } X $prog .= ' ' . $_ . "\n"; X} Xclose PATS; X$prog .= "}\ncontinue {\n print;\n}\n"; X X$/ = ''; X#print $prog; Xeval $prog; die $@ if $@; !STUFFY!FUNK! echo Extracting unuc.pats sed >unuc.pats <<'!STUFFY!FUNK!' -e 's/X//' XA.M. XAir Force XAir Force Base XAir Force Station XAmerican XApr. XAriane XAug. XAugust XBureau of Labor Statistics XCIT XCaltech XCape Canaveral XChallenger XChina XCorporation XCrippen XDaily News in Brief XDaniel Quayle XDec. XDiscovery XEdwards XEndeavour XFeb. XFord Aerospace XFri. XGeneral Dynamics XGeorge Bush XHeadline News XHOTOL XI XII XIII XIV XIX XInstitute of Technology XJPL XJan. XJul. XJun. XKennedy Space Center XLDEF XLong Duration Exposure Facility XLong March XMar. XMarch XMartin XMartin Marietta XMercury XMon. Xin May Xs/\bmay (\d)/May $1/g; Xs/\boffice of (\w)/'Office of ' . (($tmp = $1) =~ y:a-z:A-Z:,$tmp)/eg; XNational Science Foundation XNASA Select XNew Mexico XNov. XOMB XOct. XOffice of Management and Budget XPresident XPresident Bush XRichard Truly XRocketdyne XRussian XRussians XSat. XSep. XSoviet XSoviet Union XSoviets XSpace Shuttle XSun. XThu. XTue. XU.S. XUnion of Soviet Socialist Republics XUnited States XVI XVII XVIII XVice President XVice President Quayle XWed. XWhite Sands XKaman Aerospace XAerospace Daily XAviation Week XSpace Technology XWashington Post XLos Angeles Times XNew York Times XAerospace Industries Association Xpresident of XJohnson Space Center XSpace Services XInc. XCo. XHughes Aircraft XCompany XOrbital Sciences XSwedish Space XArnauld XNicogosian XMagellan XGalileo XMir XJet Propulsion Laboratory XUniversity XDepartment of Defense XOrbital Science XOMS XUnited Press International XUnited Press XUPI XAssociated Press XAP XCable News Network XCape York XZenit XSYNCOM XEastern XWestern XTest Range XJcsat XJapanese Satellite Communications XDefence Ministry XDefense Ministry XSkynet XFixed Service Structure XLaunch Processing System XAsiasat XLaunch Control Center XEarth XCNES XGlavkosmos XPacific XAtlantic !STUFFY!FUNK! echo "" echo "End of kit" : I do not append .signature, but someone might mail this. exit