SiriKit 集成的功能
Intents Domains(功能详细介绍官方文档)
SiriKit支持的功能如下:
- 网络电话的发起(VoIP Calling)
- 消息的传送(Messaging)
- 支付功能(Payment)
- 照片(Photo)
- 健康训练(Workouts)
- 预定骑乘(Ride booking)
- 启动汽车(CarPlay)
- 预约餐厅(Restaurant Reservations)
App Vocabulary File Format(词汇表格式官方文档)
AppIntentVocabulary.plist(词汇表格)帮助Siri了解该词汇的作用
Lists the keys you include in your AppIntentVocabulary.plist
file. Make these keys children of theRoot
dictionary entry.
Key |
Type |
Summary |
---|---|---|
|
Array of Dictionary |
(Optional) The terms that correspond to specific properties of your app’s supported intents; see Parameter Vocabularies. |
|
Array of Dictionary |
(Optional, but recommended) Example phrases that can be shown in the Siri guide, and which Siri uses for learning your app’s terminology; see Intent Phrases. |
ParameterVocabularies:是字典中的数组,数组中每个成员(字典)定义了一组术语和这些术语适用的意图属性
Key |
Type |
Summary |
---|---|---|
|
Array of String |
(Required) The properties to which the specified vocabulary terms apply; seeParameter Names. |
|
Array of Dictionary |
(Required) The vocabulary terms, including any pronunciation and examples; seeParameter Vocabulary. |
ParameterNames
key (Array - Required) An array of strings, each of which contains the intent class and property name to which the vocabulary values apply. The format for each string is <intent>.
<property>, where<intent> is the name of the intent class and <property> is the name of a resolvable property of that class. You can configure custom vocabulary for the following properties in the global vocabulary file:
-
INRequestRideIntent.rideOptionName
-
INStartWorkoutIntent.workoutName
-
INPauseWorkoutIntent.workoutName
-
INResumeWorkoutIntent.workoutName
-
INEndWorkoutIntent.workoutName
-
INCancelWorkoutIntent.workoutName
Parameter Vocabulary
ParameterVocabulary
key (Array
- Required) An array of dictionaries, each of which contains a custom term that can be used for a given parameter.
Each dictionary contains two required keys, which are listed in Table 8-3.
Key |
Type |
Summary |
---|---|---|
|
String |
(Required) The string that Siri provides to your code when it recognizes the custom term; see Vocabulary Item Identifier. |
|
Array of Dictionary |
(Required) The defined phrase for Siri to recognize, including pronunciation and examples; see Vocabulary Item Synonyms. |
Vocabulary Item Identifier
VocabularyItemIdentifier
key (String
- Required) The string that you want Siri to assign to the identifier
property of the INSpeakableString
object used to populate the intent. The string itself is never seen by the user and should not be localized. In fact, the same identifier string should appear in each of the localized versions of your vocabulary property list file.
This identifier string applies to all synonyms listed in the Vocabulary Item Synonyms portion of this parameter entry.
Vocabulary Item Synonyms
VocabularyItemSynonyms
key(Array - Required) An array of dictionaries, each of which defines a custom phrase that the user might employ for your app. Each synonym entry may also contain pronunciation guidelines and examples of how the phrase might be used. All synonyms in the array are associated with the same Vocabulary Item Identifier key.
Each dictionary may contain the keys listed in Table 8-4.
Key |
Type |
Summary |
---|---|---|
|
String |
(Required) The custom phrase spelled in the same way that your app uses it; seeVocabulary Item Phrase. |
|
String |
(Optional) Pronunciation hints for the phrase, formatted in a “sounds like” format; see Vocabulary Item Pronunciation. |
|
Array of String |
(Optional) Examples of how the phrase might be used; see Vocabulary Item Examples. |
Vocabulary Item Phrase
VocabularyItemPhrase
key (String
- Required) The localized phrase for Siri to recognize and display. Specify this term or phrase exactly as it should appear in the Siri interface.
Vocabulary Item Pronunciation
VocabularyItemPronunciation
key (String
- Optional) A version of the phrase that sounds the same when read in the native language. This is not a phonetic spelling of the original phrase, but is a string that has an equivalent sound when spoken. For example, the phrase “iTunes” could be have “eye toons” as its pronunciation string. Siri uses these strings as hints when listening to the user and speaking the phrase.
Vocabulary Item Examples
VocabularyItemExamples
key (Array
- Optional) An array of strings containing examples of the phrase used in context. Include examples that are typical and succinct by paring each example down to the smallest string that includes the phrase. You can specify more complex examples of your terminology using the top-levelIntent Phrases key.
Intent Phrases
IntentPhrases
key (Array
- Optional) Contains an array of dictionaries, each of which contains the sample phrases that a user might speak in relation to one of your app’s intent. Siri uses your examples as hints to help it understand your app’s terminology better. Each sample phrase or group of phrases must have an associated intent class, which helps Siri identify the user’s intention more readily.
Each dictionary in the array has two required keys, which are listed in Table 8-5.
Key |
Type |
Summary |
---|---|---|
|
String |
(Required) The name of the intent class to which the examples apply; see Intent Name. |
|
Array of String |
(Required) The phrases that the user might speak in relation to the specified intent; see Intent Examples. |
Intent Name
IntentName
key (String
- Required) Specifies the name of the intent class to which each phrase applies. For example, you might specify the strings “INRequestRideIntent” for sample phrases involving the booking of a ride.
Intent Examples
IntentExamples
key (Array
- Required) An array of strings, each of which contains a sample phrase that a user might speak. Sample phrases may be as complex as needed, but should reflect actual phrases users might say when using your app. Your examples may include any custom terminology that you define using theParameter Vocabularies key. Sample phrases when booking a ride with an app called CharityTruck might include the following:
-
"Ask CharityTruck for a ride to the Red Cross on 3rd and mission.”
-
"Check with CharityTruck if I can get a hauler truck tomorrow.”
-
"See if CharityTruck can send a pickup truck to my house at 7am tomorrow.”
Rules for Localized Vocabulary Pronunciation
For specific localizations, additional rules apply when specifying values for the Vocabulary Item Pronunciationkey:
-
zh_CN: China Mandarin localization
-
Tones are represented using the numbers 1, 2, 3, 4, and 5. Use the number 5 for the neutral tone. Place tones at the end of the Pinyin representation of each character. For example, “ping2 guo3”.
-
You can replace the special character “ü” in Pinyin with “yu”. For example, “nü” would become “nyu”.
-
-
zh_TW: Taiwan Mandarin localization
-
Tones are represented using the numbers 1, 2, 3, 4, and 5. Use the number 5 for the neutral tone. Place tones at the end of the Pinyin representation of each character. For example, 蘇打綠 becomes “su1 da3 lyu4”.
-
-
zh_HK: Hong Kong Cantonese localization
-
Use the Jyutping 粤语拼音 (粤拼) romanization system for Cantonese.
-
Tones are represented using the numbers 1, 2, 3, 4, 5, and 6. Place tone numbers at the end of the Jyutping. For example, 的士 becomes “dik1 si2”, and 短訊 becomes “dyun2 seon2”.
-
Example
Figure 8-1 shows a sample vocabulary file that defines a custom term for a workout regimen in the appCardioBonanza
. When the user speaks the term “Cardio Craze” in relation to that app, Siri knows to put the string cardio_craze_workout
in the workoutName
property of the INStartWorkoutIntent
object. When processing the intent, the CardioBonanza
app uses that string to start the specific workout.