> -----Original Message-----
> The only partial solution that I could suggest is to assume 
> that words with no vowels are acronyms. This will work for: 
> PDF, NFL, etc. however it won't work for IBM, SCSI, etc. Not 
> sure if it is really much use, but here is a sample of what I mean:
> 
> if($word =~ /^[^\WAEIOUY]+$/)
> {
>     print "$word: Likely is an acronym.\n"; }
> 
> 
> 
> >I need to take capped section headings and change them into 
> initial or 
> >tital case. I have coding that does this.
> >
> >However, my logic also changes acronym names such as IBM and 
> PDF into 
> >Ibm and Pdf.
> >
> >Is there a way to exempt certain words or configurations of letters 
> >without building a dictionary or lookup table or whitelist?

Just thinking about other rules that might apply.  I would assume that
generally the section headings consist of multiple tokens in uppercase,
whereas an acronym would be a single uppercase token.  Based on that,
perhaps a "Section Heading" is two or more words, of two or more letters
each, in all caps.  That should be a reasonably easy regex to write.  I'd
need to see some examples to flesh it out further, but you might start here:

------------------------------------------------------------
for (<DATA>) {
    if (/\b([A-Z]{2,}\s){1,}([A-Z]{2,})\b/) {
        s/([A-Z]+)/\u\L$1/g;
    }
    print
}
__DATA__
A SAMPLE SECTION HEADING
This is a PDF file about IBM.
IBM, International Business Machines, is a good place to be.
NEXT SECTION
I like IBM (and PDF).
------------------------------------------------------------

YMMV,

Chris


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be 
privileged. It is intended for the addressee(s) only. Access to this E-mail by 
anyone else is unauthorized. If you are not an addressee, any disclosure or 
copying of the contents of this E-mail or any action taken (or not taken) in 
reliance on it is unauthorized and may be unlawful. If you are not an 
addressee, please inform the sender immediately.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to