Register your app’s custom terminology, and provide sample phrases for how to use your app with Siri.
Apps must register any vocabulary that’s used in a nonconventional way or that’s completely unique to your app. Siri uses your custom vocabulary to improve the speech recognition process and to ensure that your app has correct information.
You must provide one or more example phrases for engaging your app through Siri. Example phrases correspond to the way that users speak about your app and should include any custom vocabulary terms defined by your app.
The terms you define from your iOS app are automatically shared with your Intents extension on watchOS. You don’t need to register your user-specific or global vocabulary again from your Intents extension in watchOS.
Register Example Phrases and Global Vocabulary
Register your app’s example phrases and global vocabulary using the Info.plist file of your Intents app extension. All apps should provide at least a few phrases that teach users how to use Siri to trigger your intents. Siri displays your phrases in the Siri Guide and also uses custom vocabulary to improve the accuracy of its recognition process. To create a global vocabulary file:
In your Xcode project, select New > File.
In iOS > Resource, select the Property List file type.
Set the name of the file to
Appand add the file to your iOS app.
Intent Vocabulary .plist,
App file in the language-specific (
.lproj) directory of your iOS app that corresponds to your base development language. Include localized versions of the file in each of your app’s language-specific project directories. In Xcode, you can create localized versions automatically from the File inspector.
The global vocabulary file contains two keys at the root level:
Intentkey contains example phrases for invoking your services. Always include this key.
Parameterkey defines your app’s custom terms that apply to all users of your app and the intent parameters to which they apply. You may omit this key if you don’t have any custom vocabulary terms.
You may specify custom vocabulary terms for ride options and workout names. You must always associate custom vocabulary terms with a specific property of the corresponding intent object. You may associate the same term with multiple intents. For example, you may associate the same workout name with all of the workout-related intents.
For information about how to fully specify example phrases and custom terms, see Global Vocabulary Reference.
Register User-Specific Vocabulary
You register user-specific vocabulary terms at runtime by calling the
set method of an
INVocabulary object. Unlike the global terms, which you declare in your app bundle, you declare user-specific terms at runtime from your iOS app. The terms you declare must belong to one of the following categories:
Audiobook author names
Contact names (only if they’re app-specific and not managed by the Contacts framework)
Music artist names
Payment organization names
Payment account nicknames
Photo album names
Podcast or radio show titles
Vehicle profile names
When selecting the vocabulary to register, choose terms that could be misunderstood by someone not familiar with your app. For example, include terms whose literal meanings differ from your app’s usage of those terms. Don’t register terms that are easily understood, such as “My Photo Album” or “My Workout”.
Each call to the
set method replaces any previously registered terms of the same type. As a result, each call to that method must include all of the terms that you want to associate with the user. In addition, you must arrange terms based on priority, placing the most important terms first in the list you provide.
Listing 1 shows an example that registers a set of custom workout names for the user. The example assumes that the app provides a custom
sorted method that sorts the workout names based on how recently the user used them. You execute this code from your iOS app, and not from your Intents app extension.