1. Log all requests to the natural language agent,
recording whether the english input was correctly parsed
or not.
2. If the NL agent is NOT capable of parsing the request
(i.e., "parse failed") be able to propose a list of other
questions that could be suggested to the user.
You should be able to write an agent which installs a trigger,
asking the facilitator to send it a notification message with the
result of every nl_to_icl() request sent to the NL agent. This can
be used to log the input questions and resulting solutions, and perhaps
to provide the "hook" to use the input sentence to suggest alternative
queries.
To set the trigger, create an agent which responds to the solvable
"nl_results(Sentence, Results)", and after connection to the
Facilitator, install the following trigger (written here in Java):
// Connects to Facilitator
agentBean.connect();
// Adds a trigger: whenever the facilitator receives the results of an
// nl_to_icl() query, sends a notification message using the nl_results
// solvable.
agentBean.lib.addRemoteTrigger("event", "whenever", "OnReceive",
"event(AgtId,
solved(GoalId,FromAgt,nl_to_icl(Sent,Parse,Params),P,Solutions))",
"true", "post_query(nl_results(Sent,Solutions),[broadcast])");
Everytime DCG_NL receives a request, your agent should receive a copy of
the results
DCG_NL returns, where you can log them in a file or whatever.
Another part of your question asked whether your agent can have access
to the vocabulary
used by dcg_nl. In the latest version of dcg_nl (which I will send you
in a following
message), there is a solvable:
nl_word(Type, Def)
where you can read the definitions for any word used by DCG_NL. "Type"
may be one
of the following:
noun
verb
imp_verb
inf_verb
intr_v
intr_imp_v
pn
adj
adv
To read all noun definitions, for example, use
oaa.lib.solve("nl_word(noun, Def)","[]");
Definitions are stored as lists : [WordsSolvable,
[atom(word1),atom(word2)]]
so to read the definition for "mail", or to see if the noun "mail" is
defined, you could
try oaa.lib.solve("nl_word(noun, [Solvable, [atom(noun)]])", "[]").
Hope this helps!
-- Adam.