Cloud Natural Language 適用的連接器

工作流程連接器,用於定義內建函式,以便在工作流程中存取 Cloud Natural Language。

深入探索

如需包含這個程式碼範例的詳細說明文件,請參閱下列內容:

程式碼範例

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 範例瀏覽器