Adaptiven A1-Kurs und statistisches Aussprachetraining integrieren
Direkte DeepSeek- und Mistral-Anbindung mit versionierten Aktionsprofilen, Budgetreservierung, Tokenabrechnung und administrativen Qualitätsprüfungen ersetzen die Flowise-Abhängigkeit im regulären Betrieb. 840 geprüfte A1-Aufgaben mit geschützter Testauswertung und konkreten offenen Arbeitsaufträgen ergänzen den Kurs. Inhalts- und Sprachbewertung bleiben von Azure-Aussprachewerten getrennt; historische Aufgaben und Antworten bleiben erhalten. Echte Wort- und Phonemmessungen werden mit Herkunft, Aktualität und Nachweisdichte gebündelt. Go bestimmt Trainingsziele und Wiederholungen, das Modell formuliert dazu passende Nachsprechübungen. Profilansicht und Auswahlgründe werden angezeigt. Validierung: Go-Race-Tests mit lokaler PostgreSQL-Integration, go vet, Web-Build, Audit aller 840 Aufgaben und drei Browser-Smokes mit lokalen Modell-/Speech-Fixtures bestanden. Keine Produktionsänderungen oder Live-Aufrufe.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"speech-learning-api/internal/domain"
|
||||
"speech-learning-api/internal/services"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Explicit local fixture, not a claim of a real Azure measurement.
|
||||
type bankFixtureSpeech struct{}
|
||||
|
||||
func (bankFixtureSpeech) AssessPronunciation(_ context.Context, in services.PronunciationInput) (domain.PronunciationResult, error) {
|
||||
return domain.PronunciationResult{Provider: "azure", RecognizedText: in.TargetText, OverallScore: 90, AccuracyScore: 90}, nil
|
||||
}
|
||||
func (bankFixtureSpeech) Transcribe(context.Context, []byte, string, string) (string, error) {
|
||||
return "I have got a brother.", nil
|
||||
}
|
||||
func (bankFixtureSpeech) Synthesize(context.Context, string, string, string) ([]byte, string, error) {
|
||||
return []byte("fixture mp3"), "audio/mpeg", nil
|
||||
}
|
||||
func (bankFixtureSpeech) SynthesizeExercise(context.Context, string, string, string, string, string) ([]byte, string, error) {
|
||||
return []byte("fixture mp3"), "audio/mpeg", nil
|
||||
}
|
||||
|
||||
// Named fixtures intentionally simulate known measurements; they never call Azure.
|
||||
type statisticalFixtureSpeech struct{ bankFixtureSpeech }
|
||||
|
||||
func (statisticalFixtureSpeech) AssessPronunciation(_ context.Context, in services.PronunciationInput) (domain.PronunciationResult, error) {
|
||||
result := domain.PronunciationResult{Provider: "azure", Locale: in.Locale, Alphabet: "IPA", Method: "scripted", MeasurementVersion: "test-fixture", RecognizedText: in.TargetText, OverallScore: 80, AccuracyScore: 80}
|
||||
for _, token := range strings.Fields(in.TargetText) {
|
||||
word := strings.ToLower(strings.Trim(token, ".,!?"))
|
||||
w := domain.WordScore{Word: word, Accuracy: 90, Highlight: "good"}
|
||||
if word == "cat" || word == "cup" || word == "school" {
|
||||
w.Accuracy = 40
|
||||
w.Highlight = "weak"
|
||||
w.PhonemeScores = []domain.PhonemeScore{{Phoneme: "k", Accuracy: 30, Highlight: "weak"}}
|
||||
}
|
||||
result.WordScores = append(result.WordScores, w)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user