i’m trying to disambiguate using (asking for object…) but with a number instead of an object. it seems like this should work:
(grammar [turn [object] right to [number]] for [turn $ right to $])
(grammar [turn [object] right to] for [turn $ right to])
(perform [turn $Obj right to])
Turn (the $Obj) right to...?
(asking for object in [turn $Obj right to []])
(perform [turn $Obj right to $N])
You turn (the $Obj) to $N.
but the response is always “You turn the … to ?.”
i suspect i’m supposed to somehow unpack the disambiguated object?
Have you tried extending the technique we discussed here for topics to numbers? Numbers are not objects after all.
asking for number extension
(understand $Words as $Action)
(implicit action is $Implicit)
(if) (implicit action wants number) (then) %% added for number
*(understand $Words as number $O) %% coverage
(if) (implicit action wants topic) (then) %% added for topic
*(understand $Words as topic $O) %% coverage
(elseif) (implicit action wants direction) (then)
*(understand $Words as direction $O)
(else)
%% We don't know the correct policy, so fall back on 'non-all'.
*(understand $Words as non-all object $O)
(endif)
(recover implicit action $Implicit $O into $Action)
%% added for number coverage
(interface (asking for number in $<Action))
(asking for number in $Action)
(now) (implicit action is $Action)
(now) (implicit action wants number)
(now) ~(implicit action wants direction)
(now) ~(implicit action wants topic) %% added for topic coverage
(tick) (stop)
%% added for topic coverage
(interface (asking for topic in $<Action))
(asking for topic in $Action)
(now) (implicit action is $Action)
(now) (implicit action wants topic)
(now) ~(implicit action wants number) %% added for number coverage
(now) ~(implicit action wants direction)
(tick) (stop)
(asking for object in $Action)
(now) (implicit action is $Action)
(now) ~(implicit action wants number) %% added for number coverage
(now) ~(implicit action wants direction)
(now) ~(implicit action wants topic) %% added for topic coverage
(tick) (stop)
(asking for direction in $Action)
(now) (implicit action is $Action)
(now) (implicit action wants direction)
(now) ~(implicit action wants number) %% added for number coverage
(now) ~(implicit action wants topic) %% added for topic coverage
(tick) (stop)
(try-complex $ComplexAction) (just) %% added (just) for override
(if) ~(action $ComplexAction preserves the question) (then)
(now) ~(implicit action is $)
(now) ~(implicit action wants number) %% added for number coverage
(now) ~(implicit action wants direction)
(now) ~(implicit action wants topic) %% added for topic coverage
(endif)
(if) ~(allowed action $ComplexAction) (then)
(report disallowed action $ComplexAction)
(tick) (stop)
(elseif) ([] is one of $ComplexAction) (then)
You're not aware of any such thing!
(tick) (stop)
(else)
(strip decorations from $ComplexAction into $MultiAction)
%% Now we have something like:
%% [put [#marble1 #marble2 #marblefloor] #in #bowl]
(if)
*($Obj is one of $MultiAction)
{
(nonempty $Obj)
(or)
(object $Obj)
~(direction $Obj)
~(relation $Obj)
~(room $Obj)
}
(then)
(notice player's $Obj)
(endif)
(if) *($List is one of $MultiAction) (nonempty $List) (then)
(exhaust) {
*(regroup stripped action $MultiAction of
$MultiAction into $Regrouped $Multi)
%% Assuming the marbles are fungible, now we
%% are backtracking over:
%% [put [#marble1 #marble2] #in #bowl]
%% [put #marblefloor #in #bowl]
(if)
~(empty $Multi)
(then)
%% If at least two multi-actions are
%% implied, describe each step.
(line)
(if) (library links enabled) (then)
(link) (The full $Multi)
(else)
(The full $Multi)
(endif)
:
(endif)
(try regrouped $Regrouped)
}
(else)
%% Optimize the common case.
(try regrouped $MultiAction)
(endif)
(endif)
the intent is to dig with a shovel in a specific direction. this is all done through links and a disambiguating status bar.
(grammar [dig [direction] with [held]] for [dig $ with $])
(perform [dig $Dir with $Obj])
You dig (name $Dir) with (the $Obj) and something great happens...
(grammar [dig with [held]] for [dig with $])
(perform [dig with $Obj])
(now)(digging disambiguation mode) %% calls up new status bar using (get digging directions) to list direction links
(inhibit next tick) %% the disambiguation shouldn't count
Dig in what direction?
(asking for object in [dig [] with $Obj])
(get digging directions)
(link)(#north)
(link)(#south)
(link)(#east)
(link)(#west)
i have this code from nephar that would seem to already do the trick.
(understand $Words as $Action)
(implicit action is $Implicit)
(if) (implicit action wants number) (then) %% added for number
*(understand $Words as number $O) %% coverage
(elseif) (implicit action wants topic) (then) %% added for topic
*(understand $Words as topic $O) %% coverage
(elseif) (implicit action wants direction) (then)
*(understand $Words as direction $O)
(else)
%% We don't know the correct policy, so fall back on 'non-all'.
*(understand $Words as non-all object $O)
(endif)
(recover implicit action $Implicit $O into $Action)
(asking for direction in $Action)
(now) (implicit action is $Action)
(now) (implicit action wants direction)
(now) ~(implicit action wants number) %% added for number coverage
(now) ~(implicit action wants topic) %% added for topic coverage
(tick) (stop)
but it still doesn’t work. when a direction is entered for the follow-up question, it’s interpreted as going in that direction.
and i’ve noticed that the (asking for direction in $Action) predicate is never even queried.