Run Natural Language Generation
You run NLG by sending the NLG
action to Answer Server in a POST request method. You submit a JSON object, which contains details of the parts of speech that you want to use to generate a sentence, and the action returns the appropriate sentence.
curl http://localhost:12000/?action=NLG –F Spec={ "sentences": [ { "subject": { "noun_phrases": [ { "value": "the dog" }, { "value": "your giraffe" } ] }, "verb": { "verb_phrase": { "value": "chase", "modifiers": [ "quickly" ] } }, "object": { "noun_phrases": [ { "value": "the monkey" }, { "value": "George" }, { "value": "Martha" } ], "conjunction": "or" } } ] }
This action generates the following sentence:
The dog and your giraffe quickly chase the monkey, George or Martha.
You can retrieve the full schema for the JSON object to use by using the GetResources
action. See Find the JSON Schema for Your Update.