Skip to content

Parser cannot hear a prepositional phrase as a noun postmodifier #40

Description

@gitosaurus

This is an enhancement, not a defect. Nothing is broken that needs this. The
reason to write it down is that the reasoning took a while to arrive at and is
easy to lose.

The observation

In push button on hopper, the player does not mean "push the button onto the
hopper." They mean the button which is on the hopper — the prepositional
phrase postmodifies the noun, and identifies which button is meant. It is a
relative clause with the pronoun and copula dropped.

Archetype's convention makes every preposition part of the verb message
(verbmsg := verb & "..." & prep, intrptr.arch), which flattens two different
grammatical roles into one shape:

utterance "on"/"at" is flattened to
push button on hopper postmodifier on button push...on
throw rock at guard argument of throw throw...at

Only the second is really a verb-and-preposition. The first is a noun phrase
that happens to contain a preposition.

Why it cannot be expressed today

The natural author-side answer would be to declare the phrase as a name:

object button
  desc : "big red button"
  syn  : "button on hopper|button"

That does not work, and cannot. 'ASSEMBLE VOCABULARY' registers every lex
all the prepositions — in verb mode (intrptr.arch:356-357), and
SystemParser::parse runs matchVerbs_ before matchNouns_. By the time noun
matching runs, the word list is:

[ Verb(push), "button", lex(on), "hopper" ]

The declared three-word phrase is compared against a list in which on is no
longer the string "on" but an object reference, so it can never match. The
name is unreachable however it is declared. Verified empirically.

What a fix would look like

Give the noun matcher a shot at the raw words before verb matching claims the
prepositions: a pre-pass over nounMatches_ restricted to declared phrases of
two or more words, run ahead of matchVerbs_, leaving single-word nouns where
they are. nounMatches_ is already sorted longest-phrase-first, so the ordering
machinery exists.

The risk is a declared noun phrase swallowing a word a verb needed. bare.arch
declares syn : 'push down|push on' as verb phrases, so the cases that would
want tests are the verb phrases that contain prepositions: jump over,
put...in, push on.

The payoff is that an author could deliberately say "button on hopper" and be
understood, rather than relying on recovery after the fact.

Relationship to the fallback already in place

PR for push button on hopper adds a rung to the dispatch ladder: when the game
declares no Verb for the verb-and-preposition pair, the subject is asked about
the bare verb before any generic default. That is a recovery heuristic and it is
deliberately not this. It makes push...on fall back to push, which is
defensible on its own terms — if the game has no notion of the pair, the
preposition was probably never the verb's business. But it does not teach the
parser anything, and it cannot distinguish the two rows of the table above.

The two are complements, not alternatives. The ladder is a reasonable floor even
if this never gets built.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions