CommandRankingclass | parser.t[6099] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
This class is generally not instantiated by client code - instead, clients use the sortByRanking() class method to rank a list of production matches.
class
CommandRanking : ResolveResults
CommandRanking
ResolveResults
object
CommandRanking
DisambigRanking
MissingObjectRanking
OopsResults
actorSpecifiedCount
allExcludedCount
allowActionRemapping
ambigCount
commandCount
emptyButCount
endAdjCount
indefiniteCount
inSingleObjSlot
insufficientCount
inTopicSlot
listForSingle
literalLength
match
miscWordListCount
missingCount
nonMatchCount
nonMatchPossCount
nounSlotCount
pluralTruncCount
pronounCount
rankingCriteria
tokCount
truncCount
unknownWordCount
unwantedPluralCount
vocabNonMatchCount
weaknessLevel
allNotAllowed
ambiguousNounPhrase
askMissingObject
beginSingleObjSlot
beginTopicSlot
calcRanking
compareRanking
construct
emptyNounPhrase
endSingleObjSlot
endTopicSlot
getImpliedObject
incCommandCount
insufficientQuantity
noMatch
noMatchForAll
noMatchForAllBut
noMatchForListBut
noMatchForLocation
noMatchForPossessive
noMatchForPronoun
noMatchPossessive
noteActorSpecified
noteAdjEnding
noteBadPrep
noteEmptyBut
noteIndefinite
noteLiteral
noteMatches
noteMiscWordList
noteNounSlots
notePlural
notePronoun
noteWeakPhrasing
nothingInLocation
noVocabMatch
reflexiveNotAllowed
singleObjectRequired
sortByRanking
uniqueObjectRequired
unknownNounPhrase
wrongReflexive
zeroQuantity
actorSpecifiedCount | parser.t[6384] |
allExcludedCount | parser.t[6357] |
allowActionRemapping | parser.t[6714] |
ambigCount | parser.t[6378] |
commandCount | parser.t[6381] |
emptyButCount | parser.t[6354] |
endAdjCount | parser.t[6366] |
indefiniteCount | parser.t[6369] |
inSingleObjSlot | parser.t[6663] |
insufficientCount | parser.t[6348] |
inTopicSlot | parser.t[6667] |
listForSingle | parser.t[6351] |
literalLength | parser.t[6390] |
match | parser.t[6316] |
miscWordListCount | parser.t[6372] |
missingCount | parser.t[6360] |
nonMatchCount | parser.t[6338] |
nonMatchPossCount | parser.t[6345] |
nounSlotCount | parser.t[6332] |
pluralTruncCount | parser.t[6363] |
pronounCount | parser.t[6393] |
rankingCriteria | parser.t[6292] |
The most important thing is whether or not we have irresolvable noun phrases (vocabNonMatchCount). If one of us has a noun phrase that refers to nothing anywhere in the game, it's not as good as a phrase that at least matches something somewhere.
Next, if one of us has noun phrases that cannot be resolved to something in scope (nonMatchCount), and the other can successfully resolve its noun phrases, the one that can resolve the phrases is preferred.
Next, check for insufficient numbers of matches to counted phrases (insufficientCount).
Next, check for noun lists in single-noun-only slots (listForSingle).
Next, if we have an empty "but" list in one but not the other, take the one with the non-empty "but" list (emptyButCount). We prefer a non-empty "but" list with an empty "all" even to a non-empty "all" list with an empty "but", because in the latter case we probably failed to exclude anything because we misinterpreted the noun phrase to be excluded.
Next, if we have an empty "all" or "any" phrase due to "but" exclusion, take the one that's not empty (allExcludedCount).
Next, prefer a command that addresses an actor (actorSpecifiedCount) - if the actor name looks like a command (we have someone named "Open Bob," maybe?), we'd prefer to interpret the name appearing as a command prefix as an actor name.
Next, prefer no unstructured word lists as noun phrases (miscWordList phrases) (miscWordListCount).
Next, prefer interpretations that treat less text as uninterpreted literal text. By "less text," we simply mean that one has a shorter string treated as a literal than the other.
Prefer no indefinite noun phrases (indefiniteCount).
Prefer no truncated plurals (pluralTruncCount).
Prefer no noun phrases ending in adjectives (endAdjCount).
Prefer no truncated words of any kind (truncCount).
Prefer fewer pronouns. If we have an interpretation that matches a word to explicit vocabulary, take it over matching a word as a pronoun: if a word is given explicitly as vocabulary for an object, use it if possible.
Prefer no missing phrases (missingCount).
Prefer the one with fewer subcommands - if one has fewer subcommands than the other, it means that we were able to interpret ambiguous conjunctions (such as "and") as noun phrase conjunctions rather than as command conjunctions; since we know by now that we both either have or don't have unresolved noun phrases, we'd rather take the interpretation that gives us noun phrases than the one that involves more separate commands.
Prefer the tree that matches more tokens.
Prefer the one with more structural noun phrases in the verb. For example, if we have one interpretation that's DETACH (X FROM Y) (where X FROM Y is a 'locational' phrase that we treat as the direct object), and one that's DETACH X FROM Y (where X is the direct object and Y is in the indirect object), prefer the latter, because it has both direct and indirect object phrases, whereas the former has only a direct object phrase. English speakers almost always try to put prepositions into a structural role in the verb phrase like this when they could be either in the verb phrase or part of a noun phrase.
If all else fails, prefer the one that is initially less ambiguous. Ambiguity is a weak test at this point, since we might end up narrowing things down through automatic "logicalness" tests later, but it's slightly better to have the match be less ambiguous now, all other things being equal.
tokCount | parser.t[6319] |
truncCount | parser.t[6375] |
unknownWordCount | parser.t[6387] |
unwantedPluralCount | parser.t[6399] |
vocabNonMatchCount | parser.t[6335] |
weaknessLevel | parser.t[6396] |
allNotAllowed ( ) | parser.t[6432] |
ambiguousNounPhrase (keeper, asker, txt, matchList, fullMatchList, scopeList, requiredNum, resolver) | parser.t[6503] |
askMissingObject (asker, resolver, responseProd) | parser.t[6566] |
beginSingleObjSlot ( ) | parser.t[6661] |
beginTopicSlot ( ) | parser.t[6665] |
calcRanking (resolveArguments) | parser.t[6146] |
compareRanking (other) | parser.t[6173] |
This routine is designed to run entirely off of our rankingCriteria property. In most cases, subclasses should be able to customize the ranking system simply by overriding the rankingCriteria property to provide a customized list of criteria objects.
construct (match) | parser.t[6136] |
emptyNounPhrase (resolver) | parser.t[6582] |
endSingleObjSlot ( ) | parser.t[6662] |
endTopicSlot ( ) | parser.t[6666] |
getImpliedObject (np, resolver) | parser.t[6559] |
incCommandCount ( ) | parser.t[6682] |
insufficientQuantity (txt, matchList, requiredNum) | parser.t[6595] |
noMatch (action, txt) | parser.t[6419] |
noMatchForAll ( ) | parser.t[6438] |
noMatchForAllBut ( ) | parser.t[6450] |
noMatchForListBut ( ) | parser.t[6456] |
noMatchForLocation (loc, txt) | parser.t[6486] |
noMatchForPossessive (owner, txt) | parser.t[6480] |
noMatchForPronoun (typ, txt) | parser.t[6462] |
noMatchPossessive (action, txt) | parser.t[6425] |
noteActorSpecified ( ) | parser.t[6688] |
noteAdjEnding ( ) | parser.t[6615] |
noteBadPrep ( ) | parser.t[6492] |
noteEmptyBut ( ) | parser.t[6444] |
noteIndefinite ( ) | parser.t[6621] |
noteLiteral (txt) | parser.t[6576] |
noteMatches (matchList) | parser.t[6642] |
noteMiscWordList (txt) | parser.t[6627] |
noteNounSlots (cnt) | parser.t[6694] |
notePlural ( ) | parser.t[6669] |
notePronoun ( ) | parser.t[6636] |
noteWeakPhrasing (level) | parser.t[6707] |
nothingInLocation (txt) | parser.t[6497] |
noVocabMatch (action, txt) | parser.t[6413] |
reflexiveNotAllowed (typ, txt) | parser.t[6468] |
singleObjectRequired (txt) | parser.t[6601] |
sortByRanking (lst, [resolveArguments]) | parser.t[6108] |
Note that this can be used as a class-level method.
uniqueObjectRequired (txt, matchList) | parser.t[6607] |
unknownNounPhrase (match, resolver) | parser.t[6529] |
wrongReflexive (typ, txt) | parser.t[6474] |
zeroQuantity (txt) | parser.t[6589] |