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

Burst sentence concept based
 
 

Hi there all.

Lets say i have this sentence:

i want to buy some apples some meat and then some fresh bananas and also sparkling water

Basically i need to split this sentence into parts so i can have a JSON array like this:

groceries {"APPLES""MEAT""FRESH BANANAS""SPARKLING WATER"

i already know how to use the ^burst() function where you can code like this

^burst($_sentence "some"

and the sentence is splitted into facts based on the “some"string

What if i define a concept like this:

~delimiters(and and_some and_then also also_some

and slpit the sentence based on all those words / phrases in the concept
Something like:

^burst($_sentence ~delimiters 

The above statement is not working.

Also i tried using burst sentence into words like this:

@= ^burst($_sentence)
    
$_length = ^length(@1)
    ^
loop($_length{
        $_nextword  
= ^first(@1)
        if (
$_nextWord ? ~delimiters... }

But it is not working since next word is a single word but in the concept i have some phrases.

Can someone help me achieve this?
Any method will be great. Thanks

 

 
  [ # 1 ]

u: (some _*1)  createfact, ^retry(RULE)

 

 
  login or register to react