superscriptjs / superscript Goto Github PK
View Code? Open in Web Editor NEWA dialogue engine for creating chat bots
Home Page: http://superscriptjs.com
License: MIT License
A dialogue engine for creating chat bots
Home Page: http://superscriptjs.com
License: MIT License
Right now conceptnet is not being used, it was baked into the message object but it could be more powerful from plugins and hooks.
Superscript init should create a new bot, setup the folder structure and move any pre-made plugins with canned dialogue into the bot folder.
I understand this is based off a fork of RIVE script, but I'm wondering what features you support.
for example are variables supported?
https://github.com/dcsan/rivescript-js/blob/master/eg/brain/clients.rive
I tried this:
! var name = Suzie
+ hi *
- hi! my name is <bot name>
# output
You> hi
Bot> hi! my name is <bot name>
I don't know rivescript but it would help before i debug to know if this is expected.
I did look in the fixtures but couldn't see any examples of variables.
also this syntax for "learning things"
http://www.rivescript.com/docs/Tutorial.html#learning_things
update: as in #19 it seems there are some syntax differences, so maybe i just need to know what those are.
also if there were any example .ss files that would greatly help to see what can be done!
RIVEscript refs
for some reason I am seeing many duplications of the output:
+ hi
- how are you? {redirect=greeting}
+ greeting
- let's get started! {topic=opening}
You> hi
Bot> how are you? {redirect=greeting}
You>
Bot> how are you? {redirect=greeting}
You>
Bot> how are you? {redirect=greeting}
You>
Bot> how are you? {redirect=greeting}
FWIW these are the scripts i'm using
https://github.com/dcsan/superscript/tree/master/data
http://superscriptjs.com/documentation/scripting#random
All dialogue belongs to a topic and even if you do not use any topics, those triggers and replies will be stored in the random topic.
do i need a random topic? or just anything outside a topci will become random?
> topic random
+ *
- You, wake up! {topic=inspector}
? *
- why are you asking me?
< topic
ive been working with another friend on some scripts, and the topic system/trigger matching is definitely confusing. even when within a topic the triggers for other topics will fire.
eg we have a "hi" in a few places but it will fire a different hi.
+ ^inTopic(north) go to the back room
this technique would work but its tedious to do that everywhere.
i understand why you want to have fallbacks etc, but it seems to default to fallback too easily.
I followed the tutorial and have an out of the box bot but trying hello
causes it to crash
cbot> node server.js
TCP server running on port 2000.
User '127.0.0.1:55384' has connected.
/Users/dc/node_modules/superscript/lib/getreply.js:359
if (gIncludes[topic] || gLineage[topic]) {
^
TypeError: Cannot read property 'random' of undefined
at getreply (/Users/dc/node_modules/superscript/lib/getreply.js:359:18)
at internalizeHandle (/Users/dc/node_modules/superscript/index.js:125:9)
at messageItor (/Users/dc/node_modules/superscript/index.js:135:5)
at /Users/dc/node_modules/superscript/node_modules/async/lib/async.js:235:13
at iterate (/Users/dc/node_modules/superscript/node_modules/async/lib/async.js:142:13)
at async.eachSeries (/Users/dc/node_modules/superscript/node_modules/async/lib/async.js:158:9)
at _asyncMap (/Users/dc/node_modules/superscript/node_modules/async/lib/async.js:234:9)
at Object.mapSeries (/Users/dc/node_modules/superscript/node_modules/async/lib/async.js:224:23)
at /Users/dc/node_modules/superscript/index.js:190:11
at /Users/dc/node_modules/superscript/index.js:155:12
client
ref> telnet localhost 2000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Welcome to the Telnet server!
Hello 127.0.0.1:55384! Type /quit to disconnect.
You> hello
Connection closed by foreign host.
bot script is currently:
superscript> cd cbot
cbot> parse
parse topics
File data.json already exists, remove file first or use -f to force save.
cbot> parse -f
parse topics
Time to Process 1.167 seconds
Number of topics 1 parsed.
Number of triggers 1 parsed.
Number of replies 6 parsed.
Saved output to data.json
cbot> cat data.json
{"gTopicFlags":{"random":[]},"gTopics":{"random":{"7Xw2HqOY":{"trigger":"~emohello(?:\\s*(\\s?(?:[\\w]*\\s?){0,2})\\s*|\\s*)","options":{"isQuestion":false,"qType":false,"qSubType":false,"filter":false},"reply":{"Cp8L6Y7M":"Hi!","VXqL8u2v":"Hi, how are you?","hZYpXFAI":"How are you?","eo5vDdGE":"Hello","p9OBmtyB":"Howdy","eZ67xZjX":"Ola"}}}},"gPrevTopics":{},"gSorted":{"topics":{"random":["7Xw2HqOY"]},"thats":{},"that_trig":{}},"keywords":"{\"documents\":[],\"_idfCache\":{}}","checksums":{"./topics/main.ss":"a307a35116dcfadd055582b4f73c4041c2811a71"}}%
cbot> cat topics/main.ss
+ ~emohello [*~2]
- Hi!
- Hi, how are you?
- How are you?
- Hello
- Howdy
- Ola%
trying to use the redirect tag
http://superscriptjs.com/documentation/scripting#redirect
script:
+ hi
- how are you? {redirect=greeting}
+ greeting
- let's get started! {topic=opening}
but this gives
You> hi
Bot> how are you? {redirect=greeting}
am i doing something wrong?
I noticed that sometimes the replies were blank, and I guess this is why:
Replies can be stacked up and will be chosen at RANDOM. Once a reply has been used, we discard it and won't use it again.
you mean permanently discarded? is there a way to stop this behavior, or to cycle through the replies in order? eg if I have an NPC in a shop, I want him to just keep repeating a set phrase like
"Come back later I told ya"
I recall you had some code for saving variables before (facts?) but cant see this in the tests dir.
is all content in { } suppressed? If i wanted to use the engine to return structured data, what would you think is the best way? eg:
+ hit biker
- the biker hits you back { health: -2 }
+ scream
- The biker shouts back { who: biker }
etc.
I was following along from your example gist script
and the section here:
https://medium.com/@rob_ellis/creating-a-chat-bot-42861e6a2acd
+ i (like|love) you
- I <cap> you too!
i ~like you
I <cap> you too.
but i can't seem to get a working result:
data.ss ->
+ I like *
- You like <cap>!
gives this session:
You> i like blue
Bot> You like undefined!
Some of the work coming around CCG's from Luke Zettlemoyer team is amazing and aligns with the goals of this project.
http://homes.cs.washington.edu/~lsz/papers/
http://norfolk.cs.washington.edu/htbin-post/unrestricted/colloq/archive.cgi?id=804
found another issue when calling client.destroy() on a TCP connection
TypeError: Object # has no method 'userDisconnect'
This is related to GH-6
I have changed the way parsing works and it now is a little smarter and caches the checksums of files.
Prior to this change 30 topics and ~1300 triggers took 10+ minutes. It will now only parse the files that have changed.
This should be easy to do.
detailed typography point!
how best to keep spaces in a line? eg after the ? mark here:
Bot> biker: what do ya want?he seems pretty chill.
+ look
- {^hasItem(bikerAngry, true)} he seems angry.
- {^hasItem(bikerAngry, false)} he seems pretty chill.
+ talk *
- biker: what do ya want?
^ {@look}
note want?
does have a space but i guess it gets trimmed off.
Please let me know if I have missed something.
I created a hello.ss file which contains
+ hello bot
- Hello, human!
Using
node bin/parse.js example/hello.ss
creates a file data.json but the file contains null
. Have I missed anything ?
I see in your tests:
+ [*]
A generic wildcard character will match Zero to Unlimited characters, words or tokens, and the input is NOT captured or saved by the system.
so is
+ *
the right way to have a general starting off gambit?
also I'm assuming (*)
means capture?
It would be nice to have the engine auto reload when the topics change.
A grunt or gulp would be ideal for this task.
Is there support for localization or way to do so?
not sure if the syntax has changed/parser broke/I'm doing something wrong, but i can't seem to get much joy out of the system.
// --------- inspector --------------
> topic inspector
+ askticket
- wheres your ticket? {topic=ticket}
+ hello
- dont hello me.
+ * lost
- "you're lost??! well, that's not my problem."
? * ticket
- "Don't pretend. You know what I'm talking about!"
// is there an order eg fallthru to last option?
+ [*]
- pay attention! {@askticket}
- "hey! I'm talking to you!" {@askticket}
< topic
// ------ ticket -----------
> topic ticket includes inspector
+ I lost [*]
- you lost your ticket? {@getoff}
+ *
- So? {@getoff}
+ getoff
- You have to get off the train then {topic=street}
< topic
=========== gives:
You> hi
{"reply":"dont hello me.","currentTopic":"random"}
ok
{"reply":"pay attention! wheres your ticket?","currentTopic":"ticket","pendingTopic":"ticket"}
i lost it
{"reply":"pay attention! wheres your ticket?","currentTopic":"ticket","pendingTopic":"ticket"}
I lost it
{"reply":"pay attention! wheres your ticket?","currentTopic":"ticket","pendingTopic":"ticket"}
whatever
{"reply":"pay attention! wheres your ticket?","currentTopic":"ticket","pendingTopic":"ticket"}
so i see you have slack & telnet by default, i was wondering if there:s a web driver?
i thought you had one in the previous release...
a little related to #16 - I tried typing in some double byte characters to the telnet client, and the data was mangled. Since my terminal is setup for unicode, some googling said this is a problem at socket setup, in that what I am seeing as i type input is being echoed back from the server?
I added this line line but no effect so wonder if its something deeper in the engine that is locked to ascii?
var newSocket = function (socket) {
socket.setEncoding('utf8'); // no effect
eg typing in ๆฅๆฌ่ช shows like:
We may need a way to match words we do not want to show up in a trigger
I'm not sure what the interface would look like yet as the word order becomes less important when we don't want the word, and everything so far is based on word order. This could be solved with a filter function once that is implemented.
+ ^not(much,many) how *
- reply
if i use
+ punch
- he punches you back ^save(bikerAngry, true) {@look}
I see:
You> punch
Bot> he punches you back ^save(bikerAngry, true) he seems pretty chill.
so the command ^save is just coming out in the string?
but the {@look}
redirect after that is working fine.
but if i put on runon using caret, eg two lines, the second line doesn't fire
+ punch
- he punches you back ^save(bikerAngry, true) {@look}
^ {@look}
(look will never fire)
Add conditionals into replies and triggers.
Hi,
Does the underlaying librarie support other language like French ? Is there documentation ?
I would love to plug a Chatter Bot to SARAH (http://sarah.encausse.net)
We want to be able to allow people to bring their own pos, and language parsers. This should be supported in the message analyzing code.
I was trying to use the *:1
type feature which if i am guessing correct will allow the bot to proactively say something to the user unprompted? ie to initiate the conversation?
but i don't seem to get this response. is it just that the telnet example isn't wired up for this?
https://github.com/silentrob/superscript/blob/master/test/fixtures/chat/main.ss
// Now that the bot can just talk, lets give it something to say whenever it wants.
* How old are you?
+ *
% How old are you?
- <cap>, that is awesome!
*:1 Hi my name is Rob, what is your name?
*:1 Welcome to SuperScript
sorry for all the questions :) If it helps I can modify the docs with some of these anwers
Right now topics need to be explicitly defined. It would be ideal for the system to have greater matching and knowledge of all topics, rules and gambits for better conversation planning.
We need some utility topic functions to determine if a rule matches in a topic, and how many.
Replace the pre/post topic with a pending topic array that can change dynamically.
Add topic keywords and expand them with an ontology for better topic discovery.
Because we use CRC we can easily get trigger collision on different matches within an topic
IE:
+ *
- ^respond(~brit_misc)
+ *
- ^respond(~honest_response )
The new topic system allows us to explore multiple topics but the CRC will collapse these into one gambit with 2 replies.
I was searching for tutorials and can't find any good hits on goog, perhaps since the word superscript, like subscript, is an english word. how about something a bit more unique and also to do with chat? i realize a lot is taken already but some ideas:
(not a tech issue so feel free to close)
In light of this [1] announcement, it only seems fitting we have a better slack integration example.
As noted in GH-35
We can now redirect to a different topic.
The older syntax using {@..} only redirects within the existing topic. To support more complex types of conversations that branch into new topics we need a new function to support that.
Tests that showcase three examples are here.
https://github.com/silentrob/superscript/blob/master/test/fixtures/redirect/redirects.ss#L37-L70
The function is called ^topicRedirect(...)
with 2 arguments the first is the name of the topic, and the second is the expression to match.
following the directions here:
http://superscriptjs.com/starter/quickstart
I get this error:
/Users/davidneudorfer/Git/superscript/bot.js:14
debug("Message", data.toString('hex',0,data.length));
^
ReferenceError: debug is not defined
I added the eliza script in. maybe script syntax is changed:
+ no
@ nope
Topic FindMatch +0ms eliza
Topic Try to match (clean)'~no' against ~no (~no) topic: eliza +0ms
Topic Try to match (lemma)'~no' against ~no (~no) topic: eliza +0ms
Topic Found Redirect Match with topic eliza +0ms
Topic Found Match with topic eliza +0ms
/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/topic.js:143
message.triggerId = trigger.id;
^
TypeError: Cannot read property 'id' of undefined
at /Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/topic.js:143:38
at Object.exports.postParse (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/regexreply.js:237:3)
at eachGambitHandle (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/topic.js:42:16)
at /Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/node_modules/async/lib/async.js:118:13
at Array.forEach (native)
at _each (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/node_modules/async/lib/async.js:39:24)
at Object.async.each (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/node_modules/async/lib/async.js:117:9)
at eachGambit (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/topic.js:31:11)
at Topic.findMatch (/Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/topic.js:212:5)
at /Users/dc/dev/shumi/superbotz/bot2/node_modules/superscript/lib/getreply.js:84:13
Cleanup task to make superscript a little more maintainable. This would see /lib/parse.js and /lib/sort.js and a few other util functions get moved out making the parser and engine a little more separated.
Base on this section in the docs:
http://superscriptjs.com/documentation/scripting#redirect
I've created this script:
main.ss:
+ ~emohello
- Hi! {@ask}
- Hello, {@ask}
- Howdy, {@ask}
- Ola, {@ask}
+ ask
- How are you?
- How you doing?
- What's up?
But the result is:
You> hi
Bot> Howdy, undefined
You> Hello
Bot> Hello, undefined
And the debug log from the server:
$ DEBUG=*,-Utils node server.js
Script Loading Plugin +0ms ./plugins oppisite
Script Loading Plugin +4ms ./plugins rhymes
Script Loading Plugin +0ms ./plugins syllable
Script Loading Plugin +0ms ./plugins letterLookup
Script Loading Plugin +0ms ./plugins wordLength
Script Loading Plugin +4ms ./plugins nextNumber
Script Loading Plugin +0ms ./plugins createFact
Script Loading Plugin +1ms ./plugins resolveAdjective
Script Loading Plugin +0ms ./plugins evaluateExpression
Script Loading Plugin +0ms ./plugins numToRoman
Script Loading Plugin +0ms ./plugins numToHex
Script Loading Plugin +0ms ./plugins numToBinary
Script Loading Plugin +0ms ./plugins numMissing
Script Loading Plugin +0ms ./plugins numSequence
Script Loading Plugin +0ms ./plugins hasName
Script Loading Plugin +0ms ./plugins has
Script Loading Plugin +0ms ./plugins findLoc
Script Loading Plugin +0ms ./plugins tooAdjective
Script Loading Plugin +0ms ./plugins usedFor
Script Loading Plugin +0ms ./plugins resolveFact
Script Loading Plugin +0ms ./plugins putA
Script Loading Plugin +0ms ./plugins isA
Script Loading Plugin +0ms ./plugins colorLookup
Script Loading Plugin +0ms ./plugins makeChoice
Script Loading Plugin +0ms ./plugins findMoney
Script Loading Plugin +0ms ./plugins findDate
Script Loading Plugin +0ms ./plugins locatedAt
Script Loading Plugin +0ms ./plugins aquireGoods
Script Loading Plugin +0ms ./plugins bail
Script Loading Plugin +1ms ./plugins one
Script Loading Plugin +0ms ./plugins num
Script Loading Plugin +0ms ./plugins changetopic
Script Loading Plugin +0ms ./plugins changefunctionreply
Script Loading Plugin +0ms ./plugins getDOW
Script Loading Plugin +0ms ./plugins getDate
Script Loading Plugin +0ms ./plugins getDateTomorrow
Script Loading Plugin +0ms ./plugins getSeason
Script Loading Plugin +0ms ./plugins getTime
Script Loading Plugin +0ms ./plugins getTimeOfDay
Script Loading Plugin +0ms ./plugins getDayOfWeek
Script Loading Plugin +0ms ./plugins getMonth
Script Loading Plugin +0ms ./plugins save
Script Loading Plugin +0ms ./plugins get
Script Loading Plugin +0ms ./plugins createUserFact
Script Loading Plugin +0ms ./plugins wordnetDefine
Script Loading Plugin +0ms ./plugins plural
Script Loading Plugin +0ms ./plugins not
Script Loading Plugin +1ms ./plugins lowercase
Normalizer Loaded File +0ms { key: '_sys', file: 'systemessentials.txt' }
Normalizer Loaded File +5ms { key: '_extra', file: 'substitutes.txt' }
Normalizer Loaded File +333ms { key: '_contractions', file: 'contractions.txt' }
Normalizer Loaded File +18ms { key: '_interjections', file: 'interjections.txt' }
Normalizer Loaded File +76ms { key: '_britsh', file: 'british.txt' }
Normalizer Loaded File +132ms { key: '_spellfix', file: 'spellfix.txt' }
Normalizer Loaded File +776ms { key: '_texting', file: 'texting.txt' }
Normalizer Done Reading Subs +18ms
Normalizer Done Loading files +0ms
Script Questions Loaded +1s
Script System Loaded, waiting for replies +1ms
TCP server running on port 2000.
User '127.0.0.1:55582' has connected.
Script Connecting User +7s 127.0.0.1:55582
User user Connected +0ms { name: '127.0.0.1:55582',
status: 1,
currentTopic: 'random',
memory:
{ conceptToList: [Function],
create: [Function],
db:
{ getStream: [Function],
get: [Function],
put: [Function],
del: [Function],
putStream: [Function],
delStream: [Function],
close: [Function],
v: [Function: Variable],
searchStream: [Function],
search: [Function],
isOpen: [Function],
nav: [Function],
generateBatch: [Function: generateBatch],
joinStream: [Function],
join: [Function],
approximateSize: [Function] },
createUserDB: [Function],
createUserDBWithData: [Function] },
conversationStartedAt: Fri Jan 16 2015 13:29:42 GMT+0000 (UTC),
lastMessageSentAt: null,
volley: 0,
rally: 0,
__history__:
{ input: [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ],
reply: [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ],
topic: [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ] } }
Script Message Recieved from '127.0.0.1:55582' +5s hi
Message Creating message from: +0ms ~emohello
Message fullnames +975ms names []
Message Fetch List +1ms
Message Return with +0ms []
Message fullnames +1ms nouns []
Message Things +0ms [ '~emohello' ]
Message Things +0ms []
Message Message +1ms { facts:
{ conceptToList: [Function],
create: [Function],
db:
{ breadthFirst: [Function: breadthFirst],
deepFirst: [Function: deepFirst] },
createUserDB: [Function],
createUserDBWithData: [Function] },
createdAt: Fri Jan 16 2015 13:29:49 GMT+0000 (UTC),
raw: '~emohello',
clean: '~emohello',
crc: 'a5926307',
dict: { words: [ [Object] ] },
words: [ '~emohello' ],
cwords: [ '~emohello' ],
taggedWords:
[ [ '~emohello', 'NN' ],
pushUnique: [ [Function], [Function] ],
chunk: [ [Function], [Function] ] ],
lemWords: [ '~emohello' ],
lemString: '~emohello',
posString: 'NN',
qtype: '',
qSubType: '',
isQuestion: false,
sentiment: 0,
nouns: [ '~emohello' ],
names: [],
list: [],
adjectives: [],
adverbs: [],
verbs: [],
pnouns: [],
pronouns: [],
compareWords: [],
numbers: [],
compare: false,
date: null,
cNouns: [ '~emohello' ],
numericExp: false,
halfNumericExp: false,
entities: [ '~emohello' ] }
User getTopic +7s random
Topics allTopics +0ms [ '__pre__', 'random', '__post__' ]
GetReply Topics to check +0ms [ '__pre__', 'random', '__post__' ]
Topic FindMatch +0ms random
Topic Try to match (clean)'~emohello' against ~emohello (~emohello) topic: random +1ms
Topic Try to match (lemma)'~emohello' against ~emohello (~emohello) topic: random +0ms
Topic Found Match with topic random +0ms
Topic Try to match (clean)'~emohello' against ask (ask) topic: random +1ms
Topic Try to match (lemma)'~emohello' against ask (ask) topic: random +0ms
GetReply match itor +2ms { stars: [],
trigger:
{ id: 'a5926307',
trigger: '~emohello',
replies:
{ '20c01f40': 'Hi! {@ask}',
'6f26a364': 'Hello, {@ask}',
c4cb7385: 'Howdy, {@ask}',
'8b163f90': 'Ola, {@ask}' },
redirect: false,
isQuestion: false,
qType: false,
qSubType: false,
filter: false },
topic: 'random' }
GetReply filterRepliesByFunction +1ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply filterByFunction Results +2ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply filterRepliesBySeen +1ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply Bucket +0ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
ProcessTags Inline redirection to: ask +0ms
GetReply Called Recursively +4ms 1
User getTopic +11ms random
Topics allTopics +11ms [ '__pre__', 'random', '__post__' ]
GetReply Topics to check +0ms random
ProcessTags CallBack from inline redirect +2ms undefined
ProcessTags CallBack from inline redirect +1ms Howdy, undefined
GetReply err, reply +2ms null Howdy, undefined
Message Creating message from: +16ms Howdy, undefined
Message fullnames +311ms names []
Message Fetch List +0ms
Message Return with +0ms []
Message fullnames +7ms nouns []
Message Things +0ms [ '~emohello' ]
Message Things +0ms []
Message Message +1ms { facts:
{ conceptToList: [Function],
create: [Function],
db:
{ breadthFirst: [Function: breadthFirst],
deepFirst: [Function: deepFirst] },
createUserDB: [Function],
createUserDBWithData: [Function] },
createdAt: Fri Jan 16 2015 13:29:50 GMT+0000 (UTC),
raw: 'Howdy, undefined',
clean: '~emohello, undefined',
crc: '84658c97',
dict: { words: [ [Object], [Object], [Object] ] },
words: [ '~emohello', ',', 'undefined' ],
cwords: [ '~emohello', ',', 'undefined' ],
taggedWords:
[ [ '~emohello', 'NN' ],
[ ',', ',' ],
[ 'undefined', 'JJ' ],
pushUnique: [ [Function], [Function] ],
chunk: [ [Function], [Function] ] ],
lemWords: [ '~emohello', ',', 'undefined' ],
lemString: '~emohello , undefined',
posString: 'NN , JJ',
qtype: '',
qSubType: '',
isQuestion: false,
sentiment: 0,
nouns: [ '~emohello' ],
names: [],
list: [],
adjectives: [ 'undefined' ],
adverbs: [],
verbs: [],
pnouns: [],
pronouns: [],
compareWords: [],
numbers: [],
compare: false,
date: null,
cNouns: [ '~emohello' ],
numericExp: false,
halfNumericExp: false,
entities: [ '~emohello' ] }
User Updating History +324ms
User getTopic +0ms random
Script Update and Reply to user '127.0.0.1:55582' +2s Howdy, undefined
Script Message Recieved from '127.0.0.1:55582' +5.4m Hello
Message Creating message from: +5.4m ~emohello
Message fullnames +115ms names []
Message Fetch List +0ms
Message Return with +1ms []
Message fullnames +0ms nouns []
Message Things +0ms [ '~emohello' ]
Message Things +0ms []
Message Message +0ms { facts:
{ conceptToList: [Function],
create: [Function],
db:
{ breadthFirst: [Function: breadthFirst],
deepFirst: [Function: deepFirst] },
createUserDB: [Function],
createUserDBWithData: [Function] },
createdAt: Fri Jan 16 2015 13:35:15 GMT+0000 (UTC),
raw: '~emohello',
clean: '~emohello',
crc: 'a5926307',
dict: { words: [ [Object] ] },
words: [ '~emohello' ],
cwords: [ '~emohello' ],
taggedWords:
[ [ '~emohello', 'NN' ],
pushUnique: [ [Function], [Function] ],
chunk: [ [Function], [Function] ] ],
lemWords: [ '~emohello' ],
lemString: '~emohello',
posString: 'NN',
qtype: '',
qSubType: '',
isQuestion: false,
sentiment: 0,
nouns: [ '~emohello' ],
names: [],
list: [],
adjectives: [],
adverbs: [],
verbs: [],
pnouns: [],
pronouns: [],
compareWords: [],
numbers: [],
compare: false,
date: null,
cNouns: [ '~emohello' ],
numericExp: false,
halfNumericExp: false,
entities: [ '~emohello' ] }
User getTopic +5.4m random
Topics allTopics +5.4m [ '__pre__', 'random', '__post__' ]
GetReply Topics to check +5.4m [ '__pre__', 'random', '__post__' ]
Topic FindMatch +5.4m random
Topic Try to match (clean)'~emohello' against ~emohello (~emohello) topic: random +0ms
Topic Try to match (lemma)'~emohello' against ~emohello (~emohello) topic: random +0ms
Topic Found Match with topic random +0ms
Topic Try to match (clean)'~emohello' against ask (ask) topic: random +1ms
Topic Try to match (lemma)'~emohello' against ask (ask) topic: random +0ms
GetReply match itor +2ms { stars: [],
trigger:
{ id: 'a5926307',
trigger: '~emohello',
replies:
{ '20c01f40': 'Hi! {@ask}',
'6f26a364': 'Hello, {@ask}',
c4cb7385: 'Howdy, {@ask}',
'8b163f90': 'Ola, {@ask}' },
redirect: false,
isQuestion: false,
qType: false,
qSubType: false,
filter: false },
topic: 'random' }
GetReply filterRepliesByFunction +0ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply filterByFunction Results +2ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply filterRepliesBySeen +0ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
GetReply Bucket +3ms [ { crc: '20c01f40',
stars: [],
topic: 'random',
reply: 'Hi! {@ask}',
trigger_id: 'a5926307' },
{ crc: '6f26a364',
stars: [],
topic: 'random',
reply: 'Hello, {@ask}',
trigger_id: 'a5926307' },
{ crc: 'c4cb7385',
stars: [],
topic: 'random',
reply: 'Howdy, {@ask}',
trigger_id: 'a5926307' },
{ crc: '8b163f90',
stars: [],
topic: 'random',
reply: 'Ola, {@ask}',
trigger_id: 'a5926307' } ]
ProcessTags Inline redirection to: ask +5.4m
GetReply Called Recursively +1ms 1
User getTopic +9ms random
Topics allTopics +9ms [ '__pre__', 'random', '__post__' ]
GetReply Topics to check +2ms random
ProcessTags CallBack from inline redirect +2ms undefined
ProcessTags CallBack from inline redirect +0ms Hello, undefined
GetReply err, reply +1ms null Hello, undefined
Message Creating message from: +13ms Hello, undefined
Message fullnames +120ms names []
Message Fetch List +0ms
Message Return with +1ms []
Message fullnames +1ms nouns []
Message Things +0ms [ '~emohello' ]
Message Things +1ms []
Message Message +0ms { facts:
{ conceptToList: [Function],
create: [Function],
db:
{ breadthFirst: [Function: breadthFirst],
deepFirst: [Function: deepFirst] },
createUserDB: [Function],
createUserDBWithData: [Function] },
createdAt: Fri Jan 16 2015 13:35:15 GMT+0000 (UTC),
raw: 'Hello, undefined',
clean: '~emohello, undefined',
crc: '73c66d71',
dict: { words: [ [Object], [Object], [Object] ] },
words: [ '~emohello', ',', 'undefined' ],
cwords: [ '~emohello', ',', 'undefined' ],
taggedWords:
[ [ '~emohello', 'NN' ],
[ ',', ',' ],
[ 'undefined', 'JJ' ],
pushUnique: [ [Function], [Function] ],
chunk: [ [Function], [Function] ] ],
lemWords: [ '~emohello', ',', 'undefined' ],
lemString: '~emohello , undefined',
posString: 'NN , JJ',
qtype: '',
qSubType: '',
isQuestion: false,
sentiment: 0,
nouns: [ '~emohello' ],
names: [],
list: [],
adjectives: [ 'undefined' ],
adverbs: [],
verbs: [],
pnouns: [],
pronouns: [],
compareWords: [],
numbers: [],
compare: false,
date: null,
cNouns: [ '~emohello' ],
numericExp: false,
halfNumericExp: false,
entities: [ '~emohello' ] }
User Updating History +129ms
User getTopic +0ms random
Script Update and Reply to user '127.0.0.1:55582' +372ms Hello, undefined
Tried to follow the getting start but i'm getting a erorr after connecting to the app. did i miss something?
The debug package is installed globaly and in the node_modules folder.
$ node bot.js
TCP server running on port 2000.
User '127.0.0.1:57513' has connected.
/Users/***/dev/superS/bot.js:14
debug("Message", data.toString('hex',0,data.length));
^
ReferenceError: debug is not defined
at receiveData (/Users/ehsanpourhadi/dev/superP/bot.js:14:5)
at Socket.<anonymous> (/Users/ehsanpourhadi/dev/superP/bot.js:64:7)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:764:14)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:426:10)
at emitReadable (_stream_readable.js:422:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:528:21)
Retreaval and extraction using ConceptNet
Retrieval is misspelled.
So the idea is to create new replies, triggers and topics on the fly from within a plugin.
So a use-case here would be to allow the bot to steal replies from a user and use them as their own.
We want to be able to save and reload user data when someone re-connects or has been gone for some period of time, or the bot engine restarts.
Mongo or couch seems to make sense ill explore other options as well. JSON + lightweight.
when developing a bot it's tedious to reboot the server all the time.
is there a debug way to --watch the script files, or to at least send a command to the bot to reload them?
i think i saw something like this in Rivescript.
is it possible to do this from a JS custom function? I'm sure you must have done this for your own scripts...
I had a look at the slack docs to try and send an image but doesnt immediately work.
if (reply) {
reply.icon_url = "http://laorquesta.mx/wp-content/uploads/2014/12/bikers-300x225.jpg";
channel.send(reply);
}
wondering if we can just add extra fields to the reply in this way.
chat.postMessage should be able to just have an icon_url added.
https://api.slack.com/methods/chat.postMessage
images are a bit different.
https://api.slack.com/docs/attachments
done any experimentation here?
I'm trying to send JSON back with a bit more metadata about bot state.
is bot.scope.user.pendingTopic,
the right field to send for currentTopic?
it doesn't seem to change as I would have thought (but that maybe a differnt issue)
bot.reply(socket.name, message.trim(), function(err, reply){
msg = {
reply: reply,
topic: bot.scope.user.pendingTopic,
// bot: bot
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.