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

Problems with querying user defined facts
 
 

Hi there,

I’m doing a Proof of Concept to build a chatbot using ChatScript. Basically the bots can help explain banking terms. However, I ran into some issues to query the fact table. Some works and some doesn’t. Hope you can help me with that.

Here is the fact table I created:
concept: ~bank_term()

table: bank_term_table (^term ^description)
^createfact (^term member ~bank_term)
^createfact (^term mean ^description)
data:
“acceptance letter of credit” “A letter of credit available \“by acceptance\” calling for a time draft (or usance draft), drawn on an intermediate accepting bank, that the drawee (payer) has accepted and is unconditionally obligated to pay at maturity.”
“advance payment” “The buyer delivers payment to the seller before the seller releases the goods. Some sellers ask for this payment to show good faith on the part of the buyer and also to enhance their cash flow related to the sale of particular custom-made items.”
“bill of exchange” “A written, unconditional order, signed by the drawer and addressed to the drawee, to pay a sum of money at a fixed or future date to the order of the payee or to the bearer.”
“deferred payment letter of credit” “A letter of credit in which the payment is deferred to a specific later date.”


Here is a snippet of the rule:
u: (_~bank_term)
Here is the explaination for _0: \n
if (^query(direct_sv _0 mean ?))
{
_0 means ^"\"@0object\""
}
else
{
Oops, for some reason, I cannot locate the answer for you.
}

The above rule works for “bill of exchange”, but doesn’t work for others. I did do a dump of all facts using a debug command, and it did show all the facts there as excerpted below:
( acceptance_letter_of_credit mean `A_letter_of_credit_available_\“by_acceptance\“_calling_for_a_time_draft_(or_usance_draft),_drawn_on_an_intermediate_accepting_bank,_that_the_drawee_(payer)_has_accepted_and_is_unconditionally_obligated_to_pay_at_maturity.` x100000 )
( advance_payment mean The_buyer_delivers_payment_to_the_seller_before_the_seller_releases_the_goods_._Some_sellers_ask_for_this_payment_to_show_good_faith_on_the_part_of_the_buyer_and_also_to_enhance_their_cash_flow_related_to_the_sale_of_particular_custom-made_items. x100000 )
( bill_of_exchange mean A_written,_unconditional_order,_signed_by_the_drawer_and_addressed_to_the_drawee,_to_pay_a_sum_of_money_at_a_fixed_or_future_date_to_the_order_of_the_payee_or_to_the_bearer. x100000 )
( deferred_payment_letter_of_credit mean A_letter_of_credit_in_which_the_payment_is_deferred_to_a_specific_later_date. x100000 )
( pengbot defaultbot defaultbot x100000 )


I have spent a few hours and tried different things, but could not get that working.

Will appreciate if you can help me here.

Thanks

Peng

 

 
  [ # 1 ]

Any one can help me on this?

Thanks

Peng

 

 
  [ # 2 ]

Just some pointers as I’m not investigating parsing or wildcard handling at the moment.

If you enter “advance_payment” (commas just for we humans, not ChatScript) the sample works OK (version 7.52 on Linux), but not if the two words are space-separated. In contrast “bill of exchange” works in either form.

Tracing shows that the table lookup when no spaces are given are “advance payment” and “bill_of_exchange” respectively, and the divergence is clear in the fourth line the two following two samples:

....,....,try u:2.0 @0:      pattern: ( _~bank_term )
....,....,( _~bank_term(advance…payment)+ )+
....,....,  **  Match: u:  ( _~bank_term ) ^keep ( ) ^repeat ( ) Here ...
....,....,  Wildcards: _0=advance payment / advance payment (1-2) 

....,....,try u:2.0 @0:      pattern: ( _~bank_term )
....,....,( _~bank_term(bill…exchange)+ )+
....,....,  **  Match: u:  ( _~bank_term ) ^keep ( ) ^repeat ( ) Here ...
....,....,  Wildcards: _0=bill of exchange / bill_of_exchange (1-3) 

If I were investigating further, I’d start by looking at the fact that it thinks the first is a command with an implied “you” and the second is not a sentence, but that’s just a WAG.

As an aside, table lookup seems a brittle way of dealing with your stated use case, and seems to bypass a lot of reasons why one would choose ChatScript in the first place.

 

 
  [ # 3 ]

if (^query(direct_sv _0 mean ?))  should be ‘_0 because you are looking for the original form typed by user.

Also, your table does NOT tell table to keep quoted expresssions as is, so all spaces are converted to underscores. Since you $cs_wildcardseparator appears to be a space, not an underscore, your match is ‘advance payment’ which when queried for facts, does not match ‘advance_payment’

 

 
  [ # 4 ]

Thank you so much Bruce and Robert. Per Bruce’s suggestion, I made it working by just adding the following in the control script:
    $cs_wildcardseparator = “_”

Thank you!

Peng

 

 
  login or register to react