• Have any questions?
  • info.zbook.org@gmail.com

AT&T API Platform

6m ago
33 Views
0 Downloads
1.05 MB
61 Pages
Last View : 1d ago
Last Download : n/a
Upload by : Ciara Libby
Share:
Transcription

AT&T API PlatformSpeech SDK for iOS Publication Date: August 29 2013 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Legal DisclaimerThis document and the information contained herein (collectively, the "Information") is provided to you (both the individual receivingthis document and any legal entity on behalf of which such individual is acting) ("You" and "Your") by AT&T, on behalf of itself andits affiliates ("AT&T") for informational purposes only. AT&T is providing the Information to You because AT&T believes theInformation may be useful to You. The Information is provided to You solely on the basis that You will be responsible for makingYour own assessments of the Information and are advised to verify all representations, statements and information before using orrelying upon any of the Information. Although AT&T has exercised reasonable care in providing the Information to You, AT&T doesnot warrant the accuracy of the Information and is not responsible for any damages arising from Your use of or reliance upon theInformation. You further understand and agree that AT&T in no way represents, and You in no way rely on a belief, that AT&T isproviding the Information in accordance with any standard or service (routine, customary or otherwise) related to the consulting,services, hardware or software industries.AT&T DOES NOT WARRANT THAT THE INFORMATION IS ERROR-FREE. AT&T IS PROVIDING THE INFORMATION TO YOU"AS IS" AND "WITH ALL FAULTS." AT&T DOES NOT WARRANT, BY VIRTUE OF THIS DOCUMENT, OR BY ANY COURSE OFPERFORMANCE, COURSE OF DEALING, USAGE OF TRADE OR ANY COLLATERAL DOCUMENT HEREUNDER OROTHERWISE, AND HEREBY EXPRESSLY DISCLAIMS, ANY REPRESENTATION OR WARRANTY OF ANY KIND WITHRESPECT TO THE INFORMATION, INCLUDING, WITHOUT LIMITATION, ANY REPRESENTATION OR WARRANTY OFDESIGN, PERFORMANCE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ORANY REPRESENTATION OR WARRANTY THAT THE INFORMATION IS APPLICABLE TO OR INTEROPERABLE WITH ANYSYSTEM, DATA, HARDWARE OR SOFTWARE OF ANY KIND. AT&T DISCLAIMS AND IN NO EVENT SHALL BE LIABLE FORANY LOSSES OR DAMAGES OF ANY KIND, WHETHER DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE,SPECIAL OR EXEMPLARY, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESSINTERRUPTION, LOSS OF BUSINESS INFORMATION, LOSS OF GOODWILL, COVER, TORTIOUS CONDUCT OR OTHERPECUNIARY LOSS, ARISING OUT OF OR IN ANY WAY RELATED TO THE PROVISION, NON-PROVISION, USE OR NON-USEOF THE INFORMATION, EVEN IF AT&T HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES OR DAMAGES. 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of ContentsContents12Introduction. 11.1Sample Code . 11.2Related Documentation . 11.3Terms and Acronyms . 2Introduction to Speech API and Speech SDK. 32.12.1.1RESTful Web Service . 32.1.2Speech Contexts . 42.1.3AT&T Developer Program On-Boarding . 52.1.4Security and Authentication . 52.23Speech API Overview. 3Speech SDK Overview . 72.2.1Platform Integration . 72.2.2Audio Capture and Streaming . 72.2.3Recording and Progress User Interface . 8Speech Recognition Web Service . 93.1Speech Recognition Requests . 93.1.1Speech Recognition Service URL . 93.1.2Speech Recognition Request HTTP Headers . 93.2Speech Recognition Request Formats . 103.2.1Audio Request Format. 113.2.2Inline Grammar Request Format . 113.3Request Streaming . 123.4Extra Arguments . 133.5Using OAuth Credentials . 14 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of Contents3.5.1OAuth Access Token Request . 143.5.2OAuth Access Token Response . 143.5.3Authorization Header . 153.6Speech Recognition Responses . 163.6.13.7Speech Recognition Response Formats . 173.8Speech to Text JSON Format . 173.8.1JSON Nomenclature . 183.8.2General Assumptions about the JSON Data . 193.8.3JSON Objects and Fields . 193.94Response Status Codes. 16Speech Recognition Examples . 223.9.1Running cURL. 223.9.2Example of an OAuth Request. 223.9.3Example of Successful Speech Recognition Response . 233.9.4Example of Unauthorized Credentials. 243.9.5Example of Error Response . 25Using Speech SDK for iOS . 264.1How the Speech SDK Works on iOS. 264.2Speech SDK Prerequisites for iOS . 274.3Setting up your iOS Project . 274.4Speech Recognition Tasks on iOS . 304.4.1Configure ATTSpeechService Runtime Properties . 314.4.2Acquire OAuth Access Token. 324.4.3Start Speech Interaction . 334.4.4Send Inline Grammar Data . 334.4.5Customize UI. 34 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of Contents54.4.6Speech Endpointing . 354.4.7Handle Speech Recognition Results and Errors . 354.5Testing Speech Applications on iOS . 374.6Deploying Speech Applications on iOS . 37Speech SDK Reference for iOS . 385.1ATTSpeechService Methods . 385.2ATTSpeechService Request Properties and Constants. 415.3ATTSpeechService Delegate Callback Methods . 475.4ATTSpeechService Response Properties . 505.5ATTSpeechService Error Codes. 515.6ATTSpeechService State Transitions . 53 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of FiguresFigure 4-1: Selecting the ATTSpeechKit subfolder. . 27Figure 4-2: Dragging the ATTSpeechKit folder to your Xcode window. 28Figure 4-3. Completed Xcode target. . 30Figure 4-4: Speech SDK standard UI on iOS. . 34 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of TablesTable 1-1: Terms and acronyms. . 2Table 3-1: Speech recognition request HTTP headers. . 10Table 3-2: Inline grammar parts. 12Table 3-3: Speech SDK X-Arg parameters . 13Table 3-4: Response status codes. . 16Table 3-5: Response status codes. . 17Table 3-6: Speech recognition response formats. . 17Table 3-7: cURL options. . 22Table 5-1: ATTSpeechService methods. . 40Table 5-2: ATTSpeechService request properties. . 45Table 5-3: ATTSpeechService request property constants. . 46Table 5-4: ATTSpeechService delegate callback methods. . 49Table 5-5: ATTSpeechService response properties. 50Table 5-6: ATTSpeechService error codes. 52Table 5-7: ATTSpeechService state transitions. . 53 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Table of ExamplesExample 3-1: HTTP headers of the request. . 10Example 3-2: X-Arg header. . 13Example 3-3: OAuth access token response. . 15Example 3-4: Schematic hierarchy for the JSON format of a successful transcription. . 18Example 3-5: cURL OAuth request. . 23Example 3-6: Successful cURL request. 24Example 3-7: Unauthorized cURL response. . 24Example 3-8: cURL error response. 25Example 4-1: Configure ATTSpeechService in applicationDidBecomeActive:. . 32Example 4-2: Start speech interaction on iOS. . 33Example 4-3: Send inline grammar on iOS. 34Example 4-4: Successful Transaction delegate method. . 36Example 4-5: Failed transaction delegate method. . 36 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

1 IntroductionThis document is designed for software developers on the iOS platform whointend to build applications using the Speech API and Speech SDK provided byAT&T.The purpose of this document is to explain the configuration, development, andtesting of applications that use the Speech SDK for iOS. This document shouldprovide developers with a thorough understanding of all Speech API and SpeechSDK data formats, operations, and parameters.Note: The Speech SDK supports application development on the Android andiOS platforms. This document has full details on developing for iOS.1.1 Sample CodeSample code and response messages for most common tasks are provided inthis document. For more complete sample applications, visit the AT&T DeveloperProgram website at the following rd.jsp?passedItemId 125000231.2 Related DocumentationFor additional information on the Speech API, refer to the followingdocumentation: Speech API Technical Documentation: Contains detailed information onthe RESTful Speech API provided by AT&T, including request parametersand the format of the response data. The technical documentation is found atthe following rd.jsp?passedItemId 12500023 Speech SDK Release Notes: The distribution of Speech SDK includes a textfile with release notes, describing the changes in that release of the SDK. 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.Page 1 of 54

1.3 Terms and AcronymsThe following table defines terms and acronyms used in this document.AcronymDefinitionAMRAdaptive Multi-Rate audio formatAPIAPKApplication Programming InterfaceApplication PackageJSONMIMEOSRESTfulSDKSMSSpeexJavaScript Object Notation formatMultipurpose Internet Mail ExtensionsOperating SystemRepresentational State TransferSoftware Development KitShort Message ServiceA patent-free audio compression format designedfor speechSSLUISecure Sockets LayerUser interfaceWAVWaveform audio formatTable 1-1: Terms and acronyms. 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.Page 2 of 54

2 Introduction to Speech API and Speech SDKThis section describes the core functions of the AT&T Speech API and theSpeech SDK, including features of the web service and client libraries.2.1 Speech API OverviewThe Speech API provides speech recognition and generation for third-party appsusing a client-server RESTful architecture. The Speech API supports HTTP 1.1clients and is not tied to any wireless carrier. The Speech API includes thefollowing web services. Speech to Text: Performs speech recognition, accepting audio data andreturning a text transcription of the speech in the audio. Powered by theAT&T WatsonSM speech engine, this web service includes several speechcontexts that perform speech recognition that are optimized for particularusage scenarios. It can also accept custom grammar information to enhancerecognition in application-specific domains. Speech to Text Custom: An extension of the Speech to Text service thataccepts custom grammar information in addition to speech data. This allowsenhanced recognition in application-specific domains. Text to Speech: Generates audio that speaks a snippet of text. The webservice accepts text data and returns an audio stream that the application canplay to the user. Using AT&T Natural Voices technology, the service letsapplications customize the language, voice, and tempo of the spoken audio.The bulk of this document covers the Speech to Text and

Speech SDK, including features of the web service and client libraries. 2.1 Speech API Overview The Speech API provides speech recognition and generation for third-party apps using a client-server RESTful architecture. The Speech API supports HTTP 1.1 clients and is not tied to any wireless carrier. The Speech API includes the following web .