【问题标题】:How to use keyword spotting feature for IBM Waston Speech to text API?如何为 IBM Watson Speech to text API 使用关键字发现功能?
【发布时间】:2016-05-27 10:36:43
【问题描述】:

我正在使用 IBM Watson Speech to text API 将音频文件转换为文本。每个功能对我来说都很好。但我无法使用关键字识别功能。输出未提供有关发现关键字的任何信息。

这是我的代码:

SpeechToText service = new SpeechToText();
    service.setUsernameAndPassword("*********", "********");
    //SpeechModel model =service.getModel("en-US_NarrowbandModel");


    service.setEndPoint("https://stream.watsonplatform.net/speech-to-text/api");

    String[] keys= {"abuse","bullying","parents","physical","assaulting"};
    RecognizeOptions options = new RecognizeOptions().contentType("audio/wav").model("en-US_NarrowbandModel").continuous(true).inactivityTimeout(500).keywords(keys).keywordsThreshold(0.7);


    File audio = new File("C:\\Users\\AudioFiles\\me.wav");

    SpeechResults transcript = service.recognize(audio, options);
    //Speech t1 = service.recognize(audio, options);
    System.out.println(transcript);

是否有任何特殊功能可以将发现的关键字作为输出以及成绩单?

【问题讨论】:

  • Java-SDK 中存在错误。你现在可以检查吗?

标签: speech-to-text ibm-watson


【解决方案1】:

这已在 Java SDK v3.2.0 中得到修复。确保下载最新版本 (4.2.1) jar:java-sdk-4.2.1-jar-with-dependencies.jar 或更新 Gradle/Maven 以获取最新版本。

以下代码基于您问题中的代码。

SpeechToText service = new SpeechToText();
service.setUsernameAndPassword("USERNAME", "PASSWORD");

File audio = new File("C:\\Users\\AudioFiles\\me.wav");    

RecognizeOptions options = new RecognizeOptions().Builder()
  .contentType("audio/wav)
  .inactivityTimeout(500)
  .keywords({"abuse", "bullying", "parents", "physical", "assaulting"})
  .keywordsThreshold(0.5)
  .build();

  SpeechResults transcript = service.recognize(audio, options).execute();
  System.out.println(transcript);

【讨论】:

    猜你喜欢
    • 2017-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-05
    • 2019-04-02
    • 1970-01-01
    相关资源
    最近更新 更多