[1347] in Coldmud discussion meeting

root meeting help first previous next next in chain last in chain last

[COLD] FIX: $english_lib:indef_article(), ColdCore 3.0a9.02

daemon@ATHENA.MIT.EDU (Thu Aug 28 23:34:04 1997 )

From: "Luther, Clay" <clay@selsius.com>
To: "ColdStuff Mailing List (E-mail)" <coldstuff@cold.org>
Date: Thu, 28 Aug 1997 22:25:03 -0500

Here is a fix for the small bug in ColdCore 3.0a9.02

Problem Occurs:

This problem was found while trying to @rename an object.


$english_lib.indef_article() is called to select the proper indefinite
article for "normal" object names.  The method decides whether to return
an "a" or an "an" for the object's new name.

The method calls two other methods, $english_lib.vowel_exception() and
$english_lib.non_vowel_exception(), to catch "an" exceptions in the
English language (for example, you do not say "an unix" or "a hour").
This logic was failing if the new name passed in was more than one word


Since we only care about examining the first word in a multiple word
name for "an" exceptions, the fix is to split off the first word of the
argument passed to the exception routines.  This coercion occurs within
both routines rather than in the calling method, indef_article(), on the
off chance that some other method might also want to call these methods

@program $english_lib.vowel_exception() +access=pub
  arg word;
  var prefix, word1;
  word1 = split(word, "\s+")[1];
  return match_regexp(word1, vowel_exceptions) ? 1 : 0;
  // $#Edited: 28 Aug 97 22:19 $user_cle
  // $#Edited: 28 Aug 97 22:21 $user_cle