Plurals & Disambiguation (adv3Lite)

Here’s a tricky little problem. I have a room with several throw-rugs, one of which is important; the others are by way of creating a little less obvious scenario. The throwrugs object is a Fixture, and has as its vocabulary (or rather, as the item in its vocabulary that’s relevant at the moment) only the word ‘rugs’, not ‘rug’ singular. There is also an individual rug, the important one, that is initially hidden, but I set isHidden to nil on it when the throwrugs are examined. This object has only the word ‘rug’ in its vocabulary, not ‘rugs’.

Okay, that’s the setup. Here’s the problem output:

>x rugs
The throw-rugs are a haphazard lot. Most of them lie flat, but one, a russet-colored monstrosity with a lumpy macramé design that might possibly be a lion, is rather rucked up. 

>take rugs
In picking up the rug, you discover that there’s a hole in the floor beneath it — a gap between two of the floorboards. The throw-rugs are fixed in place.

Arrgh! The parser is matching ‘rugs’ against both the individual rug and the throwrugs object. The docs suggest that matchPhrases can be used to correct this kind of misunderstanding, so I tried that on the individual rug:

matchPhrases = ['lion rug', 'rug', 'lumpy rug', 'macrame lion', 'macrame lion rug', 'russet rug']

This should create a situation in which only ‘rug’ should be matched, not ‘rugs’, but it doesn’t work. I still get the output shown above.

I had a look at how the Command object is defined, hoping I could use a Doer to sort this out, but I don’t see a property of Command that lists the single word tokens in the input. There ought to be such a thing somewhere, but I don’t know where it is.

Suggestions would be welcome!

On further reflection, I don’t think a StringPreParser will do it. I managed to make a StringPreParser, but the problem I’m having is upside down with respect to its functionality.

That is, if the input string is ‘take rugs’, what I want to do is prevent the inclusion of the single rug object. And you can’t do that by changing ‘rugs’ to ‘rug’ in the StringPreParser. That’s the opposite of what’s needed. The input ‘take rugs’ should be left intact, and should ONLY apply to the plural rugs object. I don’t see how to do that with StringPreParser.

Possibly outputting some sort of low value for a logical() macro would work. That’s the next thing to try.

…and that doesn’t seem to work either. If I give the throwrugs object a logicalRank(120) for the Take action, now you can take the object, even though it’s a fixture. I can overrule that with a check() routine for Take – but now I’m getting this:

>take rugs
In picking up the rug, you discover that there’s a hole in the floor beneath
it — a gap between two of the floorboards. **throw-rugs:** The throw-rugs
are not something you can take. 

This is even worse, because the parser still thinks ‘rugs’ is a match for the single rug object.

Here is the sum total of what I’ve been able to find so far in the documentation. In LearningT3Lite.pdf, Eric says this:

The library will be quite capable of working out that 'books' is the plural
of 'book' (and it can do this with a lot of irregular plurals too (such as
'men' and 'feet'). So the game will understand perfectly well if the player

You take the red book and the blue book.

This is precisely the behavior that I need to subvert or shut off in one particular room, in response to one particular word (‘rugs’). But I have no idea where in the Mercury parser that feature is implemented.

Solved, thanks to Eric Eve in an email. The key component, for those of you who are waiting with bated breath, is filterResolveList.

1 Like