NounPhraseclass | parser.t[1646] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
This object encompasses a core noun phrase plus all of its qualifiers. Qualifiers can themselves be noun phrases: possessives, locationals, and contents phrases contain subsidiary noun phrases, so we represent these qualifiers with subsidiary NounPhrase objects.
class
NounPhrase : object
NounPhrase
LiteralPhrase
NumberPhrase
TopicPhrase
contPrep
contQual
coreProd
determiner
disambigNameList
errName
errNameProd
exclusions
locQual
locType
matches
objs
ordinal
parent
possQual
prod
pronoun
quantifier
role
tokens
addContents
addExclusionItem
addLiteral
addLocation
addMatches
addOrdinal
addPossessive
addQuantifier
ambigError
applyContQual
applyDisambig
applyExclusion
applyLocational
applyPossessive
buildObjList
clone
construct
contains
disambiguate
expandErrName
isAllEquivalent
isMultiple
matchNameScope
matchVocab
matchVocabPoss
resolveAll
resolveReflexives
selectObjects
contPrep | parser.t[2924] |
contQual | parser.t[2921] |
coreProd | parser.t[2899] |
determiner | parser.t[2937] |
disambigNameList | parser.t[2946] |
errName | parser.t[1696] |
As we successfully resolve qualifiers, we'll expand this to include the qualifying phrases. Any error we find after resolving a qualifier will necessary apply to the qualified form, so we want to include the qualifier in any error message.
For example, if the original phrase is BUCKET OF FISH ON TABLE, we'll start out with the core phrase of BUCKET. We'll next resolve the contents qualifier, OF FISH. Assuming that we find a BUCKET OF FISH, that becomes the new error name. If we then fail to find such an object ON TABLE, we'll be able to report that there's no BUCKET OF FISH on the table. This is better than reporting that we don't see any BUCKET on the table, because there could in fact be a different bucket on the table.
errNameProd | parser.t[1699] |
exclusions | parser.t[2943] |
locQual | parser.t[2911] |
locType | parser.t[2918] |
matches | parser.t[2797] |
objs | parser.t[2804] |
ordinal | parser.t[2934] |
parent | parser.t[2889] |
possQual | parser.t[2908] |
prod | parser.t[2892] |
pronoun | parser.t[2905] |
quantifier | parser.t[2927] |
role | parser.t[2886] |
tokens | parser.t[2902] |
addContents (prep, prod) | parser.t[2817] |
addExclusionItem (prod) | parser.t[2852] |
addLiteral (tok) | parser.t[2807] |
addLocation (locType, prod) | parser.t[2827] |
addMatches (vec, lst, match) | parser.t[1870] |
addOrdinal (num) | parser.t[2846] |
addPossessive (prod) | parser.t[2810] |
addQuantifier (num) | parser.t[2840] |
ambigError (cmd) | parser.t[2436] |
applyContQual ( ) | parser.t[2101] |
applyDisambig (cmd, ambigMatches, nameList) | parser.t[2509] |
applyExclusion (cmd) | parser.t[2168] |
applyLocational ( ) | parser.t[2130] |
applyPossessive ( ) | parser.t[2064] |
buildObjList ( ) | parser.t[2787] |
clone ( ) | parser.t[1659] |
construct (parent, prod) | parser.t[1648] |
contains (np) | parser.t[1734] |
disambiguate (cmd, num, action) | parser.t[2347] |
expandErrName (np) | parser.t[1706] |
isAllEquivalent (matchList) | parser.t[2337] |
isMultiple ( ) | parser.t[2873] |
matchNameScope (cmd, scope) | parser.t[1884] |
matchVocab (cmd) | parser.t[1750] |
matchVocabPoss (cmd) | parser.t[1950] |
Possessive matching has somewhat different rules than for ordinary noun phrases.
First, possessive pronouns (HIS, HER, ITS, THEIR) *can* act like reflexives, in that they can refer back to earlier clauses in the same predicate: ASK BOB ABOUT HIS MOTHER. However, they can also refer to previous commands: SEARCH BOB; TAKE HIS WALLET. The deciding factor is whether or not there's an earlier noun phrase in the command that matches in gender and number; if so, we use the reflexive meaning, otherwise we use the external referent.
Second, the scope for ordinary noun phrases has to be expanded to include the owners of the objects in scope. If we have a wallet that we know belongs to Bob, we should be able to refer to it as "Bob's wallet" whether or not Bob himself is in scope. So, for the purposes of the possessive, Bob is in scope even if he wouldn't be for an ordinary noun phrase.
resolveAll (cmd) | parser.t[2706] |
resolveReflexives (cmd) | parser.t[2751] |
selectObjects (cmd) | parser.t[2219] |
When this is called, we've already filled in the match list with all objects in scope that match the vocabulary of the core noun phrase (including non-reflexive pronouns and ALL), and we've applied any possessive, locational, and exclusion qualifiers. What we're left with is the list of in-scope objects that meet all of the specifications contained in the entire noun phrase. In other words, we've squeezed all available information out of the noun phrase itself. If the result is ambiguous, then, we'll have to look beyond the noun phrase, to the broader semantic content of the overall command.
There are three possible "goals" for what our final object list should look like after disambiguation. Only one goal applies to each particular noun phrase; which it is depends on the grammar of the phrase:
1. Definite mode: TAKE BOOK, TAKE THE BOOK, TAKE BOTH BOOKS, TAKE THE THREE BOOKS. The goal in definite mode is to choose the given number of objects, *and* to make sure that the player could *only* have meant those precise objects. In other words, we're not allowed to make an arbitrary choice: in natural language, the definite mode says that the speaker believes the listener knows which *particular* object or objects the speaker is referring to. If we're not absolutely sure which objects the player is talking about, we have a disagreement with the player's apparent expectations and must ask for clarification.
2. Indefinite mode: TAKE A BOOK, TAKE ANY BOOK, TAKE TWO BOOKS. The goal is to choose the given number of objects from the possible matches, arbitrarily choosing from the available objects.
3. Plural mode: TAKE BOOKS, TAKE THE BOOKS, TAKE ALL BOOKS. The goal here is to choose all of the matching objects.