Skip to content

Commit

Permalink
Python APIのパラメータ名を修正 (#320)
Browse files Browse the repository at this point in the history
* wip

* _models.pyと_rust.pyiのドキュメントを書く

* Blackでフォーマット

* `s/_list/_vector/g`

* 引数の説明を更新

Co-authored-by: Gray Suitcase <[email protected]>

Co-authored-by: Gray Suitcase <[email protected]>
  • Loading branch information
qryxip and PickledChair authored Oct 23, 2022
1 parent 9c22f16 commit 49a8647
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
32 changes: 16 additions & 16 deletions crates/voicevox_core_python_api/python/voicevox_core/_rust.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ class VoicevoxCore:
...
def predict_duration(
self,
phoneme_list: NDArray[np.int64],
phoneme_vector: NDArray[np.int64],
speaker_id: int,
) -> NDArray[np.float32]:
"""音素ごとの長さを推論する。
Parameters
----------
phoneme_list
phoneme_vector
音素データ。
speaker_id
話者ID。
Expand All @@ -82,31 +82,31 @@ class VoicevoxCore:
def predict_intonation(
self,
length: int,
vowel_phoneme_list: NDArray[np.int64],
consonant_phoneme_list: NDArray[np.int64],
start_accent_list: NDArray[np.int64],
end_accent_list: NDArray[np.int64],
start_accent_phrase_list: NDArray[np.int64],
end_accent_phrase_list: NDArray[np.int64],
vowel_phoneme_vector: NDArray[np.int64],
consonant_phoneme_vector: NDArray[np.int64],
start_accent_vector: NDArray[np.int64],
end_accent_vector: NDArray[np.int64],
start_accent_phrase_vector: NDArray[np.int64],
end_accent_phrase_vector: NDArray[np.int64],
speaker_id: int,
) -> NDArray[np.float32]:
"""モーラごとのF0を推論する。
Parameters
----------
length
vowel_phoneme_list, consonant_phoneme_list, start_accent_list, end_accent_list, start_accent_phrase_list, end_accent_phrase_list, output のデータ長。
vowel_phoneme_list
vowel_phoneme_vector, consonant_phoneme_vector, start_accent_vector, end_accent_vector, start_accent_phrase_vector, end_accent_phrase_vector, output のデータ長。
vowel_phoneme_vector
母音の音素データ。
consonant_phoneme_list
consonant_phoneme_vector
子音の音素データ。
start_accent_list
start_accent_vector
アクセントの開始位置のデータ。
end_accent_list
end_accent_vector
アクセントの終了位置のデータ。
start_accent_phrase_list
start_accent_phrase_vector
アクセント句の開始位置のデータ。
end_accent_phrase_list
end_accent_phrase_vector
アクセント句の終了位置のデータ。
speaker_id
話者ID。
Expand Down Expand Up @@ -134,7 +134,7 @@ class VoicevoxCore:
音素のサイズ phoneme のデータ長に関連する。
f0
基本周波数。
phoneme_list
phoneme_vector
音素データ。
speaker_id
話者ID。
Expand Down
28 changes: 14 additions & 14 deletions crates/voicevox_core_python_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ impl VoicevoxCore {

fn predict_duration<'py>(
&mut self,
phoneme_list: &'py PyArray<i64, Ix1>,
phoneme_vector: &'py PyArray<i64, Ix1>,
speaker_id: u32,
py: Python<'py>,
) -> PyResult<&'py PyArray<f32, Ix1>> {
let duration = self
.inner
.predict_duration(&phoneme_list.to_vec()?, speaker_id)
.predict_duration(&phoneme_vector.to_vec()?, speaker_id)
.into_py_result()?;
Ok(PyArray::from_vec(py, duration))
}
Expand All @@ -116,25 +116,25 @@ impl VoicevoxCore {
fn predict_intonation<'py>(
&mut self,
length: usize,
vowel_phoneme_list: &'py PyArray<i64, Ix1>,
consonant_phoneme_list: &'py PyArray<i64, Ix1>,
start_accent_list: &'py PyArray<i64, Ix1>,
end_accent_list: &'py PyArray<i64, Ix1>,
start_accent_phrase_list: &'py PyArray<i64, Ix1>,
end_accent_phrase_list: &'py PyArray<i64, Ix1>,
vowel_phoneme_vector: &'py PyArray<i64, Ix1>,
consonant_phoneme_vector: &'py PyArray<i64, Ix1>,
start_accent_vector: &'py PyArray<i64, Ix1>,
end_accent_vector: &'py PyArray<i64, Ix1>,
start_accent_phrase_vector: &'py PyArray<i64, Ix1>,
end_accent_phrase_vector: &'py PyArray<i64, Ix1>,
speaker_id: u32,
py: Python<'py>,
) -> PyResult<&'py PyArray<f32, Ix1>> {
let intonation = self
.inner
.predict_intonation(
length,
&vowel_phoneme_list.to_vec()?,
&consonant_phoneme_list.to_vec()?,
&start_accent_list.to_vec()?,
&end_accent_list.to_vec()?,
&start_accent_phrase_list.to_vec()?,
&end_accent_phrase_list.to_vec()?,
&vowel_phoneme_vector.to_vec()?,
&consonant_phoneme_vector.to_vec()?,
&start_accent_vector.to_vec()?,
&end_accent_vector.to_vec()?,
&start_accent_phrase_vector.to_vec()?,
&end_accent_phrase_vector.to_vec()?,
speaker_id,
)
.into_py_result()?;
Expand Down

0 comments on commit 49a8647

Please sign in to comment.