Quantcast
Channel: プログラム の個人的なメモ
Viewing all articles
Browse latest Browse all 860

【Google Cloud】 音声認識 / Google Cloud Speech API ~ Java / 基本編 ~

$
0
0

■ 環境構築

今回作成する環境下

 * OS              : Windows10
 * Java            : Java1.8
 * Eclipse         : Oxygen.1a Release (4.7.1a)
 * ビルド ツール   : Gradle

前提条件

 * Buildship: Eclipse Plug-ins for Gradle のインストール
行っていない場合は、以下の関連記事を参照のこと
https://blogs.yahoo.co.jp/dk521123/37204914.html

■ Javaのプロジェクト作成

[1] プロジェクト(Gradle Project)を作成する
 1-1) Eclipseの[File]-[New]-[Other]-[Gradle]-[Gradle Project]を選択し、「Next」ボタン押下。
      さらに、「Next」ボタン押下。
 1-2) 以下を入力し、「Finish」ボタン押下
  + Project Name   : 任意(今回は「GoogleCloudSpeechDemo」)
[2] ビルドスクリプト「build.gradle」の修正
 2-1) Eclipseの対象プロジェクト直下にある「build.gradle」を開き
      以下の「build.gradle」を参考に記載する
 2-2) Eclipseの対象プロジェクトを右クリックし、[Gradle]-[Refresh Gradle Project]を選択
 2-3) Eclipseの対象プロジェクト内の「src/main/java」「src/test/java」配下にある
     「Library.java」「LibraryTest.java」を削除する

google-cloud-speechについて

[[https://cloud.google.com/speech/docs/reference/libraries?hl=ja#client-libraries-install-java]]
より
Gradle を使用している場合は、依存関係に以下を追加します。

compile group: 'com.google.cloud', name: 'google-cloud-speech', version: '【バージョン】'

【バージョン】は、以下のサイトから最新版を記載する(今回は、「0.30.0-alpha」)
https://mvnrepository.com/artifact/com.google.cloud/google-cloud-speech
build.gradle
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'

// In this section you declare where to find the dependencies of your project
repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {
    // !Add!
    compile group: 'com.google.cloud', name: 'google-cloud-speech', version: '0.30.0-alpha'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'
}

■ サポート言語について

https://cloud.google.com/speech/docs/languages
 * 日本語
  => 「ja-JP」を指定


関連記事

日本語対応の音声認識サービス

https://blogs.yahoo.co.jp/dk521123/37139755.html

音声認識 / Google Cloud Speech API ~ 入門編 ~

https://blogs.yahoo.co.jp/dk521123/37143570.html

Viewing all articles
Browse latest Browse all 860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>