Connector for Cloud Natural Language

Workflows connector that defines the built-in function used to access Cloud Natural Language within a workflow.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

# This workflow demonstrates how to use the Cloud Language connector:
# Analyze and classify text samples and log the results
# Expected output: "SUCCESS"
- init:
    assign:
      - docType: "PLAIN_TEXT"
- analyze_entities:
    call: googleapis.language.v1.documents.analyzeEntities
    args:
      body:
        document:
          type: ${docType}
          language: "en"
          content: "Eiffel Tower"
        encodingType: "UTF8"
    result: response_analyze
- log_analyze_result:
    call: sys.log
    args:
      data: ${response_analyze}
      severity: "INFO"
- classify_text:
    call: googleapis.language.v1.documents.analyzeSentiment
    args:
      body:
        document:
          type: ${docType}
          language: "en"
          content: "I love Workflows!"
        encodingType: "UTF8"
    result: response_classify
- log_classify_result:
    call: sys.log
    args:
      data: ${response_classify}
      severity: "INFO"
- the_end:
    return: "SUCCESS"

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.