@ector/core v1.1.0
@ector/core
@ector/core is the chat core of ECTOR.
Usage
const ECTOR = require('@ector/core');
let ector = {
name: 'ECTOR',
username: 'Guy'
};
ector = ECTOR.addEntry('Hello ECTOR!');
ector = ECTOR.generateResponse(ector);
const response = ECTOR.getResponse(ector);
console.log(response);should give
Hello Guy!Functions
Table of Contents
- ECTOR
- addEntry
- choseToken
- generateForwards
- generateBackwards
- generateResponse
- linkNodesToLastSentence
- getResponse
ECTOR
Properties
namestring? name of the botusernamestring? name of the usercnConceptNetwork?cnsObject<string, ConceptNetworkState>? One state per usernamelastSentenceLabelstring? Label of the last entry first sentencelastTokenLabelsArray<string>? Labels of the last entry tokensresponsestring? Generated responseresponseLabelsArray<string>? Nodes of the response
addEntry
Add an entry to ector's model.
Parameters
choseToken
Chose one token label from the activated ones.
Parameters
stateConceptNetworkStatetemperaturenumber
Returns string The chosen token
generateForwards
Generate the end of a sentence, adding tokens to the list of token nodes in phrase.
Parameters
cnConceptNetwork Network of tokenscnsConceptNetworkState State of the network (activation values)phraseNodesArray<{id: string, weight: number}> array of token nodestemperaturenumber
Returns Array<{id: string, weight: number}> array of token nodes (end of phrase) *
generateBackwards
Generate the begining of a sentence, adding tokens to the list of token nodes in phrase.
Parameters
cnConceptNetwork Network of tokenscnsConceptNetworkState State of the network (activation values)phraseNodesArray<{id: string, weight: number}> array of token nodestemperaturenumber
Returns Array<{id: string, weight: number}> array of token nodes (end of phrase) *
generateResponse
Generate a response from the activated nodes.
Parameters
ectorECTOR
Returns ECTOR
linkNodesToLastSentence
Link nodes to the previous sentence node label (this is automatically set by addEntry, it is the node label of the first sentence of the entry).
Used with the nodes returned by addEntry.
Parameters
Returns ECTOR *
getResponse
Get the response already generated with generateResponse.
Parameters
ectorECTOR
Returns string