Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

整理: モーフィング許可を Enum から Literal へ変更 #1413

Merged
merged 4 commits into from
Jun 23, 2024

Conversation

tarepan
Copy link
Contributor

@tarepan tarepan commented Jun 21, 2024

内容

概要: モーフィング許可を Enum から Literal へ変更してリファクタリング

現在の ENGINE はモーフィング許可を SpeakerSupportPermittedSynthesisMorphing(str, Enum) 型で表現している。
この Enum は literal と同じ役割のみをしており、literal での置き換えが可能である。literal はより単機能・単純であり、置き換えれば Enum の振る舞いを理解するコストを不要にできる。現在も Enum を使っているのは恐らく Python の言語機能や型推論が貧弱だった頃の名残である。

SpeakerSupportPermittedSynthesisMorphing クラスを定義しているため、OpenAPI schema にもこのクラスが含まれている。#1411 で整理された通り、クラス名変更でも配慮が必要である。
VOICEVOX editor を確認した限り、SpeakerSupportPermittedSynthesisMorphing の literal 化は人によって書かれたコードへ影響しない模様である。自動生成部に変更は発生する。

このような背景から、モーフィング許可を Enum から Literal へ変更するリファクタリングを提案します。

スクリーンショット・動画など

description を追加したため、ドキュメントが充実しています。

image

関連 Issue

無し

@tarepan tarepan requested a review from a team as a code owner June 21, 2024 03:48
@tarepan tarepan requested review from Hiroshiba and removed request for a team June 21, 2024 03:48
@tarepan
Copy link
Contributor Author

tarepan commented Jun 21, 2024

dataclass / BaseModel 関連で問題があったため、一旦 draft 化します。

追記: スナップショット更新忘れが原因でした。

@tarepan tarepan marked this pull request as draft June 21, 2024 04:03
@tarepan tarepan marked this pull request as ready for review June 23, 2024 05:37
@tarepan
Copy link
Contributor Author

tarepan commented Jun 23, 2024

CI pass を確認しました。レビューよろしくお願いします。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

エディタでの確認ありがとうございます!そこが気になっていました!!

文中の値をくくるものを ' にするか ` にするかで揺れ始めてるかも?

@Hiroshiba Hiroshiba merged commit 3c30f30 into VOICEVOX:master Jun 23, 2024
4 checks passed
@tarepan tarepan deleted the refactor/literal_morph branch June 24, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants