Speech-to-Text 모델 적응 설정

Agent Assist는 Speech-to-Text 모델 적응을 사용하여 특정 구문을 다른 구문보다 더 자주 인식하여 텍스트 변환 품질을 개선합니다. 이 페이지에서는 Speech-to-Text 텍스트 변환을 위한 모델 적응을 설정하는 방법을 안내합니다.

Speech-to-Text 콘솔 사용

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

  1. 콘솔에서 Speech-to-Text 페이지로 이동합니다. 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"

json 파일 @sample_phrase_sets.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
미국
유럽
europe-west1
europe-west2
europe-west3
europe-west4
유럽
australia-southeast1
asia-northeast1
asia-south1
asia-southeast1
me-west1
전역
전역