查詢模式 (Dialogflow)

查詢模式定義使用者可能會說的範例詞組。Google 助理可以 使用自然語言比對出語意相似的使用者語音 和資料處理之間

查詢模式可以使用 schema.org 類型

常值字串

查詢模式可包含常值字串。

範例:"Start the guess the number game."

條件式

查詢模式的部分可視為選用。表示條件式 查詢模式,請用括號括住詞組的部分,並以括號括住 問號。以下範例將 Start the 定義為選用:

範例:"(Start the)? Guess the number game"

引數

查詢模式可透過使用 具名引數 (也可以視為變數)。引數 方法是使用下列語法指定:$Type:argument_name

範例:"$org.schema.type.Number:number" 描述一種查詢模式, 您需要輸入 Schema.org 號碼,而使用者實際的數字 表示將擷取到名為「數字」的引數中。

schema.org 類型

以下列出用於查詢模式支援的 Schema.org 類型:

類型 查詢模式範例 範例使用者查詢
$org.schema.type.Date 讀取我每天 $org.schema.type.Date:my_date 的簡訊內容 讀出 4 月 1 日的簡訊內容
$org.schema.type.Number 閃爍閃光燈 $org.schema.type.Number:number 次 將手電筒閃爍五次
$org.schema.type.Time 唸出 $org.schema.type.Time:my_time 的簡訊內容。 唸出下午 5 點的 sms Pro 訊息
$org.schema.type.DayOfWeek 顯示我在$org.schema.type.DayOfWeek:day_of_week 的會議。 顯示我週二的會議
$org.schema.type.Color 打開 $org.schema.type.Color:my_color 頻閃燈。 打開紅色頻閃燈
$org.schema.type.priceCurrency 在貨幣應用程式上顯示 $org.schema.type.priceCurrency:cur 的轉換率 在貨幣應用程式上顯示日圓的轉換率
$org.schema.type.Distance 顯示「$org.schema.type.Distance:dist」的轉換圖表 顯示以公里為單位的轉換圖表
$org.schema.type.Temperature 將溫度設為 $org.schema.type.Number:numdegree$org.schema.type.Temperature:temp 將溫度設為華氏 70 度
$org.schema.type.Organization 觀看 $org.schema.type.Organization:organization 的精彩回顧 觀看湖人隊精彩集錦
顯示$org.schema.type.Organization:organization 的股價 顯示 Google 的股價
$org.schema.type.Person 顯示前 10 大 $org.schema.type.Person:musician 歌曲 顯示 10 大火星前 10 首歌
顯示有關 $org.schema.type.Person:person 顯示帳單閘門的相關新聞
$org.schema.type.Place $org.schema.type.Place:place 撰寫評論給紐約
顯示 $org.schema.type.Place:location 的路況 山景城顯示路況
$org.schema.type.Product $org.schema.type.Product:product 撰寫 Google 玻璃的評論
$org.schema.type.Book 閱讀 $org.schema.type.Book:my_book
$org.schema.type.Movie 播放《$org.schema.type.Movie:my_movie》 評論《北非諜影》
$org.schema.type.TVSeries 播放 $org.schema.type.TVSeries:tv_series 的下一集 播放好友的下一集
$org.schema.type.servesCuisine 顯示 $org.schema.type.servesCuisine:my_cuisine 餐廳 顯示義大利餐廳
$org.schema.type.MusicAlbum 將 $org.schema.type.MusicAlbum:Album 新增至我的佇列。 在待播清單中加入修道院道路
$org.schema.type.MusicRecording 將 $org.schema.type.MusicRecording:song 加入收藏。 加入或離線加入我的收藏
$org.schema.type.YesNo $org.schema.type.YesNo
$org.schema.type.URL 新增 $org.schema.type.URL 新增 google.com
$org.schema.type.Email 新增 $org.schema.type.Email 新增 john@google.com
$org.schema.type.PhoneNumber 新增 $org.schema.type.PhoneNumber 新增 (777) 777-7777
$org.schema.type.Text 像是哪首歌的「$org.schema.type.Text」 對方說你「陽光」的那首歌是什麼?

自訂類型

customTypes 物件可讓您指定自己的類型。您可以定義 自訂類型的 name,並在 items 中加入下列欄位:

  • key:與 synonyms
  • synonyms:使用者可能會提及 key 的可能方式

以下範例針對不同的 使用者可能會說出「上午 6 點」。

"customTypes": [
    {
      "name": "$MorningOptions",
      "items": [
        {
          "key": "6am",
          "synonyms": [
            "6 am",
            "6 o clock",
            "oh six hundred",
            "6 in the morning"
          ]
        }
      ]
    }
  ]