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

extract first word within ‘_*
 
 

I am using _* to pick up the users name. However, if they put in words after this, I pick them up also.
I just want the first word in the string saved off.  I do not recall how to do this.
Here is an example.

my name is khan.. what is your name

u: ( [ I my ~possess] name [is be ~equals ] _*)
  $share_namecsmodified = ^original( _0)  $share_name = ^pos(capitalize $share_namecsmodified)  $cs_token = $stdtoken ^reuse(CONFIRM_NAMEIS)

in this case, _* is set to
Khan.. What Is Your Name
I just want it to be   Khan

How do I just pick off the first word of this string, please?

something like this?

u: ( [ I my ~possess] name [is be ~equals ] < _*-1)
  $share_namecsmodified = ^original( _0)  $share_name = ^pos(capitalize $share_namecsmodified)  $cs_token = $stdtoken ^reuse(CONFIRM_NAMEIS)

 

 

 
  [ # 1 ]

^burst

 

 
  [ # 2 ]

thank you, that was exactly what I needed to solve my challenge.

a: ( [ I my ~possess] name [is be ~equals ] _*)
  $share_namecsmodified = ^original( _0) 
                $share_name = ^pos(capitalize $share_namecsmodified) 
  @0 = ^burst($share_name ” “) # get first variable assigned
  $share_name = first(@0subject) # pick off first param

 

 
  login or register to react