All Products
Search
Document Center

Run an SDK

Last Updated: Oct 27, 2020

This topic describes how to run an SDK to call Intelligent Speech Interaction services.

Prerequisites

  • An Alibaba Cloud account is created. Intelligent Speech Interaction is activated. The AccessKey ID and AccessKey secret of your Alibaba Cloud account are obtained. For more information, see Activate Intelligent Speech Interaction.

  • A project is created in the Intelligent Speech Interaction console and the appkey of the project is obtained. For more information, see Create a project.

Call Intelligent Speech Interaction services

This section describes how to run the SDK for Java to call Intelligent Speech Interaction services.

  1. Install Maven.

  2. Download the SDK packageand decompress it.

  3. Run code to call Intelligent Speech Interaction services.

    • Call the short sentence recognition service.

      Decompress the demo package, and run the mvn package command in the pom directory. An executable JAR package nls-example-recognizer-2.0.0-jar-with-dependencies.jar is generated in the target directory. Copy the JAR package to the destination server and run the following code. The logs/nls.log file is generated in the same directory as that of the JAR package.

      java -cp nls-example-recognizer-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechRecognizerDemo <app-key> <token> [<url>]

    • Call the real-time speech recognition service.

      Decompress the demo package, and run the mvn package command in the pom directory. An executable JAR package nls-example-transcriber-2.0.0-jar-with-dependencies.jar is generated in the target directory. Copy the JAR package to the destination server and run the following code. The logs/nls.log file is generated in the same directory as that of the JAR package.

      java -cp nls-example-transcriber-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechTranscriberDemo <app-key> <token> [<url>]

    • Call the speech synthesis service.

      Decompress the demo package, and run the mvn package command in the pom directory. An executable JAR package nls-example-tts-2.0.0-jar-with-dependencies.jar is generated in the target directory. Copy the JAR package to the destination server and run the following code. The logs/nls.log file is generated in the same directory as that of the JAR package.

      java -cp nls-example-tts-2.0.0-jar-with-dependencies.jar com.alibaba.nls.client.SpeechSynthesizerDemo  <app-key> <token> [<url>]

What to do next

  • Read the sample code in the SDK package to learn how to run an SDK.

  • Understand the terms of Intelligent Speech Interaction, which help you better understand this product. For more information, see Terms.

  • Learn how to call Intelligent Speech Interaction services. For more information, see Before you begin.