适用于 Cloud Natural Language 的连接器

定义用于在工作流内访问 Cloud Natural Language 的内置函数的 Workflows 连接器。

深入探索

如需查看包含此代码示例的详细文档,请参阅以下内容:

代码示例

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"

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器