8
$\begingroup$

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!

$\endgroup$
  • 2
    $\begingroup$ It's a good question. It seems likely that this was only meant to work with cloud objects, but the documentation doesn't say that. $\endgroup$ – C. E. Aug 10 '18 at 14:59
  • $\begingroup$ Maybe ask WRI for this feature $\endgroup$ – M.R. Sep 26 '18 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.