Speech-to-Text 모델 적응 설정

Agent Assist는 Speech-to-Text 모델 적응을 사용하여 특정 문구를 다른 문구보다 더 자주 인식하여 스크립트 작성 품질을 개선합니다. 이 페이지에서는 Speech-to-Text 텍스트 변환을 위한 모델 적응 설정에 관한 가이드를 제공합니다.

Speech-to-Text 콘솔 사용

Speech-to-Text 콘솔로는 전역 구문 세트만 만들 수 있습니다. 리전 구문 세트는 Speech-to-Text API를 사용하여 만들어야 합니다.

  1. Google Cloud 콘솔에서 Speech-to-Text 페이지로 이동합니다. 음성 텍스트 변환으로 이동
  2. 모델 적응을 클릭합니다.
  3. add_box새 리소스를 클릭합니다.
  4. 구문 세트 리소스와 API 버전 V1을 선택한 다음 구문과 부스트 값을 입력하고 구문 세트 이름을 복사합니다.
  5. 저장을 클릭합니다.
  6. Agent Assist 콘솔로 이동합니다.
  7. 대화 프로필을 클릭한 다음 수정할 대화 프로필을 선택합니다.
  8. 구문 세트 섹션으로 이동하여 구문 세트 이름을 붙여넣습니다.

Speech-to-Text API 사용

  1. 음성 인식 안내에 따라 구문 세트 스크립트를 만듭니다.
  2. 다음 Python 스크립트를 실행하여 대화 프로필을 업데이트합니다.

    # Conversation Profile to update
    PROJECT_ID = "sample-project"
    LOCATION = "global"
    CONVERSATION_PROFILE_ID = "sample-conversation-profile"
    # Speech model adaptation resource names
    SPEECH_ADAPTATION_PHRASES = ["projects/sample-project/locations/global/phraseSets/sample-phrase-sets"]

    import google.auth from google.auth.transport.requests import AuthorizedSession

    scopes=['https://www.googleapis.com/auth/cloud-platform'] credentials, project = google.auth.default( scopes=scopes, quota_project_id=PROJECT_ID, ) session = AuthorizedSession(credentials)

    profile_url = f"https://dialogflow.googleapis.com/v2beta1/projects/{PROJECT_ID}/locations/{LOCATION}/conversationProfiles/{CONVERSATION_PROFILE_ID}" get_response = session.get(profile_url) print("Checking for existing ConversationProfile...") print(get_response.status_code) print(get_response.json()) if get_response.status_code == 200: patch_response = session.patch( profile_url, params={ "updateMask": "sttConfig.phraseSets" }, json={ "sttConfig": { "phraseSets": SPEECH_ADAPTATION_PHRASES } } ) print("Updating ConversationProfile...") print(patch_response.status_code) print(patch_response.json())

지역별 구문 세트

Speech-to-Text 모델 적응은 영어 (en-US)만 지원하지만 Speech-to-Text API를 사용하여 다른 언어 지역의 구문 세트를 구성할 수 있습니다. 이 기능은 해당 지역에서 이루어지는 영어 대화를 트랜스크립션할 때 특히 유용합니다.

다음 샘플 명령어를 사용하여 Speech-to-Text API로 리전 구문 세트를 만듭니다.

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -H "X-Goog-User-Project: sample_project" \
    -d @sample_phrase_sets.json \
"https://us-speech.googleapis.com/v1/projects/sample-project/locations/us/phraseSets"

@sample_phrase_sets.json json 파일에는 다음과 같은 문구 세트의 콘텐츠가 포함되어 있습니다.

{
  "parent": "projects/sample-project/locations/us",
  "phraseSetId": "sample-phrase-sets",
  "phraseSet": {
    "name": "sample-phrase-sets",
    "phrases": [
      {
        "value": "Some phrase",
        "boost": 20
      }
    ]
  }
}
단일 Dialogflow 리전의 대화 프로필의 경우 다음 표에 구문 세트를 만들 해당 Speech-to-Text 리전이 나와 있습니다.

Dialogflow 리전 Speech-to-Text 지역
미국
us-central1
us-east1
us-east7
us-west1
northamerica-northeast1
northamerica-northeast2
미국
eu
europe-west1
europe-west2
europe-west3
europe-west4
eu
australia-southeast1
asia-northeast1
asia-south1
asia-southeast1
me-west1
global
전역