<jupyter_start><jupyter_text>まずは音声を作ってみる[参考](https://www.youtube.com/watch?v=txUQ9W2YKIA)<jupyter_code>text = """
みなさんおはようございます。任天堂の岩田です。2014年最初の任天堂ダイレクトを直接お届けいたします。
"""
response = client.synthesize_speech(
    OutputFormat='mp3',
    LanguageCode='ja-JP',
    Text=text,
    VoiceId="Takumi",
)
print(response)
mp3_binary = response["AudioStream"].read()
file_name = "talk.mp3"
file_path = "./"
with open(file_path + file_name,"wb") as f:
    f.write(mp3_binary)<jupyter_output><empty_output><jupyter_text>音声の種類を確認<jupyter_code>client.describe_voices(
    LanguageCode='ja-JP'
)<jupyter_output><empty_output><jupyter_text>SSML を試してみる<jupyter_code>text = """
<speak>
<break time="3s"/>
みなさん
<break time="1s"/>
おはようございます。任天堂の岩田です。2014年最初の任天堂ダイレクトを
<emphasis level="moderate">
直接
</emphasis>
お届けいたします。</speak>
"""
response = client.synthesize_speech(
    OutputFormat='mp3',
    LanguageCode='ja-JP',
    Text=text,
    TextType='ssml',
    VoiceId="Takumi",
)
print(response)
mp3_binary = response["AudioStream"].read()
file_name = "talk_with_ssml.mp3"
file_path = "./"
with open(file_path + file_name,"wb") as f:
    f.write(mp3_binary)<jupyter_output><empty_output><jupyter_text>Lexicon を試してみる<jupyter_code># 本気と書いてマジと読む
lexicon = """<?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="ja-JP">
  <lexeme>
    <grapheme>本気</grapheme>
    <alias>マジ</alias>
  </lexeme>
  <lexeme>
    <grapheme>明日</grapheme>
    <alias>あした</alias>
  </lexeme>
</lexicon>
"""

response = client.put_lexicon(
    Name='MajiAshita',
    Content=lexicon
)
text = "明日から本気でダイエットする"
response = client.synthesize_speech(
    OutputFormat='mp3',
    LanguageCode='ja-JP',
    LexiconNames=['MajiAshita'],
    Text=text,
    VoiceId="Takumi",
)
print(response)
mp3_binary = response["AudioStream"].read()
file_name = "talk_with_lexicon.mp3"
file_path = "./"
with open(file_path + file_name,"wb") as f:
    f.write(mp3_binary)<jupyter_output><empty_output><jupyter_text>お片付け<jupyter_code># レキシコン削除
client.delete_lexicon(Name='MajiAshita')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16808149405772496, 'fraction_numerical': 0.025891341256366725, 'mean_word_length': 5.620786516853933, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 1, '>': 42, 'https://': 1, 'lorem ipsum': 0, 'www.': 5, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '306964', 'license': 'Apache-2.0', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1055, 'n_words': 104, 'path': '2_Polly/Polly.ipynb', 'repo_name': 'kazuhitogo/call-aws-ai-service-api', 'size': '2356'}