AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Fact persistence
 
 
  [ # 16 ]

I am new to ChatScript and I have the same issue that you discussed in this thread.  I was able to comment out the SystemReset command in the C_Build procedure in the testing.cpp file and recompile the chatscript.exe so that the user facts persist between issuing build commands. 

I am interested in using the ^export and ^import functions as well and I am having difficulty in implementing them.  I am interested in learning more about the parameters of the functions and how the @setid is created.  I just want to save all of the user facts created during the session to a single file and be able to read them in at the start of the next session.  This way user specific info such as name of spouse can be persisted between sessions and system rebuilds.  Why is the @setid necessary and I do not want to erase the facts from the fact table.  If you are saving each fact after you create it to a file then how do you get the fact stored in a fact set in order to write it to a file.  I am not interested in tables unless the chatbot can write new table rows for user specific facts without having to write an external program that would have to be called using the ^system funciton.  Thanks.

Here is my test file:
topic: ~introductions []
t: ^noerase() [Hello] [Hi] [Hey], [talk] [speak] [say something] to me!

u: (my name is _*)  ^noerase() ^repeat() $yourname = ‘_0 Nice to meet you _0.

?: (what is my name)  ^noerase() ^repeat() Your name is $yourname.

s: (I like _*)  ^noerase() ^repeat()  $WhatYouLike = ‘_0 That’s amazing! I like _0 too!
^CreateFact($yourname like $WhatYouLike)

?: (what do I like $YourName )  ^noerase() ^repeat()
^Query(direct_sv $yourname like) You like @0object.

u: (import) ^noerase() ^repeat() Facts imported.
^import(testfacts.txt @0 noerase transient)

u:(export) ^noerase() ^repeat() Facts exported.
^Export(testfacts.txt @0)

 

 
  [ # 17 ]

First… welcome.

Second, if ALL you want to do is have user facts saved across a rebuild, you can just rebuild after changing your login name and the user facts will be preserved by all other user id’s.  So why comment out reset. And if you did comment out reset, then if the user file no longer resets, what is your current need for writing facts to some other file?  User created facts are AUTOMATICALLY preserved with the user.

 

 
  [ # 18 ]

that having been said….
^export takes a first argument which is the name of the file to write to.
the second argument is the reference to a fact set of facts to write out, e.g., @0

to export facts you must get them into a fact set, which generally means performing a query of some kind. Or manually assigning them into a table as you create them.

^import takes 4 arguments, the first is the filename, the second is a fact set to bring them into, e.g, @0,
  the third if “erase” means remove the file after reading it.
the fourth, if “transient”, means make the facts only temporary. They will automatically disappear at the end of the volley.

 

 
  [ # 19 ]

The other thing that probably works (though I haven’t tested it), is assuming you have already been doing some chatting with your bot, when you then do a :build, after it do a :revert.  That should restore your bot’s data file while redoing the last input to your bot. This assumes stand-alone non-server mode.

 

 < 1 2
2 of 2
 
  login or register to react