Phonembewertung speichern und anzeigen
Azure-Phonemwerte in Versuchen sichern, schwache Laute im Fortschritt und Flowise-Kontext auswerten und die Web-Anzeige ergänzen. README dokumentiert Datenfluss, Betrieb und Grenzen der Funktion.
This commit is contained in:
@@ -39,6 +39,20 @@ func TestFeedbackForWeakWordNamesObservedProblem(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFeedbackNamesMeasuredWeakPhoneme(t *testing.T) {
|
||||
result := domain.PronunciationResult{
|
||||
OverallScore: 79,
|
||||
WordScores: []domain.WordScore{{
|
||||
Word: "water", Accuracy: 72, Highlight: "weak",
|
||||
PhonemeScores: []domain.PhonemeScore{{Phoneme: "w", Accuracy: 90}, {Phoneme: "t", Accuracy: 58}},
|
||||
}},
|
||||
}
|
||||
feedback := mockFeedback("I drink water.", result)
|
||||
if !strings.Contains(feedback.TeacherFeedback, "/t/") || !strings.Contains(feedback.TeacherFeedback, "58") {
|
||||
t.Fatalf("expected measured phoneme in feedback, got %#v", feedback)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFlowiseNextExerciseSendsSessionAndParsesResponse(t *testing.T) {
|
||||
var requestBody map[string]json.RawMessage
|
||||
|
||||
@@ -78,7 +92,14 @@ func TestFlowiseNextExerciseSendsSessionAndParsesResponse(t *testing.T) {
|
||||
}, slog.New(slog.NewTextHandler(io.Discard, nil)))
|
||||
|
||||
exercise, err := teacher.NextExercise(context.Background(), domain.GeneratedExerciseRequest{
|
||||
UserID: "usr_1",
|
||||
UserID: "usr_1",
|
||||
Progress: domain.ProgressSummary{
|
||||
WeakPhonemes: []domain.WeakPhoneme{{Word: "water", Phoneme: "t", Accuracy: 58}},
|
||||
RecentAttempts: []domain.Attempt{{WordScores: []domain.WordScore{{
|
||||
Word: "water", Accuracy: 70, PhonemeScores: []domain.PhonemeScore{{Phoneme: "t", Accuracy: 58}},
|
||||
}}}},
|
||||
},
|
||||
RecentWeakWords: []domain.WordScore{{Word: "water", Accuracy: 70, PhonemeScores: []domain.PhonemeScore{{Phoneme: "t", Accuracy: 58}}}},
|
||||
TargetLanguage: "en-US",
|
||||
CEFRLevel: "A1",
|
||||
SessionID: "usr_1:en-US:practice",
|
||||
@@ -128,6 +149,12 @@ func TestFlowiseNextExerciseSendsSessionAndParsesResponse(t *testing.T) {
|
||||
if texts, ok := question["avoid_reference_texts"].([]any); !ok || len(texts) != 2 {
|
||||
t.Fatalf("unexpected avoid_reference_texts %#v", question["avoid_reference_texts"])
|
||||
}
|
||||
if phonemes, ok := question["recent_weak_phonemes"].([]any); !ok || len(phonemes) != 1 {
|
||||
t.Fatalf("weak phonemes were not sent to Flowise: %#v", question["recent_weak_phonemes"])
|
||||
}
|
||||
if strings.Contains(questionText, "phoneme_scores") {
|
||||
t.Fatal("raw phoneme scores should be summarized before sending progress to Flowise")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidGeneratedExerciseRejectsEarlierRecentSentence(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user