-
Notifications
You must be signed in to change notification settings - Fork 208
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
AquesTalk記法のバリデータ (#315) #681
Conversation
pre-commitのインストールが抜けていました |
PRありがとうございます! 良いですね!! validate関数を作って実際にparse_kana辺りからバリデーションしますか。 その辺できたらdraft外しちゃっていただけると! |
a05f541
to
27db1b9
Compare
test/test_kana_parser.py
Outdated
@@ -535,6 +536,7 @@ def _assert_error_code(self, kana: str, code: ParseKanaErrorCode): | |||
parse_kana(kana) | |||
self.assertEqual(err.exception.errcode, code) | |||
|
|||
@unittest.skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse_kanaの先頭でvalidate_kanaにより非受理の判定だった時点で既存の処理をスキップするようにしたため、いったんテストを無効化しています
voicevox_engine/kana_parser.py
Outdated
@@ -89,6 +104,9 @@ def parse_kana(text: str) -> List[AccentPhrase]: | |||
if len(text) == 0: | |||
raise ParseKanaError(ParseKanaErrorCode.EMPTY_PHRASE, position=1) | |||
|
|||
if not validate_kana(text): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate_kanaは非受理の原因までは判別しないため、エラーコードは適当なものになっています
parse_kanaのエラーコード処理の部分が完全に頭から抜けていました |
@FujisakiEx たしかにエラー内容がわからないと不便ですね・・・!! |
@Hiroshiba 了解しました、私もそれで問題ないかと思います |
@FujisakiEx 元issueはバリデーション用の新しいAPIを作るかどうかということなので、まだ未解決なので残しておくべきかなと思います。 |
@Hiroshiba すいません、私の考えているAPIの理解が間違っていました |
あ! たしかにissueにちゃんと書いてなかったです、web APIのことを意図していました! |
レビューしても問題なさそうになったらdraftを外して頂ければ! |
run.py
Outdated
) | ||
def validate_kana(text: str): | ||
""" | ||
テキストがAquesTalk記法に従っているかどうかを判定します. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
他のとこと名称などを合わせて「AquesTalkライクな記法」、と句点は「。」でお願いします!
あとエラーを返すことも伝えると丁寧かもです。こんな感じとか・・・?
テキストがAquesTalk記法に従っているかどうかを判定します. | |
テキストがAquesTalkライクな記法に従っているかどうかを判定します。 | |
従っていない場合はエラーが返ります。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
@takana-v さんも見て頂けると心強いです!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMです!
フィードバックを反映しました、コミットログが5つに分かれており、最終的に消える変更ばかりなのでrebaseしたほうがよいでしょうか? |
「Squash and marge」でマージするので大丈夫です! |
テストが通ったのでマージします。 |
@takana-v |
は閉じちゃって良さそうなので閉じます・・・! |
内容
AquesTalk記法のチェックを行う正規表現とそのテストです
issue と kana_parser.py を見る限りでは 本家AquesTalkに従わなくてもいいのかなと思い、現状生成されうるものに従ったテストにしています
関連 Issue
ref #315
ref #316
その他
ref #316の議論がそもそも尽くされていなさそうなのと、初のPRで色々勝手がわかっていないのでAPIを用意するところまではやっていません。