A "Text Analysis" Enrichment Service

This service sends the content of a story to an external text analysis service which returns some kind of results (a list of keywords, for example). One way of handling this would be to include a hidden "analysis" field in all the content types you want to be analyzed, to be used as a container for the keywords. Your enrichment service could then forward the content of all the visible fields to the analysis service, and add the keywords returned from the service to the hidden "analysis" field.

Here are the configuration settings for such a service:

enrichmentServices:
  - name: "Analyze text"
    href: http://my-web-service-host/analysis-service
    title: "Analyze text"
    triggers:
      - name: after-save-state-published
        properties: {}
        mimeTypes: ["x-ece/story"]

This configuration specifies that any "story-type" content items (content items that don't contain any binary fields such as video or images, and aren't live events or Newsgate stories) will be posted to the enrichment service at http://my-web-service-host/analysis-service when they are published.

When the enrichment service receives such a content item, it forwards the content from all the visible fields to a text analysis service. When it gets the results back from the text analysis service, it sends an HTTP 200 response back to CUE with an application/atom+xml body containing a copy of the original Atom entry posted by CUE. The only part of the Atom entry that is modified is the VDF payload. All the fields except the ANALYSIS field have been removed, and the ANALYSIS field now contains the keywords returned from the text analysis service:

    <vdf:payload xmlns:vdf="http://www.vizrt.com/types"
         model="http://host-ip-address/webservice/escenic/model/another">
      <vdf:field name="ANALYSIS"></vdf:field>
         <vdf:value>sport,football,brazil</vdf:value>
      </vdf:field>
    </vdf:payload>

When CUE receives this response from the enrichment service, it overwrites the ANALYSIS field of the content item with the value supplied by the enrichment service and publishes the content item. No other fields are modified.