탐색으로 건너뛰기

발음 사전 사용하기

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

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

개요

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

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

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

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

다른 모델은 사전 음소 태그를 건너뛰고 기본 발음을 사용합니다. 다른 모델에서는 필요한 발음을 생성하는 철자나 구절로 대체하려면 alias 태그를 사용하세요.

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

빠른 시작

이 가이드는 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

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

다음 단계