Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0

Defined in: adventure/ParsedNoun.js, line 5

Engine class

Description

ParsedNoun is a special class constructed by Parser.parseNoun(), and used to store metadata about an asset and lists of all possible matches for that asset. This is an internal class that authors should not need to construct.

Private Constructor:

var foo = new AdventureJS.Parser.ParsedNoun(asset)

Parameters:

Inherited Overrides

Methods Collapse all  |  Expand all

Properties  | 

asset_id
asset_id :Getter

Defined in: adventure/ParsedNoun.js, line 211

Todos: returning this.is_unambiguous breaks with platonics because you wind up with this: is_unambiguous: "platonic_pistachio" matches: all: ['platonic_pistachio'] qindex: 0 qualified:['pistachio_0']

Getter function looks for a qualified asset id, and if it doesn't find one, it returns the first qualified match.
exclude
exclude :Boolean

Defined in: adventure/ParsedNoun.js, line 32

Default value: false

input
input :String

Defined in: adventure/ParsedNoun.js, line 81

Default value: ""

The asset name found in user input, though that may already have been replaced with an asset ID by the time this noun gets parsed.
is_all
is_all :Boolean

Defined in: adventure/ParsedNoun.js, line 53

Default value: false

is_assumed
is_assumed :Boolean

Defined in: adventure/ParsedNoun.js, line 166

Default value: false

is_direction
is_direction :String

Defined in: adventure/ParsedNoun.js, line 180

Default value: ""

is_dispenser
is_dispenser :Boolean

Defined in: adventure/ParsedNoun.js, line 194

Default value: false

is_fungible
is_fungible :Boolean

Defined in: adventure/ParsedNoun.js, line 201

Default value: false

is_group
is_group :Boolean

Defined in: adventure/ParsedNoun.js, line 60

Default value: false

is_platonic
is_platonic :Boolean

Defined in: adventure/ParsedNoun.js, line 173

Default value: false

is_plural
is_plural :Boolean

Defined in: adventure/ParsedNoun.js, line 46

Default value: false

is_qualified
is_qualified :String

Defined in: adventure/ParsedNoun.js, line 104

Default value: ""

If a singular asset was found that matched the input, store its ID here.
is_substance
is_substance :String

Defined in: adventure/ParsedNoun.js, line 187

Default value: ""

is_unambiguous
is_unambiguous :String

Defined in: adventure/ParsedNoun.js, line 145

Default value: ""

If a singular asset was found that matched the input, store its ID here. We only use this in support of setting is_qualified, the ultimate arbiter. we set unambiguous but never really rely on it due to the scenario described above - safer to use ParsedNoun.asset_id it also causes an issue with substances in handleSentence where substance is unambiguous though multiple substance containers are found
matchcode
matchcode :Object

Defined in: adventure/ParsedNoun.js, line 131

Default value: ""

matches.qualified can be set from many places. matchcode is a code used to debug where it was set.
matches
matches :Object

Defined in: adventure/ParsedNoun.js, line 111

Default value: { all:[], qualified:[], qindex:0 }

Save a variety of information about assets that matched the input.
normalized_input
normalized_input :String

Defined in: adventure/ParsedNoun.js, line 89

Default value: ""

Serializing input changes to lowercase, replaces spaces with underscores.
original_input
original_input :String

Defined in: adventure/ParsedNoun.js, line 96

Default value: ""

During parsing we may replace the original input string with the ID of a found asset. Ensure that we keep the original.
plural
plural :String

Defined in: adventure/ParsedNoun.js, line 39

Default value: ""

preposition
preposition :String

Defined in: adventure/ParsedNoun.js, line 159

Default value: ""

singular
singular :String

Defined in: adventure/ParsedNoun.js, line 67

Default value: ""

type
type :String

Defined in: adventure/ParsedNoun.js, line 74

Default value: ""