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

Matching 2 words in a sentence
 
 

Hi , I am new to AIML., Is it possible to extract 3 words from a complete sentence
Ex : I want to rent a house in Dubai

Here I need to extract “rent”, “house”, “dubai” into different variable

 

 
  [ # 1 ]
<category>
<
pattern>I want to in *</pattern>
<
template>
<
star />
<
star index=“2” />
<
star index=“3” />
</
template
 

 
  [ # 2 ]

tnx

 

 
  [ # 3 ]

Just bear in mind that the above AIML category will also match other inputs, such as:

“I want to fly a plane in Tokyo”
“I want to fish for a bass in Australia”
“I want to learn acting so that I can win a prize for best male lead and then throw a party for all of the other actors in the movie”

If you want to isolate those exact words, another approach should be used, but before I can advise you I need more details about exactly what you’re trying to accomplish.

On the other hand, if those words are just a few example of words that you need to extract, then perhaps another way yet may be necessary. But again, I need more information on what you’re trying to do.

 

 
  [ # 4 ]

Totally agree that my example was very generic, but if you are learning AIML I think it gets you closer to a working solution

Longer term, I’d favour adding sets which provide a more restricted view on the terms for each *, so that it becomes


I want to <set>action</set> a <set>mode</mode> in <set>location</location></pattern>

Where
action = book, buy,  hire etc
model = ticket, flight, boat, train, car etc
location = Tokyo, Sydney, Edinburgh, etc

Then you’d want to srai “I want to” to make the sentene structure more generic too I think

But as you quite rightly state, you’d need a lot more info to truly build an accurate grammar

K

 

 
  [ # 5 ]

Not throwing stones here, Keith. your suggestion is spot on for a beginner to learn the simple stuff. I just wanted to point out that this could be more complex than one who is new to the field might expect. wink

 

 
  [ # 6 ]

Yes Correct smile There will be different words also in the place of * so in this case what will be the approach.
Thanks for the reply smile

Dave Morton - Jan 8, 2018:

Just bear in mind that the above AIML category will also match other inputs, such as:

“I want to fly a plane in Tokyo”
“I want to fish for a bass in Australia”
“I want to learn acting so that I can win a prize for best male lead and then throw a party for all of the other actors in the movie”

If you want to isolate those exact words, another approach should be used, but before I can advise you I need more details about exactly what you’re trying to accomplish.

On the other hand, if those words are just a few example of words that you need to extract, then perhaps another way yet may be necessary. But again, I need more information on what you’re trying to do.

 

 
  [ # 7 ]

Great smile , I will try this also - thanks., possible to give me a simple example
by the way, thanks all for taking my small queries serious smile ., I am really energized ! smile

Keith Sterling - Jan 8, 2018:

Totally agree that my example was very generic, but if you are learning AIML I think it gets you closer to a working solution

Longer term, I’d favour adding sets which provide a more restricted view on the terms for each *, so that it becomes


I want to <set>action</set> a <set>mode</mode> in <set>location</location></pattern>

Where
action = book, buy,  hire etc
model = ticket, flight, boat, train, car etc
location = Tokyo, Sydney, Edinburgh, etc

Then you’d want to srai “I want to” to make the sentene structure more generic too I think

But as you quite rightly state, you’d need a lot more info to truly build an accurate grammar

K

 

 
  login or register to react