This topic describes how to use a software development kit (SDK) to call Intelligent Speech Interaction services.
Prerequisites
Create an Alibaba Cloud account, activate the Intelligent Speech Interaction service, and obtain your AccessKey ID and AccessKey Secret. For more information, see Activate the service.
Create a project in the Intelligent Speech Interaction Management Console to obtain an AppKey. For more information, see Create a project.
Invoke the speech recognition service
This section uses the Java SDK as an example to describe how to call Intelligent Speech Interaction services.
Install the Maven tool.
Download the SDK package and decompress it.
Run the code to call Intelligent Speech Interaction services.
Call the short sentence recognition service.
Decompress the sample file and run the
mvn packagecommand in the pom directory. This generates an executable JAR file named nls-example-recognizer-2.0.0-jar-with-dependencies.jar in the target directory. Copy the JAR file to the destination server and run the following code segment. A logs/nls.log file is generated in the same directory as the JAR package.java -cp nls-example-recognizer-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechRecognizerDemo <app-key> <token> [<url>] // For information about how to obtain a token, see https://help.aliyun.com/document_detail/450514.htmlExample of a real-time speech recognition call.
Decompress the sample file and run the
mvn packagecommand in the pom directory. This generates an executable JAR file named nls-example-transcriber-2.0.0-jar-with-dependencies.jar in the target directory. Copy the JAR file to the destination server and run the following code segment. A logs/nls.log file is generated in the same directory as the JAR package.java -cp nls-example-transcriber-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechTranscriberDemo <app-key> <token> [<url>] // For information about how to obtain a token, see https://help.aliyun.com/document_detail/450514.htmlCall the speech synthesis service.
Decompress the sample file and run the
mvn packagecommand in the pom directory. This generates an executable JAR file named nls-example-tts-2.0.0-jar-with-dependencies.jar in the target directory. Copy the JAR file to the destination server and run the following code segment. A logs/nls.log file is generated in the same directory as the JAR package.java -cp nls-example-tts-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechSynthesizerDemo <app-key> <token> [<url>] // For information about how to obtain a token, see https://help.aliyun.com/document_detail/450514.html
What to do next
You can read the sample code in the SDK package to understand the SDK call flow.
You can familiarize yourself with the terms related to the Intelligent Speech Interaction service to better understand the product. For more information, see Terms.
You can learn how to call Intelligent Speech Interaction services. For more information, see Before you begin.