适用于 Cloud Natural Language 的连接器

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

包含此代码示例的文档页面

如需查看上下文中使用的代码示例,请参阅以下文档:

代码示例

YAML

# This workflow demonstrates how to use the Cloud Language connector.
# The workflow analyzes some texts and returns "SUCCESS".
# Expected successful 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"
- classify_text:
    call: googleapis.language.v1.documents.analyzeSentiment
    args:
      body:
        document:
          type: ${docType}
          language: "en"
          content: "I love workflows!"
        encodingType: "UTF8"
- the_end:
    return: "SUCCESS"

后续步骤

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