Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

議事録作成における音声データの文字起こしの話者特定について #419

Open
tetuya-iyell opened this issue Mar 25, 2024 · 1 comment

Comments

@tetuya-iyell
Copy link

お世話になっております
齋藤です

音声認識で利用しているtranscribeにおいて、startTranscription.tsをStartTranscriptionJobCommandを以下の通りに修正をしてみました

    const command = new StartTranscriptionJobCommand({
      IdentifyLanguage: true,
      LanguageOptions: ['ja-JP', 'en-US'],
      Media: { MediaFileUri: audioUrl },
      TranscriptionJobName: uuid,
      OutputBucketName: process.env.TRANSCRIPT_BUCKET_NAME,
      Settings: {
        ShowSpeakerLabels: true, // 話者のラベルを表示する設定を有効にします
        MaxSpeakerLabels: 2 // 識別する話者の最大数
      },
      Tags: [
        {
          Key: 'userId',
          Value: userId,
        },
      ],
    });

上記の結果、transcribeで音声認識をされたデータに関しては、json形式でS3バケットに話者特定をして保存されるのですが、getTranscription.tsで取得したデータは話者特定を行わず、音声認識をしたデータのみをweb画面上に表示しています

想定として、getTranscription.tsで取得したjsonを話者特定をしてパースしてweb上に表示できるようにしないと行けないとおもうのですが、どのようにすれば話者特定をした結果をwebに反映できるでしょうか

ご教授をよろしくおねがい申し上げます

@gteu
Copy link
Contributor

gteu commented Apr 2, 2024

添付していただいたコードのように修正することで、話者識別と合わせた音声認識をすることができます。

Amazon Transcribe の認識結果は以下の json ような形式になります。現在の getTranscription.ts では、results.transcripts の情報をそのままフロントエンドで可視化していますが、話者情報と合わせて可視化するためには、results.itemsresults.speaker_lables の情報を参照する必要があります。

{
    "results": {
        "transcripts": [
            {
                "transcript": "..."
            }
        ],
        "speaker_labels": {
            "segments": [
                {
                    "start_time": "0.0",
                    "end_time": "8.779",
                    "speaker_label": "spk_0",
                    "items": []
                }
            ]
        },
        "items": [
            {
                "type": "pronunciation",
                "alternatives": [
                    {
                        "confidence": "0.999",
                        "content": "After"
                    }
                ],
                "start_time": "0.009",
                "end_time": "0.389",
                "speaker_label": "spk_0"
            },
            {
                "type": "pronunciation",
                "alternatives": [
                    {
                        "confidence": "0.999",
                        "content": "living"
                    }
                ],
                "start_time": "0.4",
                "end_time": "0.689",
                "speaker_label": "spk_0"
            },
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants