Correctly parsing "light light light"

That’s correct.

The answer is that if the player types ‘take a string’ it is interpreted as ‘take one string’, the ‘a’ being treated as an article and stripped away while invoking ‘indefinite mode’ and not parsed as part of a name. However, if the player types ‘take a’ the ‘a’ is matched as part of the name of the ‘A string’

That’s a valid point of view. But one the Inform parser deliberately eschews- instead it leans hard toward making a guess on the player’s behalf when not in definite mode, assuming that if the player has deliberately indicated a vague object specification it should really try to fulfil the command.

You’re right. I just tested it using this code:

"A String Test"

The Practice Room is a room.

A string is a kind of thing. Understand "string" as a string.

The G string, the D string, and the E string are strings.

The A-string is a string with printed name "A string". Understand "a" as the A-string.

The violin is a thing in the Practice Room. The G string, the D string, the E string, and the A-string are part of the violin.
The description of the violin is "A violin with four strings, tuned to G, D, A, and E."

To allow the player to call the A string “a string”, I suppose you’d have to manipulate the player’s command to change all instances of “a string” to “a-string”.

Or purge the internal handling of “a” as an article; I don’t think anyone would miss it.

Interesting. This demonstrates the difficulties of not confusing the compiler in the source code when creating an object with a name starting with ‘a’.

The following also works to create an A string whose internal name is also actually ‘A string’:

"A String Test"

The Practice Room is a room.

A string is a kind of thing. Understand "string" as a string.

The G string, the D string, and the E string are strings.

There is a string called a A string. [Because 'The A string is a string' doesn't work (being interpreted by the compiler as 'a string is a string'), although 'The A string is in the Lab' or 'The A string is a violin-string' do. Also, not '... called the A string', since this creates the object with indefinite article 'the'. Furthermore 'There is an A string' works if 'string' is not also a kind name.]

The violin is a thing in the Practice Room.

Every string is a part of the violin. [Because 'The A string is part of the violin.' and similar don't work when 'string' is also a kind name, being interpreted by the compiler as 'at least one string is part of the violin']

The description of the violin is "A violin with four strings, tuned to G, D, A, and E."

EDIT: The best strategy is probably to name the kind ‘violin-string’- in which case everything goes smoothly (although ‘violin string’ also seems to work):

The Practice Room is a room.

A  violin-string is a kind of thing.

A violin-string is a kind of thing. Understand "string" or "violin string" as a violin-string. Understand "strings" or "violin strings" as the plural of violin-string.

The A string, G string, D string, and E string are violin-strings.

The violin is a thing in the Practice Room. The A string, G string, D string, and E string are parts of the violin.

The description of the violin is "A violin with four strings, tuned to G, D, A, and E."

That’s the least messy solution, I think.

There’s a reason the chimes in Hadean Lands are tuned B, F sharp, G flat, and H.

I’ve been thinking about this question since last week, and just wrote up my thoughts:

Zarf Updates: Parser IF disambiguation hassles

@zarf 's musings prompted me to consider a cunning strategy for a situation where the name(s) of one object is/are a subset of another object, e.g. in the example below some snow and a snow shovel (which after ‘take snow’ would ordinarily result in ‘Which do you mean, the snow or the snow shovel?’, which is unresolvable in favour of the snow by anything the player can type).*

"Shovelling Snow" by PB

Shoveling it with is an action applying to two things.
Understand "shovel [something] with [something]" as shoveling it with.

The Sidewalk is a room. "The blizzard has mostly passed, but the sidewalk is a mess. Get to work."

Some snow is in the Sidewalk.
The snow shovel is in the Sidewalk.

The strategy is to create a ‘hidden synonym’ for the snow and prompt the player with that in the case of a disambiguation question:

Understand "itself" as the snow.
After printing the name of the snow while asking which do you mean: say " itself".

after which:

You can see some snow and a snow shovel here.

>take snow
Which do you mean, the snow itself or the snow shovel?

>itself
Taken.

>i
You are carrying:
some snow

EDIT:

*small print Actually not absolutely true in this instance, because the player can type ‘some’ or ‘some snow’ in response to the disambiguation question, in which case the snow scores 1 point higher than the snow shovel in disambiguation because the snow object has the correct GNA (gender,number,animation) characteristics implied by the article ‘some’, i.e. it is plural-named.

*even smaller print This also may not be absolutely strictly true if the player types ‘a’ or ‘a snow’ or ‘one’ or ‘one snow’, in which case the parser will choose a single object matching ‘snow’, specifically the first one in scope that it encounters in a search of the object tree, and if that happens to be the snow rather than the snow shovel, that’s what will be picked-

You can see some snow and a snow shovel here.

>take snow
Which do you mean, the snow or the snow shovel?

>a snow
(the snow)
Taken.

but less felicitously:

You can see a snow shovel and some snow here.

>take snow
Which do you mean, the snow or the snow shovel?

>a snow
(the snow shovel)
Taken.

(in this second instance, the snow shovel gets picked because it is the eldest child of the Sidewalk in the object tree, as evidenced by the fact that it is listed ahead of the snow in the room description listing of nondescript items)

This should work great and requires zero parser hacking. Well spotted.

Also clever, but I’ll credit that one to Graham. :)

That’s a great post!

You don’t have to specify KNIFE. There’s only one rusty object in the room, so the command works, no noun required. This isn’t a critical feature, but it’s nice.

OTOH, explicitly require the players to have to specify nouns will cut down on the number of variations you have to deal with.

So you have to decide, nice for the players, or nice to the authors? Since I don’t see the point of having that kind of capability, I’d be nice to the authors.

TAKE SNOW
You don’t see any snow here, just a snow shovel. Type “take shovel” if you want the shovel.

Conversely, I’d say barring odd exceptions like Cragne Manor, every game has more players than it does authors.

his is a reply to @Zarf thread on his blog (and also to here somewhat). Im not on Mastodon;

  1. “of” is never part of an object name. that’s retarded.
    cup of coffee is the same as coffee’s cup same as
    X of Y = Y’s X.

    This should be parsed as part of the grammar and resolved. ie the cup that has the coffee.

  2. To handle adjectives you match the last word typed to a noun, then treat all previous words as a bag of adjectives in any order as object filters. Of course these words have to be valid adjectives.

  3. objects have multiple names that may have different adjectives

  4. there is no such thing as synonyms. There are no words that are identical in meaning. instead you have multiple names for objects and verbs reflect onto other verbs, when it makes sense.

consider get pills and take pills. get and take are not the same.

Please don’t describe things this way.

Is a fear of spiders the same as a spider’s fear? (Or, for something you’re more likely to find in a parser game: is Alice’s photo of Bob the same as Bob’s photo of Alice?)

It’s one of the oddities of English: the way of connecting nouns we inherited from Anglo-Saxon doesn’t work quite the same as the way of connecting nouns we borrowed from French. “There are no words that are identical in meaning” is also true for grammatical structures!

In everyday language, it’s true, no words are quite perfectly interchangeable. In your average IF world model, though, “lamp” and “lantern” tend to have exactly the same meaning: that is, “object #137”. There is absolutely no difference between them. And outside of Counterfeit Monkey it’s hard to imagine a reason why the parser should treat “colorful” and “colourful” as meaning different things.

If we want to get philosophical about it, I’d say the “meaning” of a word in a parser IF piece is the set of objects (or actions) it can refer to, so it’s very possible for two words to have exactly the same meaning.