Skip to content

Instantly share code, notes, and snippets.

@g-leech
Created May 22, 2020 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g-leech/2bed3af50a7e692a84e8e434d2441d21 to your computer and use it in GitHub Desktop.
Save g-leech/2bed3af50a7e692a84e8e434d2441d21 to your computer and use it in GitHub Desktop.
def handle_utterance_str(text) :
if text[0] != "'" and text[0] != '"' :
text = f'"{text}"'
text = text.replace('"', '\"')
text = text.replace("'", '\"')
return "handle_utterance(1,{},Output)".format(text)
def escape_and_call_prolexa(text) :
libPrefix = "prolexa:"
return pl.query(libPrefix + handle_utterance_str(text))
#out = pl.query("prolexa:handle_utterance(1,\"Peter is mortal\",Output)", catcherrors=True)
#
out = escape_and_call_prolexa('"Peter is mortal"')
list(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment