comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: a question of form
Date: Thu, 28 Aug 2014 14:35:36 -0500
Date: 2014-08-28T14:35:36-05:00	[thread overview]
Message-ID: <lto0a9$c23$1@loke.gir.dk> (raw)
In-Reply-To: ltnsdb$jtn$2@dont-email.me

"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:ltnsdb$jtn$2@dont-email.me...
> On 08/28/2014 04:56 AM, G.B. wrote:
>>
>> What will be the most wanted (and least controversial)
>> words for title case exception in English and other natural
>> languages?
>>
>> (I'm collecting them for a patch of Ada mode for Emacs,
>> which makes Good_and_Bad appear automatically.)
>
> In /The Elements of Grammar/ by Margaret Shertzer:
>
> "Capitalize all principal words (that is, nouns, pronouns, adjectives, 
> adverbs,
> verbs, and first words) in titles"
>
> The rule I learned is: Capitalize the first and last word of a title; 
> capitalize
> all other words except articles and short conjunctions and prepositions. 
> "Short"
> is usually defined as less than 4 letters.

That sounds about right.

I just looked at the code for handling title case in the Janus/Ada pretty 
printer. It uses a "minimal perfect hash" for these words, and in general 
seems a heck of a lot more complicated than seems necessary for something 
that requires a maximum of 4 compares per test (all of the words in the list 
are 4 characters or less long).

Anyway, here's the code that creates the list of words:

        Set_Small_Word ("a");
        Set_Small_Word ("an");
        Set_Small_Word ("and");
        Set_Small_Word ("as");
        Set_Small_Word ("at");
        Set_Small_Word ("but");
        Set_Small_Word ("by");
        Set_Small_Word ("for");
        Set_Small_Word ("from");
        Set_Small_Word ("if");
        Set_Small_Word ("in");
        Set_Small_Word ("into");
        Set_Small_Word ("nor");
        Set_Small_Word ("of");
        Set_Small_Word ("on");
        Set_Small_Word ("onto");
        Set_Small_Word ("or");
        Set_Small_Word ("than");
        Set_Small_Word ("the");
        Set_Small_Word ("to");
        Set_Small_Word ("with");

As far as a definitive list is concerned, I suspect that there always are 
going to be grey areas where the choice is not obvious. That's why we stuck 
to a minimal list.

                                              Randy.




  reply	other threads:[~2014-08-28 19:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 20:33 a question of form gdotone
2014-08-25 20:56 ` Simon Clubley
2014-08-25 22:08   ` Ludovic Brenta
2014-08-26  1:06     ` gdotone
2014-08-26  7:04 ` Nasser M. Abbasi
2014-08-26 17:31   ` Jeffrey Carter
2014-08-27  5:00     ` Randy Brukardt
2014-08-27  7:17       ` AdaMagica
2014-08-28 11:56         ` G.B.
2014-08-28 13:23           ` Simon Wright
2014-08-28 14:08             ` G.B.
2014-08-28 19:26             ` Randy Brukardt
2014-08-28 20:19               ` Simon Wright
2014-08-28 20:48                 ` Simon Wright
2014-08-28 18:28           ` Jeffrey Carter
2014-08-28 19:35             ` Randy Brukardt [this message]
2014-08-29 11:55               ` G.B.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox