Skip to content

Commit

Permalink
voicevox_core.asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Dec 5, 2023
1 parent b9edd5b commit 4b748f5
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 449 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import conftest
import pytest
import pytest_asyncio
from voicevox_core import OpenJtalk, Synthesizer
from voicevox_core.asyncio import OpenJtalk, Synthesizer


def test_enter_returns_workable_self(synthesizer: Synthesizer) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

@pytest.mark.asyncio
async def test_user_dict_load() -> None:
open_jtalk = await voicevox_core.OpenJtalk.new(conftest.open_jtalk_dic_dir)
model = await voicevox_core.VoiceModel.from_path(conftest.model_dir)
synthesizer = voicevox_core.Synthesizer(open_jtalk)
open_jtalk = await voicevox_core.asyncio.OpenJtalk.new(conftest.open_jtalk_dic_dir)
model = await voicevox_core.asyncio.VoiceModel.from_path(conftest.model_dir)
synthesizer = voicevox_core.asyncio.Synthesizer(open_jtalk)

await synthesizer.load_voice_model(model)

audio_query_without_dict = await synthesizer.audio_query(
"this_word_should_not_exist_in_default_dictionary", style_id=0
)

temp_dict = voicevox_core.UserDict()
temp_dict = voicevox_core.asyncio.UserDict()
uuid = temp_dict.add_word(
voicevox_core.UserDictWord(
surface="this_word_should_not_exist_in_default_dictionary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@pytest.mark.asyncio
async def test_user_dict_load() -> None:
dict_a = voicevox_core.UserDict()
dict_a = voicevox_core.asyncio.UserDict()

# 単語の追加
uuid_a = dict_a.add_word(
Expand All @@ -38,7 +38,7 @@ async def test_user_dict_load() -> None:
assert dict_a.words[uuid_a].pronunciation == "フガ"

# ユーザー辞書のインポート
dict_b = voicevox_core.UserDict()
dict_b = voicevox_core.asyncio.UserDict()
uuid_b = dict_b.add_word(
voicevox_core.UserDictWord(
surface="foo",
Expand All @@ -50,7 +50,7 @@ async def test_user_dict_load() -> None:
assert uuid_b in dict_a.words

# ユーザー辞書のエクスポート
dict_c = voicevox_core.UserDict()
dict_c = voicevox_core.asyncio.UserDict()
uuid_c = dict_c.add_word(
voicevox_core.UserDictWord(
surface="bar",
Expand Down
11 changes: 2 additions & 9 deletions crates/voicevox_core_python_api/python/voicevox_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,26 @@
ModelAlreadyLoadedError,
ModelNotFoundError,
NotLoadedOpenjtalkDictError,
OpenJtalk,
OpenZipFileError,
ParseKanaError,
ReadZipEntryError,
SaveUserDictError,
StyleAlreadyLoadedError,
StyleNotFoundError,
Synthesizer,
UserDict,
UseUserDictError,
VoiceModel,
WordNotFoundError,
__version__,
supported_devices,
)

from . import blocking # noqa: F401 isort: skip
from . import asyncio, blocking # noqa: F401 isort: skip

__all__ = [
"__version__",
"AccelerationMode",
"AccentPhrase",
"AudioQuery",
"asyncio",
"blocking",
"ExtractFullContextLabelError",
"GetSupportedDevicesError",
Expand All @@ -60,7 +57,6 @@
"ModelNotFoundError",
"Mora",
"NotLoadedOpenjtalkDictError",
"OpenJtalk",
"OpenZipFileError",
"ParseKanaError",
"ReadZipEntryError",
Expand All @@ -71,11 +67,8 @@
"StyleNotFoundError",
"StyleVersion",
"SupportedDevices",
"Synthesizer",
"VoiceModel",
"supported_devices",
"UseUserDictError",
"UserDict",
"UserDictWord",
"UserDictWordType",
"VoiceModelId",
Expand Down
Loading

0 comments on commit 4b748f5

Please sign in to comment.