Google Speech-to-Text API

변지환·2023년 1월 23일
from google.cloud import speech

# Instantiates a client
client = speech.SpeechClient()

# The name of the audio file to transcribe
gcs_uri = "gs://cloud-samples-data/speech/brooklyn_bridge.raw"

def transcribe_speech():
  audio = speech.RecognitionAudio(uri=gcs_uri)

  config = speech.RecognitionConfig(
      encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16,
      sample_rate_hertz=16000,
      language_code="en-US",
  )

  # Detects speech in the audio file
  response = client.recognize(config=config, audio=audio)

  for result in response.results:
    print("Transcript: {}".format(result.alternatives[0].transcript))

transcribe_speech()

기능

  1. 스트리밍(실시간) 음성 인식 가능
    2. Speech-to-Text는 멀티 채널 상황(예: 화상 회의)에서 개별 채널을 인식하고 순서에 맞게 스크립트에 주석을 달 수 있습니다.
    https://cloud.google.com/speech-to-text/docs/multi-channel?hl=ko

    실시간으로는 불가능해보임 audio_channel_count 인자를 어떻게 결정하지...?
  2. 힌트를 제공하여 분야별 용어와 많이 쓰이지 않는 단어의 스크립트를 작성하도록 음성 인식을 맞춤설정할 수 있으며 특정 단어 또는 어구의 스크립트 작성 정확도를 향상시킬 수 있습니다. 클래스를 사용해서 음성으로 인식된 숫자를 주소, 연도, 통화 등으로 자동 변환할 수 있습니다. 가능
  3. Speech-to-Text는 별도로 주변 소음을 제거할 필요 없이 다양한 환경의 소음이 있는 오디오를 처리할 수 있습니다. 가능
  4. 고급 보정 모델 -> 한국어는 지원 안함

0개의 댓글