Versions Compared

Key

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

...

Code Block
{
  "connections": [
    { 
      "from": "twitter source",
      "to": "language tagger"
    },
    {
      "from": "language tagger",
      "selector": {
        "type": "fieldvalue",//switch based on the value of the "lang" field
        "field": "lang",
        "switch": {
          //output stage -> field value
          "categorizer": "en"
        },
        // optional. if doesn't match anything in outputs, go here.
        // if absent, record is dropped
        "default": "translator"
      }
    },
    {
      "from": "translator",
      "selector": {
        "type": "fieldvalue",
        "field": "lang",
        "switch": {
          "categorizer": "en"
        },
        "default": "invalid tweets table"
      }
    },
    {
      "from": "categorizer",
      "selector": {
        // switch based on the value returned by "type": "fieldvalue",the script
        "script": "function (input) {
          return input.spam;
        }",
        "switch": {
          "categorized tweets table": true,
          "invalid tweets table": false
        }
      }
    }
  ]
}

...