feat: 中国語の音声判定機能を追加 - #55
Open
KoshiroIto wants to merge 7 commits into
Open
KoshiroIto wants to merge 7 commits into
KoshiroIto wants to merge 7 commits into
Conversation
tknkaa
self-requested a review
September 20, 2026 08:34
tknkaa
requested changes
Sep 20, 2026
tknkaa
left a comment
Contributor
There was a problem hiding this comment.
React について基本的なところは理解できてるけど、まだアンチパターンを踏んでるので少しずつ勉強していこう!
| new (): SpeechRecognitionInstance; | ||
| } | ||
|
|
||
| interface IWindow { |
Contributor
There was a problem hiding this comment.
既存の慣習に合わせると I prefix はない方がいいと思う
| <div className="mt-1 flex flex-wrap gap-1"> | ||
| {alternatives.map((alt, i) => ( | ||
| <span | ||
| key={i} |
Contributor
There was a problem hiding this comment.
React はリストを再レンダリングするときに key を見て、要素を使い回すか決めているから、key にはユニークな値を使うのがよくて、今回は alt をそのまま使うのがよさそう
| ? selectedProblem.pinyin | ||
| : pinyin(currentTargetText, { style: pinyin.STYLE_TONE }).flat().join(" "); | ||
|
|
||
| useEffect(() => { |
Contributor
There was a problem hiding this comment.
基本的には useEffect を使ったらクリーンアップ関数を定義する必要があるって覚えよう!
今回で言うと、クリーンアップ関数がないと、録音中に別ページに移動したときマイクが起動したままになるので、以下のような感じで追加したい
return () => {
recognition.stop();
recognition.onresult = null;
recognition.onerror = null;
recognition.onend = null;
};
tknkaa
approved these changes
Sep 20, 2026
tknkaa
left a comment
Contributor
There was a problem hiding this comment.
とりあえず approve したので、修正したら squash and merge してもらう感じで!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中国語の音声判定機能を追加しました。
入力した中国語をピンインに変換してユーザーが発音して録音したものと比較しています。
デザイン等はほかの教材を参考にしました。
必要あれば変更したいです。
急ぎで作ったのでAI比率が高く意味不明な場所があるかもしれないのでreviewよろしくお願いします。