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

整理: _PartOfSpeechDetaildataclass へ変更 #1395

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions voicevox_engine/user_dict/user_dict_word.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from dataclasses import dataclass

import numpy as np
from pydantic import BaseModel, Field

from voicevox_engine.user_dict.model import (
USER_DICT_MAX_PRIORITY,
Expand All @@ -13,20 +12,17 @@
)


class _PartOfSpeechDetail(BaseModel):
"""
品詞ごとの情報
"""

part_of_speech: str = Field(title="品詞")
part_of_speech_detail_1: str = Field(title="品詞細分類1")
part_of_speech_detail_2: str = Field(title="品詞細分類2")
part_of_speech_detail_3: str = Field(title="品詞細分類3")
# context_idは辞書の左・右文脈IDのこと
# https://github.com/VOICEVOX/open_jtalk/blob/427cfd761b78efb6094bea3c5bb8c968f0d711ab/src/mecab-naist-jdic/_left-id.def # noqa
context_id: int = Field(title="文脈ID")
cost_candidates: list[int] = Field(title="コストのパーセンタイル")
accent_associative_rules: list[str] = Field(title="アクセント結合規則の一覧")
@dataclass(frozen=True)
class _PartOfSpeechDetail:
"""品詞ごとの情報"""

part_of_speech: str # 品詞
part_of_speech_detail_1: str # 品詞細分類1
part_of_speech_detail_2: str # 品詞細分類2
part_of_speech_detail_3: str # 品詞細分類3
context_id: int # 辞書の左・右文脈ID。https://github.com/VOICEVOX/open_jtalk/blob/427cfd761b78efb6094bea3c5bb8c968f0d711ab/src/mecab-naist-jdic/_left-id.def # noqa
cost_candidates: list[int] # コストのパーセンタイル
accent_associative_rules: list[str] # アクセント結合規則の一覧


_costs_proper_noun = [-988, 3488, 4768, 6048, 7328, 8609, 8734, 8859, 8984, 9110, 14176]
Expand Down