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);
発見されたキーワードをトランスクリプトとともに出力として取得するための特別な機能はありますか?
これはJavaSDKで修正されました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);
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加