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:
@@ -38,9 +38,22 @@ export type WordScore = {
|
||||
accuracy: number;
|
||||
error_type?: string;
|
||||
phonemes?: string[];
|
||||
phoneme_scores?: PhonemeScore[];
|
||||
highlight: 'good' | 'ok' | 'weak';
|
||||
};
|
||||
|
||||
export type PhonemeScore = {
|
||||
phoneme: string;
|
||||
accuracy: number;
|
||||
highlight: 'good' | 'ok' | 'weak';
|
||||
};
|
||||
|
||||
export type WeakPhoneme = {
|
||||
word: string;
|
||||
phoneme: string;
|
||||
accuracy: number;
|
||||
};
|
||||
|
||||
export type Attempt = {
|
||||
id: string;
|
||||
exercise_id: string;
|
||||
@@ -60,6 +73,7 @@ export type ProgressSummary = {
|
||||
total_attempts: number;
|
||||
average_score: number;
|
||||
weak_words: WordScore[] | null;
|
||||
weak_phonemes: WeakPhoneme[] | null;
|
||||
recent_attempts: Attempt[] | null;
|
||||
daily_goal_minutes: number;
|
||||
};
|
||||
|
||||
@@ -318,6 +318,22 @@ input:focus {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.phoneme-panel {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.phoneme-row,
|
||||
.phoneme-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.phoneme-row strong {
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.debug-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import type { WordScore } from '../api/types';
|
||||
|
||||
type Props = {
|
||||
words: WordScore[];
|
||||
};
|
||||
|
||||
export function PhonemeAnalysis({ words }: Props) {
|
||||
const scoredWords = words.filter((word) => word.error_type?.toLowerCase() !== 'omission' && (word.phoneme_scores?.length ?? 0) > 0);
|
||||
|
||||
return (
|
||||
<section className="panel result-panel phoneme-panel">
|
||||
<h2>Lautanalyse</h2>
|
||||
{scoredWords.length === 0 ? (
|
||||
<p className="muted">Für diese Aufnahme sind keine Lautwerte verfügbar.</p>
|
||||
) : (
|
||||
<>
|
||||
<p className="muted">Azure bewertet jeden Laut von 0 bis 100. Werte unter 75 markieren hier Übungsbedarf.</p>
|
||||
{scoredWords.map((word, wordIndex) => (
|
||||
<div className="phoneme-row" key={`${word.word}-${wordIndex}`}>
|
||||
<strong>{word.word}</strong>
|
||||
<div className="phoneme-list">
|
||||
{word.phoneme_scores?.map((phoneme, phonemeIndex) => (
|
||||
<span
|
||||
className={`word word-${phoneme.highlight}`}
|
||||
title={`${word.word}: Laut /${phoneme.phoneme}/, ${Math.round(phoneme.accuracy)} von 100 Punkten`}
|
||||
key={`${phoneme.phoneme}-${phonemeIndex}`}
|
||||
>
|
||||
/{phoneme.phoneme}/ {Math.round(phoneme.accuracy)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { fetchNextLesson } from '../api/lessons';
|
||||
import { submitAttempt } from '../api/practice';
|
||||
import type { AttemptResponse, Exercise, Lesson } from '../api/types';
|
||||
import { AudioRecorder } from '../components/AudioRecorder';
|
||||
import { PhonemeAnalysis } from '../components/PhonemeAnalysis';
|
||||
import { PronunciationText } from '../components/PronunciationText';
|
||||
import { ScoreBadge } from '../components/ScoreBadge';
|
||||
|
||||
@@ -115,6 +116,7 @@ export function PracticePage({ initialSelection }: Props) {
|
||||
<p>{result.teacher.teacher_feedback}</p>
|
||||
<p className="muted">{result.teacher.next_recommendation}</p>
|
||||
</div>
|
||||
<PhonemeAnalysis words={result.attempt.word_scores} />
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -48,6 +48,21 @@ export function ProgressPage() {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="panel result-panel">
|
||||
<h2>Schwierige Laute</h2>
|
||||
<div className="weak-list">
|
||||
{(progress.weak_phonemes ?? []).length === 0 ? (
|
||||
<p className="muted">Noch keine bewerteten Lautschwächen.</p>
|
||||
) : (
|
||||
(progress.weak_phonemes ?? []).map((item) => (
|
||||
<span className="word word-weak" key={`${item.word}-${item.phoneme}`}>
|
||||
{item.word}: /{item.phoneme}/ {Math.round(item.accuracy)}
|
||||
</span>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="panel result-panel">
|
||||
<h2>Letzte Versuche</h2>
|
||||
<div className="attempt-list">
|
||||
|
||||
Reference in New Issue
Block a user