1.0.20 • Published 8 years ago

clmind v1.0.20

Weekly downloads
63
License
-
Repository
-
Last release
8 years ago

Mind

CognitionLab's basic open-source learning AI core


Basic use

Install the module with: npm install clmind

// Load clmind
var clmind = require('clmind');
var mind = new clmind('Mind', 'User');

// Send input
mind.message("Hello there Mind!", function(response){
  // log to console
  console.log(
    '-> ' + response['user'] + ' - ' + response['msg']
  );
  console.log(
    '<- ' + response['mind'] + ' - ' + response['reply'];
  );
});

// Console output:
// $ -> User - Hello there Mind!
// $ <- Mind - Hello there User!

Documentation


new clmind (2 args)

botname

string name of the bot (default: MIND)

username

string name of the user (default: USER)

Warning: username and botname should be at least 3 characters long.

message (2 args)

msg

string the message to the mind

callback (1 arg)

function a callback function with one argument (optional)

returns object containing "user", "message", "mind", and "reply", either as return value, or first argument in the callback.

setUser (1 arg)

username

string new user's name

return the user's name or an Error.

setName (1 arg)

botname

string new bot's name

return string|Error the name of the bot, or an Error.

addEntry (2 args)

Add an entry into the mind's Concept Network

entry

string One or several sentences.

cns

conceptNetworkState see ConceptNetworkState.

return Array|Error array of token nodes used in the entry.

generateResponse (no args)

Generate a response from the Concept Network and a network state.

return Object { response, nodes } The response is a string, and nodes is an array of nodes (see linkNodesToLastSentence).

linkNodesToLastSentence (1 arg)

Link nodes to the previous sentence node id (this is automatically set by addEntry, it is the node id of the first sentence of the entry).

Used with the nodes returned by addEntry.

nodes

Array Array of nodes ids.

injectConceptNetwork (1 arg)

Inject a new ConceptNetwork constructor. Useful when one wants to use specialized ConceptNetwork (e.g. FileConceptNetwork).

WARNING: reinitialize this.cn and this.cn[this.username].cns

NewConceptNetwok

ConceptNetwork derivated class of ConceptNetwork.


©CognitionLab LTD. 2017

'clmind' npm package free for non-commercial use.

Unmodified code portions ©François Parmentier.

cognitionlab.ltd

1.0.20

8 years ago

1.0.19

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago