Apologies if this is such a newbie question, but I am using an LLM to generate text that I want to assert as Ergo fact e.g. claim(1, ' the sky is red'). The strings I get back from the http post query are just that, is there an easy way to convert? I want to insert{claim(1, ' the sky is red') not insert{'claim(1, ' the sky is red')'}. --
Yes, it is explained in the programmer's manual, section
Reading and Compiling Input Terms
see readAll.
For instance,
ergo> string('${p(a,b)}.')[readAll(?Result)]@\parse, ?Result=[code(?Term, ?)@\plg], insert{?Term}.
?Result = [code(p(a,b),[ok, eof])@\prolog]
?Term = p(a,b)
ergo> p(?X,?Y).
?X = a
?Y = b
ergo> string('${obj[m->123]}.')[readAll(?Result)]@\parse,
?Result=[code(?Term, ?)@\plg], insert{?Term}.
?Result = [code(${obj[m->123]@main},[ok, eof])@\prolog]
?Term = ${obj[m->123]@main}
ergo> ?a[?m->?r].
?a = obj
?m = m
?r = 123