Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • normalizeTags (String array, optionalrequired) - List List of tag names to normalize on the output.
  • replaceTags (String array, optional) - Defaults to empty. If non empty, will only add entities of the given names in the whitelist to the JSON outputlist of tag names to apply the replace pattern to.
  • replacePattern (String, optional) - Defaults to empty. If non empty, will add any entity to the JSON output, except for the ones in the blacklistRequired when replaceTags is set. The pattern expects a %tag and/or %value, pattern will replace the appearance of tags from replaceTags with the pattern defined.
  • separator (String, optional) -  Default to single whitespace. Used to separate tokens
  • preferFlags (String array, optional) -  Defaults to empty. If non empty, when a token has multiple flags and one of them is in the preferFlags, it will take precedence over other flags to use the value of the token from that variation, i.e. LOWERED flag over original text version.


Code Block
languagejs
themeEclipse
titleExample Configuration
{
  "type": "JsonProducerStageMarkupProducerStage",
  "name": "JsonProducerMarkupProducer",
  "boundaryFlags": [
    "TEXT_BLOCK_SPLIT", "SENTENCE_SPLIT"
  ],
  "onlyEntitiesnormalizeTags": ["#", "measurement"],
  "replaceTags": true["ingredient"],
  "queueTimeoutreplacePattern": "<START:%tag> %value 10<END>",
  "queueRetriesseparator": 1" "
}



Example Output

If you have a text block like the following:

Code Block
languagetext
themeFadeToGrey
V-----------------------------------[300 ml of water Water. Use XX g of FLOUR]------------------------------------V 
^----------------[300 ml of water]Water]----------------V-------------------[Use XX g of FLOUR]-------------------^ 
^-[300]-V------[ml]-------V-[of]-V----[Water]-----^-[Use]-V-[XX]--V-------[g]-------V-[of]-V--V--[waterFLOUR]-----^ 
^-[{#}]-^-[{unit}]measurement}]-^      ^----[water]-----^-[haveuse]-^ 
-[xx]--^-[{measurement}]-^      ^----^ 

...

Code Block
languagejs
themeFadeToGrey
{"entities":[{
    "text":"300 ml",
    "value":[
[flour]-----^ 
                                      {
          "value":"300",
          "entity":"#"
^-[{#}]-^                  },
      ^-[{ingredient}]-^ 
          "value":"mililiters",
          "entity":"unit"
      }
    ],
    "entity":"measurement",
    "startPos":0,
    "endPos":6
}]}

or the following (if onlyEntities = false):

Code Block
languagejs
themeFadeToGrey
{"tokens":[
  {
    "text":"300 ml",
    "value":[
      {
          "value":"300",
          "entity":"#"
      },
      ^-[{ingredient}]-^ 
          "value":"mililiters",
             "entity":"unit"
      }
    ],
^-[{ingredient}]-^ 
       "entity":"measurement",
    "startPos":0,
    "endPos":6
  },
  {
    "text":"of",
    "startPos":7,
    "endPos":9
  },
  {
    "text":"water",
    "startPos":10,
    "endPos":15
  }
]}^-[{ingredient}]-^ 
the stage will produce the following output

Code Block
languagejs
themeFadeToGrey
{#} {measurement} of <START:ingredient> Water <END>
use {#} {measurement} of <START:ingredient> FLOUR <END>