ChatterBot icon indicating copy to clipboard operation
ChatterBot copied to clipboard

Logic adapter for some kind of facet search

Open alex-dh opened this issue 9 years ago • 6 comments

I'm considering a problem where there may be a product database or some other searchable data set.

I'd like to be able to extract keywords and perform searches, and return responses that may interest the user.

It looks like I'd have to write a logic adapter, which I should be able to do as a developer. But I am unsure how to incorporate this into a training set, or whether a contextually aware sequence is possible.

E.g say I have cars, houses and trucks and a conversation goes like this:

"Hey there, I'd like to build a house, I'd like to know more about the Alto floorplans?" <searches database, finds House category, title Alto, 3 floorplans. Creates a new context.> "No problems, I can see 3 floorplans for Alto: 'Modern', 'Classic' and 'Entertainer'. How can I help with these?" "Which is the cheapest?" <Logic adapter detects an existing context, so further searches retain previous information. Price filter applied> "The Classic is our base range. Would you like to speak to a consultant about the classic?" "Yes please" <a "no" here would reset the context and release the logic adapter.> "Please enter your email address and / or phone number and we'll be in touch shortly!"

Is something like this possible, e.g. real time context-sensitive searches?

Apologies if this is the wrong forum for this question, happy to be pointed in the right direction. I'm just getting started with this stuff...

Thanks!

alex-dh avatar Dec 07 '16 02:12 alex-dh

Hi @alex-dh, this is an interesting question. Normally I would recommend just training the chat bot based on the available data but it sounds like you data source is something that gets changed externally.

I'll have to think about this, but I would definitely be interested in making changes to ChatterBot to better accommodate this functionality.

gunthercox avatar Dec 08 '16 12:12 gunthercox

Hi @gunthercox thanks for the reply, the data source would be external that's correct.

I am wondering if an efficient approach would be a middleware layer that generates faux-chats based on a heuristic, and outputs these as new training sets.

Is it possible to selectively "untrain" chatterbot, i.e to remove expired / outdated responses? Alternatively I could run a cron to reset / retrain on a regular basis.

alex-dh avatar Dec 09 '16 02:12 alex-dh

Sure, statements can be deleted using the remove method on the storage adapter: http://chatterbot.readthedocs.io/en/latest/storage/index.html#chatterbot.storage.JsonFileStorageAdapter.remove

gunthercox avatar Dec 09 '16 02:12 gunthercox

Thanks for the pointer, I have an inkling of an idea forming, something like this:

  1. Generate Corpus data from saved searches (middleware, simple heuristic or templated pattern replacements)
  2. Train Chatterbot on new corpus
  3. Remove old responses
  4. ...
  5. Profit?

I'll have a bit of a play and let you know how I get on. Ideally this would be a dynamic process but for our purposes this middleware would be pragmatic.

alex-dh avatar Dec 09 '16 02:12 alex-dh

@alex-dh were you able to solve this situation? I am in a similar situation and new to chatterbot.

@gunthercox did you work on this scenario? Please share your input.

Thanks.

kodeine avatar Jun 29 '19 22:06 kodeine

@kodeine I haven't had an opportunity to conduct any work towards this yet.

gunthercox avatar Jul 20 '19 18:07 gunthercox