It is a question regarding formal grammar. I have a grammar rule addition
as below:-
addition =
CloudDeploy[
GrammarRules[{FixedOrder["add", a : GrammarToken["SemanticNumber"],"and", b : GrammarToken["SemanticNumber"]] :> a + b}]
]
And when I apply the grammar rule, I have 13
as output:-
GrammarApply[addition, "add six and seven"]
But the above codes used CloudDeploy
. I want to run the code offline (i.e. without using CloudDeploy
). I tried to remove CloudDeploy
from addition
as addition2
below, but addition2
doesn't work:-
addition2 =
GrammarRules[{FixedOrder["add", a : GrammarToken["SemanticNumber"],"and", b : GrammarToken["SemanticNumber"]] :> a + b}]
GrammarApply[addition2, "add six and seven"]
Error message that I got:-
GrammarApply::arg1: The first argument GrammarRules[{FixedOrder[add,a:GrammarToken[SemanticNumber],and,b:GrammarToken[SemanticNumber]]:>a+b}] is expected to be a CloudObject or list of CloudObject.
How can I run GrammarApply
offline? Many thanks!