Disambiguation chooses weird objects(?)

I’m new to Inform 7 but have been experimenting quite a bit in the last few days and have made some progress.

However, I’ve run up against an annoying problem which feels like it should be fairly simple to solve, but I have not managed so far…

[code]Lab is a room.
In lab is a container called mug.
A pool is fixed in place in the lab.
The floor is fixed in place in the lab.

The player carries a plate. The plate is a supporter.

Filling it from is an action applying to two things. Understand “fill [something] from [something]” as filling it from.

Does the player mean filling the plate from the pool:it is very unlikely.
Does the player mean filling the noun from the noun:it is very unlikely.

Does the player mean filling the mug from the pool:it is very likely.

This produces the following result:

I would have thought the “Does the player mean” rules would have made the parser prefer the mug before the plate, but it seems the fact that player is carrying only one thing (the plate) overrides all attempts to get it to choose something else.
Carrying more than one object gives “What do you want to fill?” instead, which is what I would want in the first case also.
Defaulting to an object just because it is the one and only object the player carries seems a bit weird when there are other candidate objects in the room (maybe it’s a bug?)

As a workaround I tried this:

Liquid source is a kind of thing. The pool is a liquid source.
Filling it from is an action applying to two things. Understand "fill [container] from [liquid source]" as filling it from.

This produces:

Which is all well and good, but apparently that affects how the player’s command is parsed, so now this happens instead:

>fill plate from pool You can't see any such thing.
…which isn’t true since both plate and pool are visible…and since it seems to happen during parsing it can’t be affected by any Before or Check rules, if I understand things correctly.

Any ideas or pointers? I’ve been through the manual and searched the web, but all I can find is that disambiguation is pretty tricky territory…


“Does the player mean” statements deal with situations where the player types something which the parser might otherwise interpret as having more than one possible meaning. For a situation where the player does not type a word and you want the parser to infer it, I think you want to use rules for supplying a missing nouun or (in this case) a missing second noun. I think these are covered in the documentation under activities.

Robert Rothman

This is a very tricky case for lots of reasons. Here’s the first thing I see:

At a glance, you’ve given the action the name ‘filling it from’.

When you say:

‘Does the player mean filling the plate from the pool:’

The catch here is, Inform can’t actually extrapolate from the name of your action to work out other grammar. That’s to say, a ‘does the player mean’ line is going to have to quote the exact name of the action for it to be understood. Since the object to be filled is the first [something], to check if the player was trying to fill the pool when the action name is ‘filling it from’ you’d say:

Does the player mean filling it from pool.

which is obviously darn confusing to the eye, given the pool is the thing they’re trying to fill, not the object they’re trying to fill it with. But that’s just a consequence of the name of the action being ‘filling it from’.

So I think that all of your ‘does the player’ mean lines are not doing what you think they’re doing atm.

My next problem is a personal one - I don’t know myself how to write a ‘Does the player mean’ line which involves two objects :slight_smile: (EG pool and the plate). So, uh, I’ll wait for someone who knows more to chip in.

No, Inform handles that fine. All three rules wind up in the “does the player mean…” rulebook. You can see this in the Index, Rules tab.

Unfortunately, I think this is a case where Inform’s prejudice towards held objects overrides the rulebook.

No. Those activities would apply if you added the lines

Understand "fill" as filling it from.
Understand "fill [something]" as filling it from.

…that is, if the Understand line has fewer arguments than the action. That’s not the case here.

Bleh. So ignore most of what I said, original poster.

To zarf, where does Inform get the grammar from? Does it just try adding ‘ing’ to ‘fill(add ing here) [something] from [something]’? Or what? It seems like kinda smart behaviour in an area where there could be all kinds of grammar.

The action name is “filling it from”, with two arguments. The compiler knows that “it” is a special word, so it recognizes “filling __ from __” as the actual action template. That allows you to write “Check filling X from Y”, or “Does the player mean filling X from Y”, and so on.

Understand lines are not involved in this process.


Thanks for the replies.

As Zarf says, the “Does the player mean” rules do have some effect but they are not enough to make the parser guess the mug on the floor over a single carried object.

I found the way to write rules for substituting missing nouns (Section 17.30 in the manual, thanks for pointing the way Robert):

[code]Filling it from is an action applying to two things.
Understand “fill [something] from [something]” as filling it from.
Understand “fill [something]” as filling it from.
Understand “fill” as filling it from.

Rule for supplying a missing noun when filling:
now the noun is mug;

Rule for supplying a missing second noun when filling something from:
now the second noun is pool;

Carry out filling something from something:
say “Filling [the noun] from [the second noun]”;[/code]

This produces the following:

So that works if we want to force the use of certain objects if the nouns are missing…

BUT what I’m still wondering is this:

If you are carrying only one thing, the default behavior of the parser seems to be to guess that this object is the missing noun.
If you hold more than one object it will ask “What do you want to fill?”.

Ideally I would want to tell the parser something like:
“For the fill from it command, if there are nouns missing, do not guess, always ask.”, or perhaps

Rule for supplying a missing noun when filling: ask the player for a noun; <---- Is there something I can put here that will have that effect?

But I have yet to find a way to intercept, modify or trigger the “What do you want to…” question. Is that possible?

I know you can do some intercepting of the “which do you mean” question by “Before asking which do you mean:”, but I have not found anything like this for “What do you want to…”.


I’m not sure if this will help, but there is a extension called “Disambiguation Control” (I think it’s by Jon Ingold – apologies to the author if I’m wrong on that) which you might want to look into to see if it allows you to force the machine to ask rather than trying to guess.

Robert Rothman

There are large parts of the parser that are not accessible to I7. Before the “Does the player mean” rulebook can run, I6 eliminates lots of options from the disambiguation, with no way to alter the process in I7. It’s a long-term goal of mine to expose more of the process to I7.

Yes, please.


I’m not making any promises, and my intent should not be construed as an excuse for someone else not to do it… :stuck_out_tongue:




:laughing: :laughing:

Hey! I’m only about half finished with my WIP after almost a year, and I have a job too!

These problems are exactly what Disambiguation Control was engineered to resolve - things like the parser’s tendency to choose carried objects over non-carried ones, for some verbs; and the way that a “Does the player mean doing something with the polish” will, while allowing >TAKE POLISH not to pick up the Polish gentleman, also cause >TAKE to default to the polish, every time, including when you’re holding it.

Sounds interesting, I’ll look into that, thanks.