탐색으로 건너뛰기

발음 사전 사용하기

이 가이드에서는 프로그래밍 방식으로 발음 사전을 관리하는 방법을 보여드립니다.

사용 가이드 · ElevenAPI 빠른 시작을 완료했다고 가정합니다.

개요

발음 사전을 사용하면 AI 에이전트가 특정 단어 또는 구문을 발음하는 방식을 맞춤 설정할 수 있습니다. 특히 다음과 같은 경우에 유용합니다.

  • 이름, 장소 또는 기술 용어의 발음 수정
  • 대화 전반에서 일관된 발음 보장
  • 지역별 발음 차이 맞춤 설정

ElevenLabs는 IPA와 CMU 알파벳을 모두 지원합니다.

발음 사전 음소 태그는 eleven_v4, eleven_flash_v2, eleven_v3 모델에서만 작동합니다.

다른 모델은 사전 음소 태그를 건너뛰고 기본 발음을 사용합니다. 다른 모델에서는 원하는 발음이 나오는 철자나 구문으로 대체할 수 있도록 별칭 태그를 대신 사용하세요.

영어 이외의 언어에서 IPA 및 CMU 발음을 사용하려면 eleven_v4 모델로 전환해야 합니다.

빠른 시작

이 가이드는 API 키와 SDK를 설정했다고 가정합니다. 아직이라면 먼저 빠른 시작을 완료하세요.

1

발음 사전 파일 만들기

이 예시에서는 tomato라는 단어의 발음 사전 파일을 만듭니다.

이 규칙은 “IPA” 알파벳을 사용하며 tomato와 Tomato의 발음을 서로 다른 발음으로 업데이트합니다. PLS 파일은 대소문자를 구분하므로 대문자 “T”가 있는 경우와 없는 경우를 모두 포함합니다.

Claude 또는 ChatGPT 같은 AI 도구를 사용하면 특정 단어의 IPA 또는 CMU 표기 생성을 도울 수 있습니다.

dictionary.pls
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
alphabet="ipa" xml:lang="en-US">
<lexeme>
<grapheme>tomato</grapheme>
<phoneme>/tə'meɪtoʊ/</phoneme>
</lexeme>
<lexeme>
<grapheme>Tomato</grapheme>
<phoneme>/tə'meɪtoʊ/</phoneme>
</lexeme>
</lexicon>
2

SDK를 통해 파일에서 발음 사전 만들기

선택한 언어에 따라 example.py 또는 example.mts라는 새 파일을 만들고 다음 코드를 추가하세요.

from elevenlabs import ElevenLabs, PronunciationDictionaryVersionLocator
from elevenlabs.play import play
elevenlabs = ElevenLabs()
with open("dictionary.pls", "rb") as f:
# this dictionary changes how tomato is pronounced
pronunciation_dictionary = elevenlabs.pronunciation_dictionaries.create_from_file(
file=f.read(), name="example"
)
audio_1 = elevenlabs.text_to_speech.convert(
text="Without the dictionary: tomato",
voice_id="aMSt68OGf4xUZAnLpTU8",
model_id="eleven_flash_v2",
)
audio_2 = elevenlabs.text_to_speech.convert(
text="With the dictionary: tomato",
voice_id="aMSt68OGf4xUZAnLpTU8",
model_id="eleven_flash_v2",
pronunciation_dictionary_locators=[
PronunciationDictionaryVersionLocator(
pronunciation_dictionary_id=pronunciation_dictionary.id,
version_id=pronunciation_dictionary.version_id,
)
],
)
# play the audio
play(audio_1)
play(audio_2)
3

코드 실행하기

python example.py

스피커에서 발음 사전을 적용한 버전과 적용하지 않은 버전, 두 가지 오디오가 재생되는 것을 들을 수 있습니다.

다음 단계