Answer Server 12.13

# NLG

The `NLG` action generates a natural language sentence from a JSON specification that includes details of the parts of speech to use. You can use this action, for example, to generate user-friendly responses for a user interface in a programmatic way.

NOTE: You must use a POST request method.

You send the JSON specification in the Spec parameter. You can retrieve the schema for this JSON object by sending a GetResources action with Type set to `Schema`.

NOTE: You can use `NLG` only if your license permits it. To enable the `NLG` action, you must also include the `[NLG]` section in your configuration file, with Enabled set to `True`, and JarPath set to the location of your `SimpleNLG-4.4.8.jar` file.

## Example

    action=NLG&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.

## Required Parameters

The following action parameters are required.

Parameter | Description
--- | ---
Spec | A JSON object that defines the parts of speech that you want to use to generate natural language.

## Optional Parameters

This action accepts the following standard ACI action parameters.

Parameter | Description
--- | ---
ActionID | A string to use to identify an ACI action.
EncryptResponse | Encrypt the output.
FileName | The file to write output to.
ForceTemplateRefresh | Forces the server to load the template from disk.
Output | Writes output to a file.
ResponseFormat | The format of the action output.
Template | The template to use for the action output.
TemplateParamCSVs | A list of variables to use for the specified template.

## Response

You can retrieve the full response XSD by sending the GetResources action with Type set to `XSD`.

© Copyright 2016-2022 Micro Focus or one of its affiliates
Version 12.13 | Last updated October 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Answer Server 12.13

Topic Title: NLG