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..

How to implement a Chatscript bot that talk Spanish
 
 
  [ # 121 ]

The   $cs_token controls some of the LIVEDATA files as to whether or not to use them (they are always loaded).
Feel free to delete or revise any files at the top level of livedata.  SYSTEM folder should not be revised for a different language EXCEPT for the canonical.txt file which can be.

All of the ENGLISH folder can be removed.

 

 
  [ # 122 ]

Hi Bruce, thx for ur support

what about?
RAWDATA/WORLDATA
RAWDATA/ONTOLOGY
and RAWDATA/QUIBBLE

does they have to be deleted to?

I have notice that my spanish chatbot is loading some eliza.tops when starting, it says something about some quibble rules.

Can those directories be deleted to??

Thx advanced.

 

 
  [ # 123 ]

Hi Bruce, thx 4 ur support.
I know these variables…
%input – the count of the number of volleys this user has made ever
%userfirstline – value of %input that is at the start of this conversation start
are use by introductions.top to determine wether is a start of a conversation or if it is a startup of a new conversation

#!x will match on every return start of a conversation
t: ( %input<%userfirstline %input>0 )

#!x matches every time on startup of a new conversation
t: ( %input<%userfirstline )

I know %userfirstline = value of %input that is at the start of this conversation start
but how CS knows when a previous conversation session has ended, and a new convesation session has started in order to update %userfirstline value??? does it count the hours, or days between the inputs internally, to deduce it has passed a day, and it should be a new conversation? I remember I read something about this in the manuals, don’t remember where, I can’t find it anymore.

I understand that CS keeps the variables values, even if you rebuild your bot, but if you :reset it, the variables will be lost. Is it the same if I open and close CSserver and rebuild my chatbot several times, wil the variables values remain??
Thanks Advanced.

 

 
  [ # 124 ]

for example I would like to test this rule in an input pattern rule

u: SALUDO (%input = %userfirstline) this is the first line

and it works, but what about a value test like below???

u: SALUDO (%input-%userfirstline<3) this is the first or second line.

this doesn’t work, I’ve seen the Basic User manual about how to directly test a variable, but I don’t know if that is possible.
How I should do this? I want a pattern that only match if %input - %userfirstline <3

Thanks Advanced.

 

 
  [ # 125 ]

The values of variables remain across opening and closing CS and when you rebuild the bot.

They are lost after a :reset or if you manually delete the topic_user_bot.txt file in the users folder.


In patterns, use ^compute() when performing calculations:

u: SALUDO (^compute(%input - %userfirstline)<2)

(compare to 2 if you only want first and second lines)

 

 
  [ # 126 ]

Thanks Andy
Im concern about the CS in server mode behaviour,
how CS knows when a previous conversation has ended, and a new convesation has started, in order to update %userfirstline value??? does it count the hours, or days between the inputs internally, to deduce it has passed a day, and it should be a new conversation?
eg.
I have a chatbot that is talking with many user, and a conversation with a user AA has “ended”, bot keeps talking with several other users, and then after 30 minutes user AA talks to the bot again, does it count as the same conversation? or as a new conversation? I’m concern about this, because I want to predict the values of %input and %userfirstline.

Thanks Advanced.

 

 
  [ # 127 ]

Bruce will be the ultimate authority on the CS server mode (I typically use CS either as a local session for testing or hosted as a DLL in another process).

But from what I can see in the code, the %userfirstline is set whenever there is “no input”.

So for example, when a new local session is started the default CS client effectively sends a null input. In my situation, my bot client sends a null message when the user opens the chat window and that updates the %userfirstline. The conversation will also restart if the user sends nothing - I haven’t decided if I should filter those out or not yet.

Therefore it all depends on your client. If the user has to perform an action to open a chat window, then you could send a null input to the CS server to signal that this is a new conversation.

It doesn’t appear to be time based at all. So if your user doesn’t do anything for 4 hours and then sends real input, then CS will continue from where it left off. Whether that is desirable or not is up to your client, it could implement a timeout feature to send a null input when the user comes back.

 

 
  [ # 128 ]

or you can keep a time variable and check against that to see that such a delay happened all done in script

 

 
  [ # 129 ]

Thanks Bruce, thanks Andy,

Im currently running CS in server mode, but users don’t communicate with it via webbrowser, instead I gather all the usermessages and send them to CSserver via TCP connection from the same PC in which CSserver is placed, so I guess there is not a chance for the nul msg to be sent. Is the null msg sent in that escenario??? I really depend on it, in order to tell when a new conversation has began.

On the other hand, I understand that in order to keep track of a time variable, I would have to record a kinda timestamp and create an “elapsed time” varaible in every volley and if the “elapsed time” is greater than 4 hours, send the null msg? please Bruce correct me if Im wrong. How I would do that?

Thanks Advanced.
PD: is it possible to test
u: U_HOLA (^compute(%input - %userfirstline)<2 <<{~hola} {~quetal}>>)
IF (%originalinput == me llamo) {answer0}
IF (%originalinput == vivo en) {answer1}
Iwould like to test if %originalinput CONTAINS me llamo
or I just have to do…
u: U_HOLA0 (^compute(%input - %userfirstline)<2 <<{~hola} {~quetal} “me llamo”>>) answer0
u: U_HOLA1 (^compute(%input - %userfirstline)<2 <<{~hola} {~quetal} “vivo en”>>) answer1
Thanks again

 

 
  [ # 130 ]

Eduardo, you can certainly send a null user message (the 3rd part of the TCP message). See the description under the ChatScript protocol in the client/server documentation.

 

 
  [ # 131 ]

Doing a time check is pretty easy. I have something fairly similar:

topic: ~JOKES keep repeat (joke knock)

tHEARJOKE ()
 ^
keep()
 ^
repeat()
 
 
# Only need to ask at most once a day
 
^if (^timeToAsk(%topic 86400))
 
{
  
Do you want to hear a joke?
 

The ^timeToAsk macro is:

# Track how often (in seconds) a rule is invoked
# Fail if enough time has not elapsed
outputmacro: ^timeToAsk (^label ^frequency)

 @
= ^nofail(RULE ^query(direct_sv ^label lastAccessed 1))
 ^if (^
length(@0) == 0)
 
{
  
$$timeToAsk_last 0
 }
 
else
 
{
  
$$timeToAsk_last = @0object
 }

   
 
$$timeToAsk_diff = ^compute(%fulltime - $$timeToAsk_last)
 ^if ($
$timeToAsk_diff < ^frequency)
 
{
  
^fail(RULE)
 
}

 
^createattribute(^label lastAccessed %fulltime


That can be adapted to a use in a pattern by changing it to a dualmacro:

 

 

 

 

 
  [ # 132 ]

You can use ^refine() to further match the input after a common pattern.

uU_HOLA (^compute(%input - %userfirstline)<<<{~hola} {~quetal}>>)
      ^
refine()

      
a: (me llamoanswer0
      a
: (vivo enanswer1 

or nest even deeper if you want hola and quetal to go down different paths.

 

 
  [ # 133 ]

Hi Andy thanks for your support,
it worked fine
Is this what you mean by “nest even deeper”??

u: U_HOLA (^compute(%input - %userfirstline)<2 <<{~hola} {~quetal}>>)
    ^refine()
    a: (me llamo) answer0
    a: (vivo en) ^refine
        b: (hot country) you must have some shorts
        b: (cold country) you must have a coat
    a: (*~1) Hi how are you   # And I add this line, in case user only says “hola que tal”

I added the last line because I found that if I use these kind of rejoinders and the user says just “hola que tal” then the rule doesn’t match anything, So that last line wait for that alternative, am I right?

PD:
about the time variable and the macros you posted, I really have got a hard time trying to remember how the macros and dualmacros, work, currently I’m re-reading advanced manual.
Please andy could you explain a little more about how your script works?

Thanks advanced for your support again.

PD2:
I have found that this rule doesn’t work, if pattern after _~number contains any of áéíóúñ character, all other sign patterns worked ok (strictly tested)...
u: U_YO_TENGO_AÑOS (yo tengo _~number ános _0>30)  you are a ground up
please correct me if I’m wrong, any workaround, thanks advanced.

 

 
  [ # 134 ]

Hi andy,
I have realize that CS somehow has a problem recognizing my ~concepts, I have set…
concept: ~quetal [“que tal” “que tl” “q tal” “q tl” quetal quetl qtal qtl]
like the manual says, using quotes to declare a sequence of words inside a concept.

TOPIC: ~P_HOLA keep repeat [~hola ~quetal ~comoestar ~buenas]
u: U_HOLA (^compute(%input - %userfirstline)<9 <<{~hola} {~quetal}>>)
    ^refine()

    a: (me llamo) answer0
    a: (vivo en) answer1

But in the rule above I only get an answer when I type… hola qtl
but not when I type… hola que tal
also other concepts like ~buenas don’t recognize… “buenas noches”, only recognize… buenas
why is that???

It has something to do with my simplecontrol.top, it goes like this…
$cs_language = spanish
$cs_token = #DO_INTERJECTION_SPLITTING | #DO_ESSENTIALS | #DO_NUMBER_MERGE | #DO_DATE_MERGE | #DO_PROPERNAME_MERGE | #DO_SPELLCHECK | #DO_PARSE
$cs_response = #response_removespacebeforecomma | #response_alterunderscores | #response_removetilde

what does #response_removetilde do? does it replace áéíóú with aeiou?
please help, I’m stuck here
Thanks Advanced.

 

 
  [ # 135 ]

I FOUND THAT IF I TYPE… “que tal” (including the double quotes) CS RECOGNIZE THE CONCEPT ~quetal
BUT IF I JUST TYPE… que tal CS DOESN’T RECOGNIZE THE CONCEPT ~quetal


eb: > :prepare que tal
TokenControl: DO_ESSENTIALS DO_NUMBER_MERGE DO_PROPERNAME_MERGE DO_DATE_MERGE DO
_SPELLCHECK DO_INTERJECTION_SPLITTING


Original User Input: que tal
Tokenized into: que tal
Actual used input: que tal


Concepts:

1: que (raw):  +~pronoun +~pronoun_subject +~pronoun_bits +~pronoun_object +~pre
determiner
. +~determiner_bits +~determiner +~KINDERGARTEN +que //
1: que (canonical):  //

2: tal (raw):  +~pronoun +~pronoun_subject +~pronoun_bits +~pronoun_object +~adj
ective +~adverb
. +~predeterminer +~determiner_bits +~determiner +~adjective_normal +~KINDERGART
EN +tal //
2: tal (canonical):  //

Sequences:
+que_tal(1-2) +~quetal(1-2) +T~phola (1-2)
After parse TokenFlags: USERINPUT
EBSCB_A_IRC:
eb: >

 


eb: > :prepare “que tal”
TokenControl: DO_ESSENTIALS DO_NUMBER_MERGE DO_PROPERNAME_MERGE DO_DATE_MERGE DO
_SPELLCHECK DO_INTERJECTION_SPLITTING


Original User Input: “que tal”
Tokenized into: que_tal
Actual used input: que_tal


Concepts:

1: que_tal (raw):  +~noun_infinitive +~verb_present +~verb_bits +~verb_infinitiv
e +~noun +~verb +~adjective
. +~adverb +~adjective_normal +~noun_singular +~singular +~normal_noun_bits +~no
un_bits +~unknownword
. +que_tal +~quetal +T~phola //
1: unknown-word (canonical):  +unknown-word //  +que(1-0) +tal

Sequences:
After parse TokenFlags: USERINPUT
EBSCB_A_IRC:
eb: >


WHY IS THAT? DO I NEED TO MODIFY SOMETHING IN MY $cs_token???? CURRENTLY I HAVE IT LIKE THIS…
$cs_token = #DO_INTERJECTION_SPLITTING | #DO_ESSENTIALS | #DO_NUMBER_MERGE | #DO_DATE_MERGE | #DO_PROPERNAME_MERGE | #DO_SPELLCHECK

Thanks Advanced. Thanks for the support.

 

‹ First  < 7 8 9 10 11 >  Last ›
9 of 17
 
  login or register to react
‹‹ Web interaction      Why no direct_so query? ››