Global

Members

(constant) BEGIN :Symbol

Token to represent the start of runs.

Type:
  • Symbol
Source:

(constant) END :Symbol

Token to represent the end of runs.

Type:
  • Symbol
Source:

(constant) OBJECT :Symbol

Token to tag a complex JSON value.

Type:
  • Symbol
Source:

Methods

buildModel(corpus, optionsopt) → {Map.<Tuple.<any>, any>}

Builds a Markov chain model.

Parameters:
Name Type Attributes Default Description
corpus Array.<Array.<any>>

Corpus to build the model from

options object <optional>
{}

Options object

Properties
Name Type Attributes Description
order number <optional>

Order of chain

initialState Tuple.<any> <optional>

Initial state of the chain

Source:
Returns:

Markov chain model

Type
Map.<Tuple.<any>, any>

buildTokenMap(model) → {Map.<any, Tuple.<any>>}

Builds a Map of token to states.

Parameters:
Name Type Description
model Map.<Tuple.<any>, any>

Markov chain model

Source:
Returns:

Token map

Type
Map.<any, Tuple.<any>>

getInitialState(order) → {Tuple.<any>}

Generates a initial state for a chain of the given order.

Parameters:
Name Type Description
order number

Order of chain

Source:
Returns:

Initial state

Type
Tuple.<any>

isObjectToken(token) → {boolean}

Tests if token is complex object.

Parameters:
Name Type Description
token any
Source:
Returns:
Type
boolean

makeObjectToken(data) → {Tuple.<Symbol, any>}

Creates a tuple to represent complex JSON data.

Parameters:
Name Type Description
data any
Source:
Returns:

Complex data token

Type
Tuple.<Symbol, any>

mapHandler(keyFn) → {object}

Creates a proxy map handler.

Parameters:
Name Type Description
keyFn function

Function to make keys

Source:
Returns:

Proxy handler

Type
object

parseTokenString(string) → {any}

Transforms token string to proper token type.

Parameters:
Name Type Description
string string
Source:
Returns:

Chain token

Type
any

stateSpace(mapopt) → {Proxy}

Proxy for a state space Map.

Parameters:
Name Type Attributes Default Description
map Map.<Tuple.<any>, any> <optional>
new Map()

Regular Map

Source:
Returns:
Type
Proxy

stringifyToken(token) → {string}

Transforms token type to proper token string.

Parameters:
Name Type Description
token any
Source:
Returns:

String token

Type
string

weightMap(mapopt) → {Proxy}

Proxy for a weight Map.

Parameters:
Name Type Attributes Default Description
map Map.<any, Number> <optional>
new Map()

Regular Map

Source:
Returns:
Type
Proxy

Type Definitions

Tuple

Immutable tuple.

Type:
Source: