Number agreement in verb and noun

This is turning out to be trickier than I expected. I’m trying to come up with a system where the indefinite article can indicate a collection, thus turning a plural-named thing into a singular-named thing temporarily. I want it to be flexible so that the indefinite article can change (e.g. with Crowds, where it might be “some” one time and “a big crowd of” another time).

Suppose I tried something like this:

[code]Include Plurality by Emily Short.

Mall is a room.

A thing can be collectively-named.
The collective item is an object that varies.

When play begins: restore plurality to collectives.
After reading a command: restore plurality to collectives.

To restore plurality to collectives:
Now every collectively-named thing is plural-named;
Now every collectively-named thing is not collectively-named;
Now the collective item is nothing.

The shoppers are a plural-named person in Mall. The indefinite article of shoppers is “a [collective]crowd of”

To say collective:
restore plurality to collectives;
Now the item described is collectively-named;
Now the collective item is the item described;

Before printing the name of a collectively-named thing (called the set):
if the set is not the collective item, restore plurality to collectives;
otherwise now the set is singular-named.

For writing a paragraph about a person (called the NPC): say “[An NPC] [is-are] here.”

Instead of examining a person: say “[The noun] [is-are] wandering around aimlessly.”

test me with “x shoppers”[/code]

This is kind of ugly, but it works in this limited case. I’m not sure how I’d manage this one:

say "There [is-are for the item described] [an item described] here."

Any ideas?

You can write something like this:

To say is-are for the shoppers:

But that’s even uglier.

I’ve been messing around with this, and rolled my ideas into an extension I was using for “infinite” numbers:

eyeballsun.org/i/Approximate%20Numbers.i7x

I borrowed heavily from Plurality, to extend the concept of “ambiguously plural.” Now the ambiguously plural property combines with the plural-named property for more nuance. An ambiguously plural thing will still be treated as singular if it’s referred to using the definite object. But you can make it plural-named if you want that. The choice is between:

indefinite article: “a murder of” + plural-named noun: “crows”

and:

indefinite article: “a” + singular-named noun: “murder of crows”

I ended up needing three new variables: The current naming style, the collectively named noun, and pending naming override. The current naming style says whether we are going to treat an object as singular in the text. The collectively named noun says what that object is, and the pending naming override is a truth state that keeps track of whether we’ve actually said that object’s name yet. It’s needed so we can declare that something will be collective before we’ve actually said what it is, and then after we’re done with it, we know to go back to treating it normally.

This handled the normal indefinite article case pretty neatly, but I still had to do some hacking for the case where the verb comes first. In that case we have to assume that all ambiguously plural nouns should be treated as singular.

In all cases, I assume that ordinarily enumerated plural-named things always have plural verbs, even if the “[collective]” phrase is invoked.

[code]Book - Collective Plurality

Section - Resolving Ambiguous Plurality

Plurality style is a kind of value. The plurality styles are normal, collective, and truly plural.

The current naming style is a plurality style that varies. The collectively named noun is an object that varies. Pending naming override is a truth state that varies.

After reading a command: reset the plurality style to normal.

To reset the plurality style to (new style - a plurality style):
Now the collectively named noun is nothing;
Unless the new style is normal, now pending naming override is true;
Now the current naming style is the new style.

To say normal plurality style: reset the plurality style to normal;

To say collective: reset the plurality style to collective;

To say truly plural: reset the plurality style to truly plural;

To update plurality of (target - a thing):
now the prior named noun is the target;
if pending naming override is true, now the collectively named noun is the target;

After printing the name of an object (this is the naming is no longer pending rule):
If pending naming override is false, reset the plurality style to normal;
Now pending naming override is false.

Section - Tracking Last Item (in place of Section 1 - Tracking Last Item in Plurality by Emily Short)

[unchanged text omitted]

After printing the name of something (called the target) (this is the notice plurality of printed object rule):
mark target in output.

The notice plurality of printed object rule is listed before the naming is no longer pending rule in the after printing the name rulebook.

To mark (target - a thing) in output:
update plurality of the target;
if the target acts plural or target is the player, mark-future-plural;
otherwise mark-future-singular;

To decide whether (item - an object) acts plural:
if the collectively named noun is not the prior named noun, now the collectively named noun is nothing;
if the item is the collectively named noun and the item is ambiguously plural:
if the current naming style is collective, no;
if the current naming style is truly plural, yes;
if the item is plural-named, yes;
no.

Section - Verbs (in place of Section 2 - Verbs in Plurality by Emily Short)

To say is-are of (item - a thing):
update plurality of item;
if prior named noun acts plural or the prior named noun is the player, say “are”; otherwise say “is”.

To say is-are a/an (item - a thing):
say “[collective][is-are of item] [an item]”;

To say Is-are of (item - a thing):
update plurality of the item;
if prior named noun acts plural or the prior named noun is the player, say “Are”; otherwise say “Is”.

[For some reason putting an a/an alternation in this phrase causes the lowercase phrase to be clobbered]

To say Is-are an (item - a thing):
say “[collective][Is-are of item] [an item]”;

To say Is-are a (item - a thing):
say Is-are an item;[/code]

It’s late for me to absorb much, but,

Custom Library Messages contains the line: The built-in S-substitution's decision variable translates into I6 as "say__n". That I6 variable controls the say-phrase [s] which goes on the end of a noun, and is used by the printing plural of and the printing a number of activities to, upon saying a number or some other thing to inflect the noun, carries the information forward so the [s] can use it.

Plurality and CLM both “mark (item) in output” to remember the recently-said noun, again to carry the information forward so later substitutions can work on it.

I’m unsure if I understand your puzzle correctly, but if someone asked me to create some code which the indefinite article could change the plural/singular of its noun, I might be inclined to use a pair of rules, one Before the Printing the Name activity and one After, with the same When condition so that the second can “fix” what the first has done. It’s more or less what your original code does, I think, although I prefer the parallelism of the Before & After rules.

I’d also find some way to use the built-in variables that carry forward plurality information, say__n, rather than declaring my own globals.

That’s about all the insight I have at this hour. I hope it’s, if not useful, then at least coherent.

Hrm, so is there a way to do this so the verb agrees with a noun that hasn’t been said yet? Say if I wanted to say “In the [noun] is-are [a list of items in the noun].” and have the is-are agree with the number of the list of items? Apologies if this is somehow standard behavior.

This is standard behavior, but you’ve got the brackets wrong:“In [the noun] [is-are a list of items in the noun].” See ch.5.5.

The problem I have is that the indefinite article I’m using can change. I want to say

But,

I think I’ve more or less worked this out. The Approximate Quantities extension I’m working on uses tables like the ones in Emily Short’s Assorted Text Generation, except that I’ve added an extra column for plurality style. I think I can create a phrase like:

[code]To say is-are approximately (N - a number):
say is-are approximately N using Table of Numerical Approximation.

To say is-are approximately (N - a number) using (T - a table-name):
Repeat through T:
if N is less than the threshold entry:
set the plurality style to the style entry;
say “[is-are] [approximation entry]”;
stop;[/code]

Ah thanks! I was a bit fuzzy when typing this in, but in the code I was using I had [is-are] in separate brackets, which wasn’t working.