1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon Transcribeで文字起こしを試してみた

Posted at

背景・目的

音源はあったが、スクリプトが手元になく、AWSのTranscribeを使用して作成したときのメモ書きです。

概要

Transcribeの概要

以前、下記に概要をまとめました。

実践

バケットの作成

事前に、S3へ音声ファイルをアップしておきます

  1. S3バケットを作成します
  2. 音声ファイルをアップします
    image.png

トランスクリプションジョブ

  1. Transcribeを開きます

  2. ナビゲーションペインで、トランスクリプションジョブをクリックします

  3. 特定の言語を入力します
    image.png

  4. 音声データをアップしたS3パスを指定します
    image.png

  5. 出力するバケットを指定します
    image.png

  6. 次へ

  7. ジョブを作成をクリックします

  8. 進行中になりました
    image.png

  9. すぐに完了になります
    image.png

  10. 出力されました
    image.png

JSONを加工

そのままだと、扱いづらいのでテキストだけ抽出します

  1. ローカルにJSONをダウンロードします
  2. 下記のスクリプトを実行します
    import json
    
    # TranscribeのJSONファイルを開く
    with open('MyTranscribeJob.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
    
    # テキストだけを連結して表示
    full_text = ' '.join([item['transcript'] for item in data['results']['transcripts']])
    print(full_text)
    
  3. 文字列が抽出できました(都合上、ここには載せておりません。)

考察

次回は、OpenAIのwhisperをためしてみようとおもいまs

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?