how and when does I7 guess which indirect article to use?

Sorry Matt, I fell asleep watching the Magic game. I don’t even know who won, but don’t tell me — I DVR’d it. :wink:

Okay, so here’s the dealeo: I couldn’t figure out how to get i6 to access the phrases in your I7 code (which should be possible, but whatever) so I took a different tack. I created a global variable accessible to both and used that in the replacement of LanguageContraction. It makes more sense if you see it so, without further ado:[spoiler][code]The Lab is a room.

An animal can be honest or dishonest. Understand the honest property as describing an animal.

When play begins (this is the stupid and should be unnecessary rule):
repeat with A running through animals:
let T be a text;
now T is the printed name of A;
if A is honest:
now the printed name of A is “honest [T]”;
otherwise:
now the printed name of A is “dishonest [T]”.

The unicorn is an animal. It is honest.
The yak is an animal. It is dishonest.

A block is a kind of thing. It has a number called weight. The description of a block is “It looks to be about [weight of the item described in words] pound[s].”
After examining a block (called B):
now the printed name of B is “[weight of B in words] - pound block of [B]”.

The yttrium is a block. The weight is one.

The uniform is wearable. The description is “It’s a United States Army uniform.”
After examining the uniform for the first time:
now the printed name of the uniform is “United States Army uniform”.

A unicorn, a uniform, an hourglass, a yak and yttrium are in the lab.

[Matt’s code - additions noted]

[create a global variable to be called later in i6:]
Current vowel sound is a number that varies. Current vowel sound variable translates into i6 as “vowel_sound”.

Before printing the name of a thing (called x):
let T be a text;
now T is the printed name of x;
now Current vowel sound is T evaluated.
[say Current vowel sound.]

To decide what number is (s - a text) evaluated:
if s starts with a vowel sound:
decide on 1;
decide on 0.

To decide whether (string - a text) starts with a vowel sound (this is vowel sound checking):
let the first word be punctuated word number 1 in string;
if the first word is a word listed in the Table of Words That Start With Vowel Sounds, yes;
if the first word is a word listed in the Table of Words That Don’t Start With Vowel Sounds, no;
if character number 1 in the first word is a vowel, yes;
no.

To decide whether (letter - a text) is a vowel:
if letter exactly matches the regular expression “a|e|i|o|u|A|E|I|O|U”, yes;
no.

Table of Words That Start With Vowel Sounds
word
“hour”
“hourglass”
“honest”
“yttrium”

Table of Words That Don’t Start With Vowel Sounds
word
“uniform”
“unicorn”
“united”
“United”
“one”

[end]

Include (-
Global vowel_sound = 0;
-) after “Definitions.i6t”.

Include (-

Constant LanguageAnimateGender = male;
Constant LanguageInanimateGender = neuter;
Constant LanguageContractionForms = 2; ! English has two:
! 0 = starting with a consonant
! 1 = starting with a vowel
[ LanguageContraction text;

!!! This is the old routine:
!if (text->0 == ’a’ or ’e’ or ’i’ or ’o’ or ’u’
!or ’A’ or ’E’ or ’I’ or ’O’ or ’U’) return 1;
!return 0;
!!! Out w/ old – in w/ new:
if (vowel_sound == 1) return 1;
return 0;
];
Array LanguageArticles →
! Contraction form 0: Contraction form 1:
! Cdef Def Indef Cdef Def Indef
"The " "the " "a " "The " "the " "an " ! Articles 0
"The " "the " "some " "The " "the " "some "; ! Articles 1
! a i
! s p s p
! m f n m f n m f n m f n
Array LanguageGNAsToArticles → 0 0 0 1 1 1 0 0 0 1 1 1;
-) instead of “Articles” in “Language.i6t”.[/code][/spoiler]

Here’s the result:

I had to replace the whole “Articles” section of Language.i6t, but only thing changed is LC (which is actually simpler since it merely uses the value your code calculates). I think this method is minimally invasive and therefore probably safer and more robust. Also, it means that authors using your extension won’t have to worry about the i6 code because they can control everything from I7. It still needs work to generalize things with either / or properties, but it’s a start. :slight_smile:

(P.S. I know one wouldn’t refer to yttrium with a lone indefinite article; I just left it that way to demonstrate that code works as expected.)

EDIT: Oh yeah, I forgot to mention that the output is the same regardless of which machine you compile to – yay!