ประเภท
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ประเภทช่วยให้คุณกำหนดค่า Assistant NLU ได้ (การทำความเข้าใจภาษาธรรมชาติ)
เครื่องมือแยกข้อมูลที่มีโครงสร้างจากข้อมูลของผู้ใช้ คุณ
สามารถใช้ประเภทในสถานการณ์ต่อไปนี้
ในความตั้งใจ คุณจะใส่คำอธิบายประกอบในวลีการฝึกได้ด้วยประเภท
สร้างสล็อต เมื่อผู้ใช้พูดข้อความที่ตรงกับช่อง เครื่องมือ NLU
จะแยกออกมาเป็นพารามิเตอร์ที่พิมพ์ เพื่อให้คุณประมวลผลในฉากได้
ภายในขั้นตอนการเติมช่องของฉาก คุณจะระบุได้
ช่องโฆษณาหลายช่องที่คุณต้องการให้ผู้ใช้ระบุก่อนที่จะทำได้
การเปลี่ยนหรือออกจากฉาก
ภายในขั้นเงื่อนไขของฉาก คุณจะกำหนดฐานได้
ใช้ตรรกะว่าพารามิเตอร์มีค่าหนึ่งๆ ที่กำหนดไว้ในประเภทหนึ่งๆ หรือไม่
ประเภทที่กำหนดเอง
ประเภทที่กำหนดเองให้คุณสร้างข้อกำหนดประเภทของคุณเองเพื่อแจ้ง NLU ให้
กำหนดชุดของค่าให้กับคีย์เดียว คุณสามารถระบุประเภทต่างๆ ได้ใน
ด้วยวิธีต่อไปนี้
- คำและคำพ้องความหมายช่วยให้คุณจับคู่ค่าหลายค่ากับคีย์เดียวได้
ซึ่งเรียกว่ารายการ ประเภทอาจมีเพียง 1 รายการหรือหลายรายการก็ได้ หากคุณ
เลือกตัวเลือกนี้ คุณยังสามารถเปิดใช้งานการตั้งค่า NLU ต่อไปนี้:
- เปิดใช้การจับคู่แบบ Fuzzy - ฟีเจอร์นี้อนุญาตให้มีรายการที่มีมากกว่าหนึ่งรายการ
คำที่จะจับคู่ แม้ว่าคำดังกล่าวมีการพูดในลำดับที่ต่างกันก็ตาม
- ยอมรับค่าที่ไม่รู้จัก - เมื่อคุณระบุค่าที่เป็นไปได้ทั้งหมดไม่ได้
ตัวประมวลผลภาษาสามารถยอมรับคำหรือวลีที่ไม่รู้จักซึ่งอิงจากสภาพแวดล้อม
ข้อมูลการฝึกป้อนและความตั้งใจ เช่น สินค้าที่อาจเพิ่มลงในร้านขายของชำ
รายการ
- นิพจน์ทั่วไปช่วยให้ประเภทจับคู่ค่าโดยใช้ "ปกติ"
รูปแบบนิพจน์ตาม
มาตรฐาน RE2 ของ Google
- ข้อความรูปแบบอิสระช่วยให้สามารถจับคู่ประเภทได้
ทุกอย่างที่ผู้ใช้พูด ใช้คำอธิบายประกอบ
Intent ประเภทนี้ช่วยให้คุณใช้อินพุตทั้งหมดเป็นพารามิเตอร์
สามารถเชื่อมต่อไปยัง NLU ของคุณเอง
ประเภทของระบบ
ประเภทระบบช่วยให้คุณใส่คำอธิบายประกอบและแยกข้อมูลที่รู้จักจากข้อมูลที่ผู้ใช้ป้อนได้
โดยใช้ข้อมูลและค่าการฝึกที่ระบบมีให้ ประเภทของระบบดังต่อไปนี้
รองรับ
ประเภท |
คำอธิบาย |
actions.type.DateTime |
มีวันที่ เวลา และเขตเวลาตามการตั้งค่าอุปกรณ์ของผู้ใช้
ใช้ได้สำหรับการเติมช่องโฆษณาและคำอธิบายประกอบข้อความการฝึกอบรม
|
actions.type.Date |
ประกอบด้วยวันที่เท่านั้น ใช้ได้กับการเติมช่องโฆษณาเท่านั้น |
actions.type.Time |
มีเวลาเท่านั้น ใช้ได้กับการเติมช่องโฆษณาเท่านั้น |
actions.type.Number |
ประเภท Number ตรงกับเลขลําดับและ Cardinal
ตัวเลข |
การใช้งาน DateTime
, Date
และ Time
ประเภทดังกล่าวจะมีลักษณะแตกต่างกันไปตามตำแหน่งที่คุณใช้ประเภท และ
จากผู้ใช้ที่ตรงกับประเภทนั้นๆ
การใช้ Intent
การใส่คำอธิบายประกอบวลีการฝึกใน Intent จะรองรับประเภท DateTime
เท่านั้น ผู้ใช้
ไม่จำเป็นต้องตรงกับค่า DateTime
ทั้งหมด เช่น หากผู้ใช้
ระบุเฉพาะปี พารามิเตอร์เซสชันอาจมีลักษณะดังนี้
"date_time": {
"year": 2019
}
การใช้กับการเติมเต็มช่อง
การเติมช่องรองรับ DateTime
, Date
และ Time
- หากประเภทช่องโฆษณาคือ
DateTime
Assistant จะแจ้งให้ผู้ใช้จนกระทั่ง
ที่ระบุ
- หากประเภทช่องโฆษณาคือ
Date
Assistant จะแจ้งให้ผู้ใช้จนถึงวันที่
ที่ระบุ เมื่อรวบรวมแล้ว พารามิเตอร์ที่คุณได้รับคือ
DateTime
ที่มีเวลาที่ตั้งไว้เป็น 00:00
- หากประเภทช่องโฆษณาคือ
Time
Assistant จะแจ้งให้ผู้ใช้จนถึงเวลา
ที่ระบุ เมื่อรวบรวมแล้ว พารามิเตอร์ที่คุณได้รับคือ
DateTime
ออบเจ็กต์ที่ตั้งค่าวันที่เป็นวันที่ปัจจุบัน
ตัวอย่างเช่น สมมติว่าผู้ใช้ในลอสแอนเจลิสพูดว่า "Ok Google สร้างการช่วยเตือน
ของวันที่ 15 มกราคม 2024 เวลา 20:00 น." เมื่อดึงข้อมูล DateTime
เป็นส่วนหนึ่งของช่องโฆษณา
กระบวนการเติมข้อความ พารามิเตอร์แบบเต็มอาจมีลักษณะดังนี้
"date_time": {
"day": 15,
"hours": 20,
"minutes": 0,
"month": 1,
"nanos": 0,
"seconds": 0,
"time_zone": {
"id": "America/Los_Angeles"
},
"year": 2024
}
การใช้เงื่อนไข
เงื่อนไขอนุญาตให้ใช้ตัวเลขและสตริงเท่านั้น ดังนั้นการใช้ระดับบนสุด
พารามิเตอร์ DateTime
ทำให้เกิดผลลัพธ์ False สำหรับเงื่อนไขนี้ สำหรับ
ตัวอย่าง:
$session.params.my_dateTime.day > 5
เป็นเงื่อนไขที่ถูกต้อง เนื่องจาก
ค่า day
เป็นตัวเลขและรองรับ
$session.params.my_dateTime > "01-01-2010"
เป็นเงื่อนไขที่ไม่ถูกต้อง เนื่องจาก
"DateTime" ระดับบนสุด ไม่เป็นตัวเลขหรือสตริง
การลบล้างประเภทรันไทม์
การลบล้างประเภทรันไทม์ช่วยให้คุณสร้างหรือแก้ไขประเภทใน
การดำเนินการตามคำสั่งซื้อ ฟีเจอร์นี้ช่วยให้คุณสามารถเพิ่มหรือแทนที่ข้อกำหนดของประเภทที่
รันไทม์ เช่น คุณสามารถตรวจสอบแหล่งข้อมูลแบ็กเอนด์เพื่อโหลดเมนูรายวันได้
เป็นสินค้าประเภทหนึ่งในการดำเนินการตามคำสั่งซื้อ
ดูข้อมูลเพิ่มเติมในคู่มือเว็บฮุค
เกี่ยวกับวิธีสร้างการลบล้างประเภท
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eTypes are used to extract structured data from user input, allowing you to create slots in intents, manage slot filling within scenes, and define conditions based on parameter values.\u003c/p\u003e\n"],["\u003cp\u003eYou can create custom types using words and synonyms, regular expressions, or free-form text to define how the NLU interprets user input.\u003c/p\u003e\n"],["\u003cp\u003eSystem types such as \u003ccode\u003eDateTime\u003c/code\u003e, \u003ccode\u003eDate\u003c/code\u003e, \u003ccode\u003eTime\u003c/code\u003e, and \u003ccode\u003eNumber\u003c/code\u003e provide built-in data extraction for common data formats.\u003c/p\u003e\n"],["\u003cp\u003eRuntime type overrides enable dynamic modification of types during fulfillment, allowing you to adjust types based on real-time data.\u003c/p\u003e\n"]]],[],null,["Types let you configure the Assistant NLU (natural language understanding)\nengine to extract structured data from user input. You\ncan use types in the following situations:\n\n- In [intents](/assistant/conversational/intents), you can annotate training phrases with types to\n create slots. When users say something that matches a slot, the NLU engine\n extracts it as a typed parameter, so you can process it in a [scene](/assistant/conversational/scenes).\n\n- Within a scene's [slot filling](/assistant/conversational/scenes#slot_filling) stage, you can specify\n multiple slots that you want the user to provide before they can\n transition or exit out of the scene.\n\n- Within a scene's [conditions](/assistant/conversational/scenes#conditions) stage, you can base\n logic on whether a parameter has a specific value that's defined in a type.\n\nCustom types\n\nCustom types let you create your own type specification to notify the NLU to\nassign a set of values to a single key. You can specify types in a variety of\nways:\n\n- **Words and synonyms** allow you to map multiple values to a single key, which are called an entry. Your type can contain one or many entries. If you choose this option, you can also enable the following NLU settings:\n - **Enable fuzzy matching** - This feature allows entries with more than one word to be matched, even when the words are spoken in a different order.\n - **Accept unknown values** - When you can't specify all possible values, the language processor can accept unknown words or phrases based on surrounding input and intent training data, such as items that might be added to a grocery list.\n- **Regular expressions** allows the type to match values using regular expression patterns based on [Google's RE2 standard](https://github.com/google/re2/wiki/Syntax).\n- **Free form text** allows the type to match anything a user says. Annotating an intent with this type lets you consume all input as a parameter that you can pipe to your own NLU.\n\nSystem types\n\nSystem types let you annotate and extract well-known data from user input\nusing system-provided training data and values. The following system types are\nsupported:\n\n| Type | Description |\n|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| **`actions.type.DateTime`** | Contains date, time, and timezone based on the user's device settings. Available for slot filling and training phrase annotation. |\n| **`actions.type.Date`** | Contains date only. Available for slot filling only. |\n| **`actions.type.Time`** | Contains time only. Available for slot filling only. |\n| **`actions.type.Number`** | The `Number` type matches ordinal and cardinal numbers. |\n\n`DateTime`, `Date`, and `Time` usage\n\nThese types behave differently depending on where you use the type and the\nuser input that matches the type.\n\nUsing with intents\n\nAnnotating training phrases in intents supports only the `DateTime` type. User\ninput doesn't need to match an entire `DateTime` value. For example, if a user\nprovides only the year, the session parameter might look like this: \n\n \"date_time\": {\n \"year\": 2019\n }\n\nUsing with slot filling\n\nSlot filling supports `DateTime`, `Date`, and `Time`.\n\n- If the slot type is `DateTime`, the Assistant prompts the user until a full value is provided.\n- If the slot type is `Date`, the Assistant prompts the user until a date value is provided. When collected, the parameter you receive is a full `DateTime` with the time set to 00:00.\n- If the slot type is `Time`, the Assistant prompts the user until a time value is provided. When collected, the parameter your receive is a full `DateTime` object with the date set to the current date.\n\nFor example, suppose a user in Los Angeles said, \"Hey Google, create a reminder\nfor January 15, 2024 at 8 pm.\" When `DateTime` is extracted as part of a slot\nfilling process, the full parameter might look like this: \n\n \"date_time\": {\n \"day\": 15,\n \"hours\": 20,\n \"minutes\": 0,\n \"month\": 1,\n \"nanos\": 0,\n \"seconds\": 0,\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n },\n \"year\": 2024\n }\n\nUsing with conditions\n\nConditions only allow the use of numbers and strings, so using the top level\n`DateTime` parameter results in a **False** result for the condition. For\nexample:\n\n- `$session.params.my_dateTime.day \u003e 5` is a valid condition, because the `day` value is a number and is supported.\n- `$session.params.my_dateTime \u003e \"01-01-2010\"` is an invalid condition, because the top level 'DateTime' object is not a number or string.\n\nRuntime type overrides\n\nRuntime type overrides let you dynamically create or modify types in\nfulfillment. This feature lets you add to or replace a type's specification at\nruntime. For example, you can check a backend data source to load daily menu\nitems into a type in your fulfillment.\n\nSee the [webhooks](/assistant/conversational/webhooks#runtime_type_overrides) guide for more information\non how to build type overrides."]]