Product Selector

Fusion 5.9
    Fusion 5.9

    NLP AnnotatorQuery pipeline stage configuration specifications

    Like the NLP Annotator index stage, the NLP Annotator query stage can be included in a query pipeline to perform Natural Language Processing tasks.

    Example of how to use NLP Annotator Query stage:
    1. Add the NLP Annotator query stage to the query pipeline.

    2. Supply the Model ID ("opennlp", "spacy", or the model ID given to the uploaded Spark NLP model).

    3. Specify the input parameter, label pattern and target parameter fields:

      query pipeline configuration

      • input parameter field: the Managed Fusion query parameter text, normally q since we want to annotate the raw query string to understand the intent.

      • label pattern: regex pattern that matches the NER/POS labels: for example, PER. will match extracted name entities with label PERSON, while NN. will match tagged nouns.

      • target parameter field: the outcome extraction/tagging, and.

        For the query stage, the result is set to be put in a new query parameter field: NLP annotator query result

    Query pipeline stage condition examples

    Stages can be triggered conditionally when a script in the Condition field evaluates to true. Some examples are shown below.

    Run this stage only for mobile clients:

    params.deviceType === "mobile"

    Run this stage when debugging is enabled:

    params.debug === "true"

    Run this stage when the query includes a specific term:

    params.q && params.q.includes("sale")

    Run this stage when multiple conditions are met:

    request.hasParam("fusion-user-name") && request.getFirstParam("fusion-user-name").equals("SuperUser");
    !request.hasParam("isFusionPluginQuery")

    The first condition checks that the request parameter "fusion-user-name" is present and has the value "SuperUser". The second condition checks that the request parameter "isFusionPluginQuery" is not present.

    Configuration

    When entering configuration values in the UI, use unescaped characters, such as \t for the tab character. When entering configuration values in the API, use escaped characters, such as \\t for the tab character.

    Annotate a query using NLP.

    skip - boolean

    Set to true to skip this stage.

    Default: false

    label - string

    A unique label for this stage.

    <= 255 characters

    condition - string

    Define a conditional script that must result in true or false. This can be used to determine if the stage should process or not.

    modelId - stringrequired

    Model ID

    inputParam - string

    Name of the request parameter to annotate using NLP

    >= 1 characters

    Default: q

    extractorRules - array[object]

    Define rules to extract annotated text into separate parameters

    object attributes:{extractedAnnotationType required : {
     display name: Annotation Type to Extract
     type: string
    }
    labelPattern required : {
     display name: Label Pattern
     type: string
    }
    targetParamName required : {
     display name: Target Parameter Name
     type: string
    }
    flattenList : {
     display name: Flatten Multiple
     type: boolean
    }
    }

    failOnError - boolean

    Flag to indicate if this stage should throw an exception if an error occurs while generating a prediction for a document.

    Default: false