ResolvedTopicclass
Resolved Topic object. The topic of a TopicTAction always resolves to one of these objects.
class
ResolvedTopic
: object
Superclass Tree (in declaration order)
ResolvedTopic
` object`
Subclass Tree
(none)
Global Objects
Summary of Properties
canMatchLiterally
inScopeList
likelyList
otherList
resInfoTab
topicProd
Summary of Methods
canMatchObject
construct
getBestMatch
getResolveInfo
getTopicText
getTopicTokens
getTopicWords
wrapActionObject
wrapObject
Properties
canMatchLiterally
Are we allowed to match the topic text literally, for parsing purposes? If this is true, it means that we can match the literal text the player entered against strings, regular expressions, etc.; for example, we can match a TopicMatchTopic’s matchPattern regular expression. If this is nil, it means that we can only interpret the meaning of the resolved topic by looking at the various topic match lists (inScopeList, likelyList, otherList).
By default, we simply return true. Note that the base library never has any reason of its own to disallow literal matching of topic text; this property is purely for the use of language modules, to handle language-specific input that parses at a high level as a topic phrase but which has some idiomatic or grammatical function that makes it in appropriate to try to extract the meaning of the resolved topic from the literal text of the topic phrase in isolation. This case doesn’t seem to arise in English, but does occur in other languages: Michel Nizette cites “parlez-en a Bob” as an example in French, where “en” is essentially a particle modifying the verb, not a full-fledged phrase that we can interpret separately as a topic.
inScopeList
Our lists of resolved objects matching the topic phrase, separated by classification.
likelyList
no description available
otherList
no description available
resInfoTab
ResolveInfo table for the resolved objects. This is a lookup table indexed by simulation object. Each entry in the resolved object lists (inScopeList, etc) has have a key in this table, with the ResolveInfo object as the value for the key. This can be used to recover the ResolveInfo object describing the parser results for this object.
topicProd
The production match tree object that matched the topic phrase in the command. This can be used to obtain the original tokens of the command or the original text of the phrase.
Methods
canMatchObject (obj)
Is the given object among the possible matches for the topic?
construct (inScope, likely, others, prod)
no description available
getBestMatch ( )
Get the best object match to the topic. This is a default implementation that can be changed by game authors or library extensions to implement different topic-matching strategies. This implementation simply picks an object arbitrarily from the “strongest” of the three lists we build: if there’s anything in the inScopeList, we choose an object from that list; otherwise, if there’s anything in the likelyList, we choose an object from that list; otherwise we choose an object from the otherList.
getResolveInfo (obj)
Get the parser ResolveInfo object for a given matched object. This recovers the ResolveInfo describing the parsing result for any object in the resolved object lists (inScopeList, etc).
getTopicText ( )
get the original text of the topic phrase
getTopicTokens ( )
get the original tokens of the topic phrase, in canonical tokenizer format
getTopicWords ( )
get the original word strings of the topic phrase - this is simply a list of the original word strings (in their original case), without any of the extra information of the more complicated canonical tokenizer format
wrapActionObject (role)
Static method: create a ResolvedTopic to represent an object that’s already been resolved to a game object for the current action. ‘role’ is the object role to wrap (DirectObject, IndirectObject, etc).
wrapObject (obj)
Static method: create a ResolvedTopic to represent the given object.
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3