G2G
Chapter 73

Adjektivdeklination I

Weak Endings After Der, Die, Das

The Article Already Signals; The Adjective Relaxes

You have entered the realm of adjective declension. This is where many German learners freeze in terror. But we are about to dismantle that fear with a single insight: When a definite article (der, die, das) precedes an adjective, the article has already done the grammatical work. The adjective merely agrees with simple, predictable endings: almost always -en, with just a handful of exceptions.

The Secret: The Article Signals; The Adjective Relaxes

The Fundamental Principle

In German, grammatical information (gender, number, case) must be signaled clearly. When a definite article precedes the adjective, that article is the signal-carrier. The definite article already tells you the gender and case through its form (der, die, das, den, dem, des, etc.). The adjective's job is simple: agree without adding more information. This is called "weak" declension because the adjective needs to do minimal work.

The Pattern
Article signals. Adjective agrees. No duplication of effort. Pure efficiency.

Understanding the Five Exceptions

The 80/20 Rule of Weak Declension

Here is the remarkable fact: 80% of weak adjective endings are -en. The remaining 20% are just five nominative and accusative slots where the ending is -e. These five exceptions are:

The Five Exceptions (All Nominative/Accusative)
1. Nominative masculine: der große Mann (-e)
2. Nominative feminine: die große Frau (-e)
3. Nominative neuter: das große Haus (-e)
4. Accusative feminine: die große Frau (-e)
5. Accusative neuter: das große Haus (-e)
The Insight: These five exceptions follow a pattern. They all occur in nominative or accusative, where the article itself signals the information clearly. The adjective doesn't need to add -en; it stays with -e. Everywhere else: dative (all), genitive (all), accusative masculine, and plural nominative—it's -en.

The Complete Weak Declension Table

This is the full weak declension table after definite articles. Study the pattern. Notice how -e appears only in the five exceptions, and -en dominates everywhere else. The color coding helps: gold for -e, silver for -en.

-e (5 exceptions)
-en (rest of table)
Case Masculine Feminine Neuter Plural (All)
Nominative -e der große Mann -e die große Frau -e das große Haus -en die großen Häuser
Accusative -en den großen Mann -e die große Frau -e das große Haus -en die großen Häuser
Dative -en dem großen Mann -en der großen Frau -en dem großen Haus -en den großen Häusern
Genitive -en des großen Mannes -en der großen Frau -en des großen Hauses -en der großen Häuser

The Pattern Revealed: You have only two endings to learn: -e and -en. The -e appears in exactly five slots (the four nominative singulars plus accusative feminine and neuter). Everything else is -en. Once you see this pattern, the table becomes simple. It's not 16 endings; it's two, with a clear rule.

Progressive Examples: Building Mastery

From Simple to Complex
Stage 1: Nominative (The Foundation)
Nominative is where the -e exception appears clearly. The subject is being identified.

Der große Mann ist alt. (The big man is old.)
Die schöne Frau spricht Deutsch. (The beautiful woman speaks German.)
Das neue Auto fährt schnell. (The new car drives fast.)
Die großen Häuser sind alt. (The big houses are old.)
Stage 2: Accusative (The Object)
Accusative masculine changes to -en. Feminine and neuter keep -e.

Ich sehe den großen Mann. (I see the big man.)
Ich sehe die schöne Frau. (I see the beautiful woman.)
Ich sehe das neue Auto. (I see the new car.)
Ich sehe die großen Häuser. (I see the big houses.)
Stage 3: Dative (All -en)
Dative is uniform: all adjectives take -en, regardless of gender.

Ich spreche mit dem großen Mann. (I speak with the big man.)
Ich spreche mit der schönen Frau. (I speak with the beautiful woman.)
Ich spreche mit dem neuen Auto. (I speak with the new car.)
Ich spreche mit den großen Häusern. (I speak with the big houses.)
Stage 4: Genitive (All -en)
Genitive is also uniform: all adjectives take -en.

Das Buch des großen Mannes. (The book of the big man.)
Die Tasche der schönen Frau. (The bag of the beautiful woman.)
Die Farbe des neuen Autos. (The color of the new car.)
Das Dach der großen Häuser. (The roof of the big houses.)

Essential Adjectives: Your Building Blocks

These ten adjectives will anchor your understanding. Click on each to hear the pronunciation, and notice how the example changes with case.

groß
big; large; great
Der große Mann sitzt hier. (The big man sits here.)
大 (dà)
klein
small; tiny
Das kleine Kind spielt im Park. (The small child plays in the park.)
小 (xiǎo)
alt
old; aged
Der alte Baum hat viele Äste. (The old tree has many branches.)
老 (lǎo)
jung
young; youthful
Die jungen Leute tanzen gerne. (The young people like to dance.)
年轻 (niánqīng)
schön
beautiful; lovely; fine
Das ist eine schöne Stadt. (That is a beautiful city.)
漂亮 (piàoliàng)
gut
good; well; nice
Das ist eine gute Idee. (That is a good idea.)
好 (hǎo)
schlecht
bad; poor; evil
Der schlechte Wetter macht uns traurig. (The bad weather makes us sad.)
坏 (huài)
lang
long; lengthy
Der lange Roman ist sehr interessant. (The long novel is very interesting.)
长 (cháng)
kurz
short; brief
Das kurze Leben war erfüllt und intensiv. (The short life was full and intense.)
短 (duǎn)
neu
new; fresh; recent
Das neue Auto fährt sehr schnell. (The new car drives very fast.)
新 (xīn)

The Chinese Bridge: Why This Matters

Adjectives Without Declension

In Chinese, adjectives do not decline. The word 大 (dà = big) remains 大 regardless of the grammatical context. A big man is 大人 (dà rén). A big house is 大房子 (dà fángzi). The adjective never changes.

Chinese: No Adjective Declension
大人 (dà rén) — big person
大房子 (dà fángzi) — big house
大树 (dà shù) — big tree
The adjective 大 never changes.

German, by contrast, encodes grammatical information directly into the adjective ending. The adjective becomes a carrier of gender and case information. This allows German to maintain word order flexibility: the ending tells you who does what to whom, regardless of position.

German: Adjectives Encode Information
Der große Mann (The big man — nominative, signals through article and adjective)
Den großen Mann (The big man — accusative, signals through article and adjective)
Dem großen Mann (The big man — dative, signals through article and adjective)
The Deep Insight: German's adjective declension is not arbitrary decoration. It's a system that allows the language to maintain inflectional meaning in a way Chinese achieves through word order and particles. Both languages convey the same grammatical information; German does it through word form, Chinese through syntax. Understanding this connection helps you see declension not as meaningless rules, but as a elegant solution to the problem of conveying grammar in a language where word order is flexible.

Case-by-Case Narrative: Understanding Why

Nominative: The Subject Case

Nominative is where the subject stands. The article in nominative is maximally informative: der, die, das. Each one is distinct. Because the article is already clear about gender, the adjective agrees simply: -e. This is the baseline. Everything in nominative singular takes -e. The only plural nominative adjectives take -en because the article die tells you it's plural, and the adjective joins in with -en.

Nominative Examples
Der große Mann sitzt. (The big man sits.)
Die alte Frau wartet. (The old woman waits.)
Das neue Haus ist schön. (The new house is beautiful.)
Die kleinen Kinder spielen. (The small children play.)
Accusative: The Object Case

Accusative is where the direct object sits. Here's where weak declension shows its elegance. The accusative article signals the information: den (masculine), die (feminine), das (neuter). Notice that feminine and neuter don't change from nominative (die, das). Their adjectives also don't change: -e. But the masculine changes: den instead of der. So the accusative masculine adjective changes to -en to match the change in the article.

Accusative Examples
Ich sehe den großen Mann. (I see the big man.)
Ich sehe die alte Frau. (I see the old woman.)
Ich sehe das neue Haus. (I see the new house.)
Ich sehe die kleinen Kinder. (I see the small children.)
Dative: The Indirect Object—All -en

Dative is the indirect object or prepositional case. Here, weak declension achieves uniformity. The dative article is: dem (masculine), der (feminine), dem (neuter), den (plural). All of these signal gender and case clearly. The adjective's job is simple: take -en across the board. No exceptions. All dative adjectives, regardless of gender or number, use -en.

Dative Examples
Ich gebe dem großen Mann ein Buch. (I give the big man a book.)
Ich schreibe der alten Frau einen Brief. (I write the old woman a letter.)
Ich helfe dem neuen Haus—nein, ich helfe dem neuenen Besitzer. (I help the new owner.)
Ich spreche mit den kleinen Kindern. (I speak with the small children.)
Genitive: The Possessive Case—All -en

Genitive expresses possession or relationship. It is the most complex case morphologically (notice: des Mannes, der Frau, des Hauses, der Häuser—all the articles change and the nouns add endings). But for the adjective, it's simple: always -en. No exceptions. Whether the noun is masculine, feminine, neuter, or plural, the adjective takes -en.

Genitive Examples
Das Buch des großen Mannes. (The book of the big man.)
Der Name der alten Frau. (The name of the old woman.)
Die Farbe des neuen Hauses. (The color of the new house.)
Das Lachen der kleinen Kinder. (The laughter of the small children.)

The Five Exceptions Explained: Why They Make Sense

Why These Five, Not Others?

The five exceptions (nominative m/f/n and accusative f/n) all occur where the article ending is maximally informative. In nominative, the article is der (masculine), die (feminine), or das (neuter)—each one is unique and clear. The adjective's -e is redundant; it simply marks agreement. In accusative, feminine and neuter don't change from nominative, so their adjectives don't change either. Only accusative masculine changes (den instead of der), so only the masculine accusative adjective ends in -en.

The Five Exceptions Why -e?
Nominative Masculine (der großer Mann) Article is clear (der). Adjective agrees simply.
Nominative Feminine (die große Frau) Article is clear (die). Adjective agrees simply.
Nominative Neuter (das große Haus) Article is clear (das). Adjective agrees simply.
Accusative Feminine (die große Frau) No change from nominative. Article stays die; adjective stays -e.
Accusative Neuter (das große Haus) No change from nominative. Article stays das; adjective stays -e.

The exceptions aren't random. They follow a logical pattern: where the article is already clear, the adjective can be simple. This is the heart of weak declension: efficiency. The article carries the information. The adjective marks agreement without redundancy.

Common Mistake: Confusing Weak with Other Systems

What Weak Declension Is NOT

Weak declension is specifically for definite articles (der, die, das). In the next chapter, you will learn strong declension (no article) and mixed declension (ein/kein). Don't mix them now. Focus on weak: whenever you see a definite article, you're in weak territory. Two endings: -e and -en. That's all.

Weak (Definite Article) — Chapter 73
Der große Mann (article = der, adjective = -e)
Mixed (ein/kein) — Chapter 74
Ein großer Mann (article = ein, adjective = -er) [NOT WEAK]
Strong (No Article) — Chapter 74
Großer Mann (no article, adjective = -er) [NOT WEAK]
Keep Them Separate: Weak is only for der, die, das. When you see ein, kein, or no article, you're entering different territory. That's the subject of Chapter 74. For now, master weak. Don't look ahead.

You have now absorbed the logic of weak adjective declension. The article signals. The adjective agrees. Five simple exceptions in nominative and accusative where the article is clearest. Everything else: -en. What seemed like a terrifying 4×4 table of 16 forms is actually just two endings with a clear, learnable pattern. Nominative uses -e (all singulars, plural nominative stays -en). Accusative keeps feminine and neuter at -e, changes masculine to -en. Dative and genitive: all -en, no exceptions. Mastery of this principle is the foundation upon which strong and mixed declension will build. You are no longer afraid. You understand.

Chapter 73 Quiz: Weak Adjective Declension (15 Questions)

Bauwerkstatt — Production Workshop

Three Levels of Weak Adjective Declension Exercises
1Wortbaukasten — Word Building Kit
Build: "the old man"
Available words:
Build: "the beautiful woman"
Available words:
Build: "the new house"
Available words:
Build: "the strong men"
Available words:
2Lückensatz — Gap Sentence
Fill in: "Der alt______ Mann sitzt hier."
Fill in: "Die schön______ Frau arbeitet hier."
Fill in: "Ich sehe die stark______ Männer."
Fill in: "Das neu______ Buch ist interessant."
3Freies Bauen — Free Building
Translate: "the old house"
Translate: "the young woman"
Translate: "the interesting book"
Translate: "the beautiful women"
Your Progress: 0 / 12 Correct

Lesen & Hören — Read and Listen

Der alte Mann sitzt im schönen Garten und liest ein interessantes Buch.
Die junge Frau arbeitet in der großen Stadt.
Das neue Haus hat große Fenster und helle Zimmer.
Die starken Männer arbeiten zusammen in dem großen Büro.
Wir sehen die alten Häuser und die neuen Autos.
Der kluge Lehrer erklärt die neue Grammatik mit großer Geduld.

Verständnisfragen — Comprehension Questions

1. Wo sitzt der alte Mann?
im schönen Garten
in der großen Stadt
im neuen Haus
2. Was liest der Mann?
ein interessantes Buch
eine Zeitung
einen Brief
3. Welche Fenster hat das neue Haus?
4. Wo arbeiten die starken Männer?
im Garten
in dem großen Büro
in der Stadt

Diktat — Dictation Exercise

Listen and type what you hear.

Sentence 1 of 3
Patterns Discovered in This Chapter
Weak Declension After Definite Articles: The Article Signals, The Adjective Agrees — When der/die/das precedes an adjective, the article carries the grammatical information. The adjective merely needs simple, predictable endings: mostly -en.

The 80/20 Rule: 80% of Weak Endings Are -en — Most weak adjective endings are -en. Only five exceptions exist, all in nominative or accusative singulars: nominative masculine, nominative feminine, nominative neuter, accusative feminine, and accusative neuter all take -e. Everything else: -en.

Dative and Genitive Are Always -en Regardless of Gender — In dative, all genders and numbers take -en. In genitive, all take -en. This uniformity makes these cases easier than nominative/accusative, which have exceptions.

Two Endings to Master, Not Sixteen — Weak declension appears complex, but it reduces to just two endings: -e (5 exceptions) and -en (everywhere else). Once you identify which slot in the table you're using, the ending follows automatically.
A G2G Advisory Project
Your Progress
Words Collected 636 / 850 (74%)
Click to see all words ▾
Patterns & Grammar 122 / 145 (84%)
Click to see all patterns ▾
// ===== BAUWERKSTATT DATA & FUNCTIONS ===== const bauwerkstattData = { level1: [ { id: 1, words: ['der', 'Mann', 'alt'], correct: ['der', 'alte', 'Mann'], answer: 'der alte Mann', explanation: 'Nominative masculine weak: -e. The article "der" signals; the adjective adds -e.' }, { id: 2, words: ['die', 'Frau', 'schön'], correct: ['die', 'schöne', 'Frau'], answer: 'die schöne Frau', explanation: 'Nominative feminine weak: -e. All nominative singulars take -e.' }, { id: 3, words: ['das', 'Haus', 'neu'], correct: ['das', 'neue', 'Haus'], answer: 'das neue Haus', explanation: 'Nominative neuter weak: -e.' }, { id: 4, words: ['die', 'Männer', 'stark'], correct: ['die', 'starken', 'Männer'], answer: 'die starken Männer', explanation: 'Plural nominative weak: -en (different from singular).' } ], level2: [ { id: 1, sentence: 'Der alt______ Mann sitzt hier.', accepted_answers: ['e'], close_errors: [{ wrong: 'en', feedback: 'Not quite. Nominative masculine weak takes -e: der alte Mann.' }], explanation: 'Nominative masculine: -e' }, { id: 2, sentence: 'Die schön______ Frau arbeitet hier.', accepted_answers: ['e'], close_errors: [{ wrong: 'en', feedback: 'Almost! Nominative feminine takes -e: die schöne Frau.' }], explanation: 'Nominative feminine: -e' }, { id: 3, sentence: 'Ich sehe die stark______ Männer.', accepted_answers: ['en'], close_errors: [{ wrong: 'e', feedback: 'Close, but plural accusative takes -en: die starken Männer.' }], explanation: 'Plural accusative: -en' }, { id: 4, sentence: 'Das neu______ Buch ist interessant.', accepted_answers: ['e'], close_errors: [{ wrong: 'en', feedback: 'Not quite. Nominative neuter takes -e: das neue Buch.' }], explanation: 'Nominative neuter: -e' } ], level3: [ { id: 1, english: 'the old house', accepted_answers: ['das alte Haus'], close_errors: [{ wrong: 'das alten Haus', feedback: 'Very close! But nominative neuter weak uses -e, not -en: das ALTE Haus.' }], explanation: 'Nominative neuter: das alte Haus' }, { id: 2, english: 'the young woman', accepted_answers: ['die junge Frau'], close_errors: [{ wrong: 'die jugen Frau', feedback: 'Almost! It\'s: die JUNGE Frau (nominative feminine, -e).' }], explanation: 'Nominative feminine: die junge Frau' }, { id: 3, english: 'the interesting book', accepted_answers: ['das interessante Buch'], close_errors: [{ wrong: 'das interessanten Buch', feedback: 'Close! Nominative neuter weak: -e, not -en. Das INTERESSANTE Buch.' }], explanation: 'Nominative neuter: das interessante Buch' }, { id: 4, english: 'the beautiful women', accepted_answers: ['die schönen Frauen'], close_errors: [{ wrong: 'die schöne Frauen', feedback: 'Almost! Plural nominative takes -en: die SCHÖNEN Frauen.' }], explanation: 'Plural nominative: die schönen Frauen' } ] }; let bauwerkstattState = { level1: { completed: [false, false, false, false], score: 0 }, level2: { completed: [false, false, false, false], score: 0 }, level3: { completed: [false, false, false, false], score: 0 }, assembled: [[], [], [], []] }; function initBauwerkstatt() { bauwerkstattData.level1.forEach((ex) => { const bankId = `word-bank-${ex.id}`; const bank = document.getElementById(bankId); if (bank) { bank.innerHTML = ''; ex.words.forEach(word => { const chip = document.createElement('div'); chip.className = 'word-chip'; chip.textContent = word; chip.onclick = () => addToAssembly(ex.id, word); bank.appendChild(chip); }); } bauwerkstattState.assembled[ex.id - 1] = []; }); updateProgress(); } function addToAssembly(exId, word) { const areaId = `assembly-area-${exId}`; const area = document.getElementById(areaId); const bankId = `word-bank-${exId}`; const bank = document.getElementById(bankId); if (!bauwerkstattState.assembled[exId - 1]) bauwerkstattState.assembled[exId - 1] = []; const chip = document.createElement('div'); chip.className = 'word-chip placed'; chip.textContent = word; chip.onclick = () => removeFromAssembly(exId, word, chip); area.appendChild(chip); bauwerkstattState.assembled[exId - 1].push(word); const bankChips = bank.querySelectorAll('.word-chip'); bankChips.forEach(c => { if (c.textContent === word) c.classList.add('unavailable'); }); } function removeFromAssembly(exId, word, chipEl) { const bankId = `word-bank-${exId}`; const bank = document.getElementById(bankId); chipEl.remove(); const idx = bauwerkstattState.assembled[exId - 1].indexOf(word); if (idx > -1) bauwerkstattState.assembled[exId - 1].splice(idx, 1); const bankChips = bank.querySelectorAll('.word-chip'); bankChips.forEach(c => { if (c.textContent === word) c.classList.remove('unavailable'); }); } function undoWordAssembly(exId) { const areaId = `assembly-area-${exId}`; const area = document.getElementById(areaId); const bankId = `word-bank-${exId}`; const bank = document.getElementById(bankId); area.innerHTML = ''; bauwerkstattState.assembled[exId - 1] = []; const bankChips = bank.querySelectorAll('.word-chip'); bankChips.forEach(c => c.classList.remove('unavailable')); } function checkWordAssembly(exId) { const ex = bauwerkstattData.level1[exId - 1]; const assembled = bauwerkstattState.assembled[exId - 1].join(' ').toLowerCase(); const correct = ex.correct.join(' ').toLowerCase(); const feedbackId = `feedback-${exId}`; const fb = document.getElementById(feedbackId); if (assembled === correct) { fb.className = 'exercise-feedback show correct'; fb.innerHTML = `
✓ Correct!
${ex.explanation}
`; if (!bauwerkstattState.level1.completed[exId - 1]) { bauwerkstattState.level1.completed[exId - 1] = true; bauwerkstattState.level1.score++; updateProgress(); } } else { fb.className = 'exercise-feedback show incorrect'; fb.innerHTML = `
Not quite yet.
Try again. The correct phrase is: ${ex.answer}
`; } } function handleGapKeypress(event, exId) { if (event.key === 'Enter') checkGapSentence(exId); } function handleFreeKeypress(event, exId) { if (event.key === 'Enter') checkFreeBuilding(exId); } function levenshteinDistance(a, b) { const m = a.length, n = b.length; const dp = Array(m + 1).fill(0).map(() => Array(n + 1).fill(0)); for (let i = 0; i <= m; i++) dp[i][0] = i; for (let j = 0; j <= n; j++) dp[0][j] = j; for (let i = 1; i <= m; i++) { for (let j = 1; j <= n; j++) { if (a[i - 1] === b[j - 1]) dp[i][j] = dp[i - 1][j - 1]; else dp[i][j] = 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]); } } return dp[m][n]; } function checkGapSentence(exId) { const ex = bauwerkstattData.level2[exId - 1]; const input = document.getElementById(`gap-input-${exId}`); const answer = input.value.trim().toLowerCase(); const feedbackId = `gap-feedback-${exId}`; const fb = document.getElementById(feedbackId); const accepted = ex.accepted_answers; const isCorrect = accepted.some(a => a.toLowerCase() === answer); if (isCorrect) { fb.className = 'exercise-feedback show correct'; fb.innerHTML = `
✓ Correct!
${answer.toUpperCase()}. ${ex.explanation}
`; if (!bauwerkstattState.level2.completed[exId - 1]) { bauwerkstattState.level2.completed[exId - 1] = true; bauwerkstattState.level2.score++; updateProgress(); } } else { let closest = null; let minDist = Infinity; for (const a of accepted) { const dist = levenshteinDistance(answer, a); if (dist < minDist) { minDist = dist; closest = a; } } if (minDist <= 1) { let specificFeedback = null; for (const err of ex.close_errors) { if (err.wrong.toLowerCase() === answer) { specificFeedback = err.feedback; break; } } fb.className = 'exercise-feedback show close'; fb.innerHTML = `
Almost!
${specificFeedback || ex.explanation}
`; } else { fb.className = 'exercise-feedback show incorrect'; fb.innerHTML = `
Not quite.
The answer is ${closest}. ${ex.explanation}
`; } } } function checkFreeBuilding(exId) { const ex = bauwerkstattData.level3[exId - 1]; const input = document.getElementById(`free-input-${exId}`); const answer = input.value.trim(); const feedbackId = `free-feedback-${exId}`; const fb = document.getElementById(feedbackId); const accepted = ex.accepted_answers; const isCorrect = accepted.some(a => a.toLowerCase() === answer.toLowerCase()); if (isCorrect) { fb.className = 'exercise-feedback show correct'; fb.innerHTML = `
✓ Correct!
${ex.explanation}
`; if (!bauwerkstattState.level3.completed[exId - 1]) { bauwerkstattState.level3.completed[exId - 1] = true; bauwerkstattState.level3.score++; updateProgress(); } } else { let closest = null; let minDist = Infinity; for (const a of accepted) { const dist = levenshteinDistance(answer.toLowerCase(), a.toLowerCase()); if (dist < minDist) { minDist = dist; closest = a; } } if (minDist <= 3) { let specificFeedback = null; for (const err of ex.close_errors) { if (err.wrong.toLowerCase() === answer.toLowerCase()) { specificFeedback = err.feedback; break; } } fb.className = 'exercise-feedback show close'; fb.innerHTML = `
Almost!
${specificFeedback || ex.explanation}
`; } else { fb.className = 'exercise-feedback show incorrect'; fb.innerHTML = `
Not quite.
The answer is ${closest}. ${ex.explanation}
`; } } } function updateProgress() { const total = 12; const score = bauwerkstattState.level1.score + bauwerkstattState.level2.score + bauwerkstattState.level3.score; const scoreEl = document.getElementById('bauwerkstatt-score'); if (scoreEl) scoreEl.textContent = score; const bar = document.getElementById('bauwerkstatt-progress-bar'); if (bar) { bar.innerHTML = ''; const allCompleted = [...bauwerkstattState.level1.completed, ...bauwerkstattState.level2.completed, ...bauwerkstattState.level3.completed]; allCompleted.forEach(completed => { const dot = document.createElement('div'); dot.className = 'progress-dot' + (completed ? ' completed' : ''); bar.appendChild(dot); }); } } document.addEventListener('DOMContentLoaded', () => { initBauwerkstatt(); }); // ===== LESEN & HÖREN FUNCTIONS ===== let isListening = false; let isSpeaking = false; let currentSpeed = 0.95; let currentDictationIndex = 0; const dictationSentences = ['Der alte Mann sitzt im schönen Garten.', 'Die junge Frau arbeitet in der Stadt.', 'Das neue Haus hat große Fenster.']; function startListening() { if (isSpeaking) return; isListening = true; document.getElementById('listen-btn').style.display = 'none'; document.getElementById('stop-btn').style.display = 'inline-block'; const sentences = document.querySelectorAll('.passage-sentence'); const utterances = []; sentences.forEach((sentenceEl, idx) => { const text = sentenceEl.textContent.trim(); const utterance = new SpeechSynthesisUtterance(text); utterance.lang = 'de-DE'; utterance.rate = currentSpeed; utterance.onstart = () => { sentenceEl.classList.add('reading'); }; utterance.onend = () => { sentenceEl.classList.remove('reading'); if (idx < sentences.length - 1) { setTimeout(() => { if (isListening && idx + 1 < utterances.length) { speechSynthesis.speak(utterances[idx + 1]); } }, 300); } }; utterances.push(utterance); }); isSpeaking = true; if (utterances.length > 0) { speechSynthesis.speak(utterances[0]); } } function stopListening() { isListening = false; isSpeaking = false; speechSynthesis.cancel(); document.getElementById('listen-btn').style.display = 'inline-block'; document.getElementById('stop-btn').style.display = 'none'; document.querySelectorAll('.passage-sentence').forEach(s => s.classList.remove('reading')); } function setSpeed(rate) { currentSpeed = rate; document.querySelectorAll('.speed-btn').forEach(btn => btn.classList.remove('active')); if (rate === 0.7) { document.getElementById('speed-slow').classList.add('active'); } else { document.getElementById('speed-normal').classList.add('active'); } if (isListening) { stopListening(); setTimeout(() => startListening(), 300); } } function checkComprehension(qNum, element, isCorrect) { const options = element.parentElement.querySelectorAll('.comp-option'); options.forEach(opt => { opt.style.pointerEvents = 'none'; opt.style.opacity = '0.7'; }); const feedback = document.getElementById(`comp-feedback-${qNum}`); if (isCorrect) { element.classList.add('correct'); feedback.textContent = '✓ Correct!'; feedback.classList.add('show', 'correct'); } else { element.classList.add('incorrect'); feedback.textContent = '✗ Incorrect.'; feedback.classList.add('show', 'incorrect'); } } function checkFillBlank() { const input = document.getElementById('fill-blank-input'); const answer = 'große'; const userAnswer = input.value.trim().toLowerCase(); const feedback = document.getElementById('comp-feedback-3'); const distance = levenshteinDistance(userAnswer, answer); if (distance === 0) { feedback.textContent = '✓ Perfect!'; feedback.classList.add('show', 'correct'); input.style.borderColor = 'rgba(74, 180, 100, 0.5)'; } else if (distance <= 1) { feedback.textContent = `✓ Very close! The answer is: ${answer}`; feedback.classList.add('show', 'correct'); input.style.borderColor = 'rgba(74, 180, 100, 0.5)'; } else { feedback.textContent = `The correct answer is: ${answer}`; feedback.classList.add('show', 'incorrect'); input.style.borderColor = 'rgba(232, 164, 74, 0.5)'; } input.disabled = true; } function playDictation() { if (currentDictationIndex >= dictationSentences.length) return; const sentence = dictationSentences[currentDictationIndex]; const utterance = new SpeechSynthesisUtterance(sentence); utterance.lang = 'de-DE'; utterance.rate = 0.8; document.getElementById('dictation-play-btn').disabled = true; utterance.onend = () => { document.getElementById('dictation-play-btn').disabled = false; }; speechSynthesis.speak(utterance); } function checkDictation() { const input = document.getElementById('dictation-input'); const userAnswer = input.value.trim(); const expectedAnswer = dictationSentences[currentDictationIndex]; const feedback = document.getElementById('dictation-feedback'); const result = document.getElementById('dictation-result'); if (!userAnswer) { feedback.textContent = 'Please type something first.'; feedback.classList.add('show', 'incorrect'); return; } const distance = levenshteinDistance(userAnswer.toLowerCase(), expectedAnswer.toLowerCase()); feedback.classList.remove('correct', 'incorrect'); result.classList.remove('show'); if (distance === 0) { feedback.textContent = '✓ Perfect! You got it exactly right.'; feedback.classList.add('show', 'correct'); } else if (distance <= 4) { feedback.textContent = `✓ Very close! Only a few words different.`; feedback.classList.add('show', 'correct'); result.classList.add('show'); result.innerHTML = `What you wrote: ${userAnswer}
Expected: ${expectedAnswer}`; } else { feedback.textContent = '✗ Not quite. Try again or listen once more.'; feedback.classList.add('show', 'incorrect'); result.classList.add('show'); result.innerHTML = `Expected: ${expectedAnswer}`; } if (currentDictationIndex < dictationSentences.length - 1) { setTimeout(() => { currentDictationIndex++; document.getElementById('dictation-counter').textContent = `Sentence ${currentDictationIndex + 1} of ${dictationSentences.length}`; input.value = ''; feedback.classList.remove('show'); result.classList.remove('show'); }, 2000); } else { document.getElementById('dictation-play-btn').textContent = '✓ Dictation Complete!'; document.getElementById('dictation-play-btn').disabled = true; } }