AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Topic that is always active?

What’s the easiest way (with harry) to make a topic that is always active, in which all rules are keep(), so any user input is always matched against persistent rules in the topic?

Unrelated: how many facts can ChatScript reasonably support?


  [ # 1 ]

first: declare the topic keep:  topic: ~mytopic keep ()
Now, if the topic has gambits, you have a problem because keeping gambits makes it hard to move on. So assume you dont have gambits.

The control script needs to directly call your topic using respond.  So… you could just put all your rules in ~keywordless and mark it keep, since keywordless is called from the control script if no other topic has a responder.

Define reasonably support.  CS can handle hundreds of thousands of facts.  Facts which are compiled in are best, since there is only a 1-time loading cost. Facts which are created on the fly will weigh down the user save file, so it gets a bit slower. By default you get 100 user facts but there is a command line parameter to change that. Having 5000 facts for the user is probably not a bad degredation in speed.


  [ # 2 ]

Thanks Bruce!

I’m experimenting with building a virtual travel agent in CS.  I’m waffling between loading significant world data as compiled facts vs. using calls to a webservice.  This information will be things like “best restaurant in Chicago” (for maybe 20 categories), connectedness of airport codes, sight seeing info, etc.  I’ll definitely need to talk to external services for things like checking current flight pricing.


  [ # 3 ]

What effect, if any, does adding keep() to ~keywordless have, since it’s called from the control script directly?


  [ # 4 ]

if keywordless lacks KEEP, then as it responds, it erases the rule, and that rule can never fire again.
Depends on the effect you want whether a rule should be kept or used once


  [ # 5 ]

Also, you have a choice in data between
in-memory facts
postgres db lookup
calling web service


  [ # 6 ]

Thanks Bruce, that worked.

So, I’m trying to build a simple travel agent.  Right now I’m getting a sense of the parser.

For matching things like “western canada”, “Spain”, “San Francisco”, or “LAX”, should I make a new concept combining ~countries, ~cities, etc., or is ~propername a better bet?  It also seemed like ~spacename should work, but I couldn’t get it to match.

How would you go about making a parser for flexible times, like “in two weeks”, “next wednesday at noon”, or “on july 2nd”?  I played with ~time_reference and ~dateinfo, but suspect there’s a more general way.  For example, this works

#! I want to go to Spain in 2 weeks.
s: ( ~travel_verbs *~2 _~propername *~1 _~number _~time_reference You are going to _0 in _1 _2

but it doesn’t match “in TWO weeks”, or more complex patterns around dates.

Also, I tried

s: ( ~travel_verbs *~2 _~propername *~2 _~dateinfo You are going to _0 on _1

thinking it would match “I want to go to Spain on thursday, nov 2nd.”, but it didn’t.

Is there an internal command to quickly test concepts or patterns against a trial input?


  [ # 7 ]

(I found :testpattern after posting.  Is there an equivalent for testing out queries, for example to explore facts or to try executing functions in order to see their output?)


  [ # 8 ]

:do   Execute the arguments as an output stream, e.g., invoke a function, set variables, etc”

As for how to match “in TWO weeks” or complex patterns around dates, you have to write script code.  I have a topic devoted to ripping apart dates and times but that’s internal, not open source.


  [ # 9 ]

:commands is an easy way to see all the debugging commands at once.


  [ # 10 ]

Thanks Bruce.  Do you have an example of a complicated topic for parsing some subset of a sentence, like identifying locations, dates, times, or something else that I could see by any chance?


  [ # 11 ]

Sorry, no. As I said, it’s internal. It’s about 100 rules to pull apart, year,month,date,time both absolute and relative to the current timeinfo.


  login or register to react