Disambiguation weirdness

Hello,

I have a set of Control Panels. Each control panel has a button, a dial, and a light that are “part” of the control panel. Those are referenced as Control Panel One’s button, etc.

When i ask the parser to “X BUTTON” it presents a “Do you mean” that is appropriate. i.e. which of these six buttons (or dials or lights) do you mean. Working as expected.

However, when i ask “X PANEL” it prompts with a “Do you mean” with all 6 control panels, all six buttons, all six dials, and all six lights.

any thoughts?
d.

test me with "x button / x dial / x light / x panel".

Color is a kind of value. The colors are nondescript, aqua, crimson, emerald, gray, indigo, khaki, magenta, orange, and quartz. 


Section 3 - Control Room

Control Room is a room. "This is the control room.". 

Section 4 - Control Panels

A control panel is a kind of open container. 
Understand "control/panel" as a control panel.
A control panel is scenery.
A control panel has a color. Understand the color property as describing a control panel.
A control panel has a number called a panel id. Understand the panel id property as describing a control panel.
The description of a control panel is "This is a control panel."

Control Panel One is a control panel in the Control Room. The panel id of Control Panel One is 1. The color of Control Panel One is aqua.
Control Panel Three is a control panel in the Control Room. The panel id of Control Panel Three is 3. The color of Control Panel Three is crimson.
Control Panel Five is a control panel in the Control Room. The panel id of Control Panel Five is 5. The color of Control Panel Five is emerald.
Control Panel Seven is a control panel in the Control Room. The panel id of Control Panel Seven is 7. The color of Control Panel Seven is gray.
Control Panel Nine is a control panel in the Control Room. The panel id of Control Panel Nine is 9. The color of Control Panel Nine is indigo.
Control Panel Eleven is a control panel in the Control Room. The panel id of Control Panel Eleven is 11. The color of Control Panel Eleven is khaki.

Definition: A thing is control-fitted if it is incorporated by a control panel.

[This will allow us to refer to the "corresponding" socket, switch, or indicator; i.e. the one from the same panel. This particular phrase works because there is only ever one each of these in a panel. If we decide later to have, say, three sockets per panel, only this phrase will have to be changed -- using more complex logic -- but the rest of the code could be left as-is.]
To decide what thing is --/the corresponding (name of kind of value K) of --/the (CT - a control-fitted thing):
	let H be the holder of CT;
	decide on a random K that is part of H.[<- there will only ever be one of these]
	
To decide what thing is --/the corresponding (name of kind of value K) of --/the (T - a thing):
	decide on a random K that is part of T.[<- there will only ever be one of these]
	
[The following won't actually give all the panel's components a color property matching the panel, but it will allow us to refer to a "shared color" of these components and get the desired result.]
To decide what color is --/the shared color of --/a/the (CT - a control-fitted thing):
	decide on the color of the holder of CT.

Section 5 - Buttons

T is text that varies. T is "".
when play begins:
	repeat with b running through buttons:
		now the printed name of b is "[an color of the holder of the item described] colored button";

A button is a kind of device.  A button is part of every control panel (called its button). 
A button is usually switched off.
A button is always fixed in place.

The description of a button is "This is the [a color of the holder of the item described] colored button.".

To decide what number is --/the button id of (B - a button):
	decide on the panel id of the holder of B.
	
To decide what color is --/the color of (B - a button):
	decide on the color of the holder of B.

	
Section 6 - Dials

T is text that varies. T is "".
when play begins:
	repeat with d running through dials:
		now the printed name of d is "[an color of the holder of the item described] colored dial";

A dial is a kind of thing. A dial is part of every control panel (called its dial).
Understand "knob" as dial.
A dial is fixed in place.
A dial has a number called a dial setting. 

The description of a dial is "This is the [color of the holder of the item described] colored dial. It is currently set to [dial setting of the item described]. I bet you could SET it to a number.".

To decide if (D - a dial) is properly set:
	if the panel id of the holder of D is the dial setting of D :
		decide yes;
	decide no.
	
To decide what number is --/the dial id of (D - a dial):
	decide on the panel id of the holder of D.
	
To decide what color is --/the color of (D - a dial):
	decide on the color of the holder of D.
	
To decide what number is --/the dial setting of (D - a dial):
	decide on the dial setting of D.
				
Section 7 - Lights

T is text that varies. T is "".
when play begins:
	repeat with l running through lights:
		now the printed name of l is "[an color of the holder of the item described] colored light";

A light is a kind of thing. A light is part of every control panel (called its light).
A light is fixed in place.

The description of a light is "This is the [a printed name of the item described]. The light is [if the corresponding button of the item described is switched on]on[otherwise]off[end if]."

To decide what number is --/the socket id of (L - a light):
	decide on the panel id of the holder of L.
	
To decide what color is --/the color of (L - a light):
	decide on the color of the holder of L.

It’s not a weirdness, but a combinatorial explosion. handling many component details, esp. sharing the same possessive adjective, put considerable strain on the disambiguation, leading to asking for disambiguation between not few components, in your case asking how to disambiguate between 24 different panel/panel’s X.

(I’m still tackling this very coding problem, involving the PC, two major NPC and their portraits, but coded in TADS, so I know close & personal the general problem)

Best regards from Italy,
dott. Piergiorgio.

1 Like

The way that noun matching works, the parser will be looking to see how many words in a row match various objects in the player’s environment (or, more technically, in scope). When one object (or one of a group of undifferentiable objects) gets the highest words-in-a-row score, then by default that will be selected.

The choice is modified somewhat by a set of internal rules that provide small weighting changes depending on certain rules that are not widely understood and not particularly well-documented – the most complete description of them can be found in DM4 (see p. 240), though note that the scoring formula has changed a bit in Inform 7. This set of rules is why, for example, >TAKE COIN will prefer to take a coin “on the ground” in the location instead of one in a jar on a shelf, or one in the player character’s pocket. You can probably safely ignore these.

The choice is modified a lot by DTPM rules, and even one of these overrides all changes in weighting made by internal rules. The important thing to understand about DTPM rules is that they only guide which noun is chosen, not which action. (I think you already understand this.) It’s also important to understand that, if the parser can’t use DTPM rules to narrow things down to a single best candidate, then the DTPM weighting will be thrown out when it starts the asking which do you mean activity.

By default, each word in an object’s “given name” will be matched for that object. In your code, you’re specifiying names for each control panel that include the words 'control' and 'panel'. The word 'panel' alone counts as a partial match, not just for the panels themselves, but, because you’re using assemblies to create associated parts, also count as partial matches to the subparts. (Assemblies create default names that incorporate the generating object’s name, using the pattern that you give. In this case your choice of (called its button) means that you get names like Control Panel One's button, Control Panel Two's button, etc.)

The command >X PANEL doesn’t provide enough information to the parser to differentiate the buttons from the panels.

There are ways to accomplish what I think you want to do, i.e. have the word 'panel' preferably apply to the control panel objects instead of their component parts. If you’re OK with the player needing to access buttons primarily through their color label, e.g. >PRESS AQUA BUTTON instead of >PRESS CONTROL PANEL ONE’S BUTTON, then the easiest solution might be to make the subpart kinds privately-named by default. (You’ll also have to provide some Understand ... as a ... statements or equivalents in that case.) An example:

A dial is a kind of thing. A dial is part of every control panel (called its dial). A dial is usually privately-named.
Understand "knob" or "dial" as a dial.
A dial is fixed in place.
A dial has a number called a dial setting.
A dial has a color. Understand the color property as describing a dial.

When play begins:
	repeat with D running through dials:
		now the color of D is the color of the holder of D. 

which removes the dials from the disambiguation list of >X PANEL.

3 Likes

As an addendum to what otis is saying – If you (OP) want a really simple case showing why every single component part matched the name Control Panel, here is one:

lab is a room.
a dummy is a kind of thing.

A nose is a kind of thing.
A nose is a part of every dummy.

Dummy John is a dummy in lab.
Dummy Glen is a dummy in lab.

Test me with "x dummy".

Make sure you run it, don’t just look at the code :slight_smile:

In this demo’s output, you can see that all the automatically created noses can rbe eferred to by the word ‘dummy’, as it’s in all their names. The equivalent fact was hidden from you in your control panel demo because you changed the printed names of all the control parts before the game booted, but their internal names were already set.

-Wade

2 Likes

Thank you, I understand now.