royaltca
Pro
Posts: 33
Joined: Mon Mar 30, 2015 5:18 pm

Shouldn't this work?

Fri Jun 19, 2015 11:40 pm

Code: Select all

<Siml>
  <Concept Type="public" Name="Hello Bot">
    <Model>
      <Pattern><If User="NAME" Defined="False">*</If></Pattern>
      <Response>What is your name?</Response>
    </Model>

  </Concept>
</Siml>
Is this bug or am I doing something wrong?

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Shouldn't this work?

Sun Jun 21, 2015 3:57 am

Though that is not the right way of using If condition inside a Pattern element. You are right. The conditional If element was accidentally disabled for testing purpose in 1.1.3. We will enable it in the upcoming 1.1.4 version of Syn Bot which will released within 48 hours.

Thank you for reporting the Bug.

royaltca
Pro
Posts: 33
Joined: Mon Mar 30, 2015 5:18 pm

Re: Shouldn't this work?

Mon Jun 22, 2015 12:31 am

Could you tell me about conditions inside a pattern? What is the right way? I need a pattern with activates only when specific variable has certain value and user said something.

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Shouldn't this work?

Mon Jun 22, 2015 3:20 am

There a multiple ways of doing this with your Chatbot
  • On your application why not start by asking the user name and once the response is received, set the user name, and then initialize the Chatbot
  • Use the "Initial-Concept" UserSettings variable to set the initial private concept.

    First under UserSettings add the following.

    SIML Code

    <Variable Name="initial-concept" Value="Startup-Concept" />
    and create a private concept as shown below

    SIML Code

    <Siml>
      <Concept Name="Startup-Concept" Type="Private">
        <Model>
          <Pattern>*</Pattern>
          <Response>What is your name?</Response>
          <Model>
            <Pattern>
              <Item>My name is *</Item>
              <Item>*</Item>
            </Pattern>
            <Response>Good to know you, <User Set="name"><Match /></User></Response>
          </Model>
    
        </Model>
    
      </Concept>
      <Concept Name="Random-Concept">
        <Model>
          <Pattern>HI</Pattern>
          <Response>hi there <User Get="name" /></Response>
        </Model>
    
      </Concept>
    </Siml>
  • Or you can create an If condition that will be executed only once per chat session as shown below.

    SIML Code

    <Siml>
      <Concept Name="Startup-Concept" Type="Public" xmlns:Think="http://syn.co.in/2014/siml#think">
        <Model>
          <Pattern>
            <If User="Name" Defined="False" />
          </Pattern>
          <Response>What is your name?<User Think:Set="name" Value="Unknown" /></Response>
          <Model>
            <Pattern>
              <Item>My name is *</Item>
              <Item>*</Item>
            </Pattern>
            <Response>Good to know you, <User Set="name"><Match /></User></Response>
          </Model>
    
        </Model>
    
      </Concept>
    </Siml>

royaltca
Pro
Posts: 33
Joined: Mon Mar 30, 2015 5:18 pm

Re: Shouldn't this work?

Mon Jun 22, 2015 3:31 am

Code: Select all

<Model>
      <Pattern>
        <If User="Name" Defined="False" />
      </Pattern>
      <Response><Goto><Match/></Goto>And what is your name?</Response></Model>
and how about that? does Match tag work here, cuz there aren't any wildcards.?

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Shouldn't this work?

Mon Jun 22, 2015 3:38 am

The Match element looks only for textual tokens or words. Once an If condition is matched by the GraphMaster it disregards any other token and starts looking for Previous elements.

In the your code the Match element doesn't capture any token (as If conditions are not treated as Word tokens). Using an If condition without a condition breaker (as shown in my code above) will result in a response loop from the same Model.

royaltca
Pro
Posts: 33
Joined: Mon Mar 30, 2015 5:18 pm

Re: Shouldn't this work?

Mon Jun 22, 2015 3:47 am

SIML Code

<Model>
<Pattern><If User="TRIGGER" Value="ON">_</If></Pattern>
<Response>
<Think><User Set="TRIGGER">OFF</User></Think>
<GotoMatch/><Goto>RANDOM QUESTION</Goto>
<Think><User Set="TRIGGER">ON</User></Think>
</Response>
</Model>
Basicly I tried to achive something like above, but if I cannot use the conditions this way I must look for another solution. I need this, because I need something to happen after every model. Every single one. And adding this to every Model is not very comfortable.

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Shouldn't this work?

Mon Jun 22, 2015 4:26 am

Are you trying to create a random response after every Model has been evaluated ? Like a random question if no pattern is found ?

Or do you want something/event to happen after a response is generated ?

royaltca
Pro
Posts: 33
Joined: Mon Mar 30, 2015 5:18 pm

Re: Shouldn't this work?

Mon Jun 22, 2015 4:37 am

I want to something to happen every time, I mean things like: add some text (the same text) to each response given from the Bot (without manually including it in each model), set variable to count how many responses bot generated and other things, posibilities are limitless I think.

let's say

SIML Code

<Model>
<Pattern>Hi</Pattern>
<Response>Hi</Response>
</Model>

<Model>
<Pattern>How are you</Pattern>
<Response>Fine, thanks</Response>
</Model>

<Model>
<Pattern>Where are you</Pattern>
<Response>In the machine</Response>
</Model>
for these and for all other models bot has in base I want the response to be text between matched model's<Response> tag + response from another model:

SIML Code

<Model>
<Pattern>THIS WILL BE ADDED TO ALL RESPONSES</Pattern>
<Response>
<Random>
<Item>.</Item>
<Item>:)</Item>
<Random>
</Response>
</Model>

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Shouldn't this work?

Mon Jun 22, 2015 5:02 am

My apologies I didn't get you the first time.

Because it seems like an attempt to achieve something outside SIML. Though I would have added a Filter that replaces a special word on every Response within a Model I reckon this is better done with application code than handling it using SIML.

Here is a simple C# Code that should explain.

CSharp Code

var result = bot.Chat("how are you");
string[] symbols = { ".", ":)", ":D", "!" };
var randomSymbol = symbols[new Random().Next(0, symbols.Length)];
var botMessage = result.BotMessage + randomSymbol;//Bot message with a random symbol.
If you don't mind I will move this to Suggestions .

Return to “Feature Request and Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest