Members
(constant) BEGIN :Symbol
Token to represent the start of runs.
Type:
- Symbol
(constant) END :Symbol
Token to represent the end of runs.
Type:
- Symbol
(constant) OBJECT :Symbol
Token to tag a complex JSON value.
Type:
- Symbol
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
|
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 |
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 |
Returns:
Initial state
- Type
- Tuple.<any>
isObjectToken(token) → {boolean}
Tests if token is complex object.
Parameters:
Name | Type | Description |
---|---|---|
token |
any |
Returns:
- Type
- boolean
makeObjectToken(data) → {Tuple.<Symbol, any>}
Creates a tuple to represent complex JSON data.
Parameters:
Name | Type | Description |
---|---|---|
data |
any |
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 |
Returns:
Proxy handler
- Type
- object
parseTokenString(string) → {any}
Transforms token string to proper token type.
Parameters:
Name | Type | Description |
---|---|---|
string |
string |
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 |
Returns:
- Type
- Proxy
stringifyToken(token) → {string}
Transforms token type to proper token string.
Parameters:
Name | Type | Description |
---|---|---|
token |
any |
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 |
Returns:
- Type
- Proxy
Type Definitions
Tuple
Immutable tuple.