W3docs
AI tools·7 min read

What's Inside an AI Language Tutor? A Developer's Tour

A scheduler, a speech pipeline, a text-mining job, an error classifier and a prompt. Here is how modern AI language apps fit those pieces together, with code you can run.

A paper-craft notebook on a blue desk with speech bubbles, a sound wave and flashcards in several alphabets.

Language apps used to be digital flashcard decks with a points system bolted on. The current generation listens to you speak, reads the videos you watch, remembers every mistake you make, and talks back. From the outside it looks like magic. From the inside it is a stack of components most developers have built at some point: a scheduler, a speech pipeline, a text-processing job, a classifier, and a carefully assembled prompt.

This tour opens each box, explains what it does for a learner, and shows a small piece of code where one helps. If you are learning a language yourself, it will also tell you which features are worth your time.

Why language apps got smarter

Three things changed in the last few years. Speech recognition became accurate enough to judge individual words, not just transcribe sentences. Large language models made open-ended conversation cheap. And the research-backed basics, like spaced repetition and comprehensible input, finally became easy to combine in one product instead of five.

The result is a shift from "a course everyone follows" to "a plan built around one person." Each feature below feeds that plan.

Spaced repetition: a scheduler for your memory

You forget a new word on a predictable curve. Review it just before you would lose it and the next gap can be longer. That is spaced repetition, and it is the oldest algorithm in the stack.

The classic algorithm is SM-2, published by Piotr Woźniak for SuperMemo in the late 1980s, and many flashcard apps still use a variant of it. Each card stores how many times you have recalled it, the current interval in days, and an "ease" factor. After each review you grade yourself from 0 to 5. Here is a compact SM-2-style version:

function nextReview(card, grade) {
  // grade: 0 (blackout) … 5 (perfect recall)
  let { repetitions, interval, ease } = card;

  if (grade < 3) {
    repetitions = 0;
    interval = 1;
  } else {
    interval = repetitions === 0 ? 1 : repetitions === 1 ? 6 : Math.round(interval * ease);
    repetitions += 1;
  }

  ease = Math.max(1.3, ease + 0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
  return { repetitions, interval, ease };
}

let card = { repetitions: 0, interval: 0, ease: 2.5 };
for (const grade of [4, 4, 5, 2, 4]) {
  card = nextReview(card, grade);
  console.log(`grade ${grade} → see it again in ${card.interval} day(s)`);
}
grade 4 → see it again in 1 day(s)
grade 4 → see it again in 6 day(s)
grade 5 → see it again in 15 day(s)
grade 2 → see it again in 1 day(s)
grade 4 → see it again in 1 day(s)

In this version, one failed review resets the card and lowers its ease factor, so its future intervals grow more slowly. Newer schedulers such as FSRS, which Anki has offered as an option since 2023, replace the fixed formula with a model fitted to your own review history. The goal is the same either way: fewer reviews, less forgetting.

Pronunciation scoring: grading words, not sentences

A speech-to-text engine answers "what did you say?" A pronunciation scorer answers a harder question: "how close was each word to what you meant to say?"

Because the app already knows the target sentence, it can force-align your audio against it. A speech model estimates where each word and sound starts and ends, then compares how confident it is that you produced the expected sound with how confident it is that you produced something else. Low-confidence words get flagged. That is why good apps can tell you the second word was off rather than giving the whole sentence a vague 72%.

For learners, word-level feedback is the feature to look for. A single overall score tells you something was wrong, but only per-word feedback tells you what to practise.

Turning YouTube into vocabulary

Language research has long suggested that learners need to know around 98% of the words in a text to read it comfortably. Native content is full of words you don't know yet, so the trick is to find the few worth learning in each video.

A video's captions (or a speech-to-text pass when there are none) become a transcript. From there it is a familiar text-processing job: tokenize, drop words the learner already knows, count, and rank. A stripped-down version:

function topWords(transcript, known, n = 5) {
  const counts = new Map();
  for (const word of transcript.toLowerCase().match(/\p{L}+/gu) ?? []) {
    if (word.length < 4 || known.has(word)) continue;
    counts.set(word, (counts.get(word) ?? 0) + 1);
  }
  return [...counts].sort((a, b) => b[1] - a[1]).slice(0, n);
}

const transcript = `Hoy vamos a cocinar una tortilla. Primero, pelamos las patatas.
Después cortamos las patatas y la cebolla. La tortilla necesita paciencia.`;
const known = new Set(['hoy', 'vamos', 'primero', 'después', 'una', 'las']);

console.log(topWords(transcript, known));
[
  [ 'tortilla', 2 ],
  [ 'patatas', 2 ],
  [ 'cocinar', 1 ],
  [ 'pelamos', 1 ],
  [ 'cortamos', 1 ]
]

The \p{L} Unicode property escape matters here: a plain \w would split "después" in half. Production systems go further. They lemmatize so that pelamos and pelar count as one word, use a word-frequency list to skip rare words, and keep the sentence each word came from as a ready-made example. The selected words then go straight into the spaced-repetition queue from the previous section.

Making mistakes useful

Most apps throw a wrong answer away once you have retried it. The better approach is to treat mistakes as data. Each error is tagged with a category, like gender agreement, past-tense form or word order, either by rules or by a model that compares your answer with the expected one. Group the tags and patterns appear: you don't have forty random mistakes, you have the same three, repeated.

From an engineering point of view it is a classification and aggregation problem. From a learner's point of view it is the difference between redoing exercise 14 and getting five new exercises aimed at the exact rule you keep missing.

LLM tutors that know your plan

A general chatbot can explain the subjunctive. What it doesn't know is that you are at A2, that you got ser and estar wrong three times this week, and that tortilla is due for review tomorrow. The quality of an AI tutor depends far less on the model than on that context.

Building one is a context-engineering job. Before each reply the app gathers the learner's level, their due words, their recent mistake patterns and the lesson they are on. It puts that into the prompt and asks the model to steer the conversation toward it. Grounding the model in known grammar content also keeps it from inventing rules, which large language models will happily do when asked about grammar.

Bigger products have moved in this direction. Duolingo, for example, added GPT-4-powered roleplay and answer explanations in its Max tier back in 2023. Newer platforms take it further by building the whole product around one learner profile. Flumi is a good example of every component in this article working together. A short placement quiz sets your CEFR level. Grammar lessons end in self-marking exercises. Words you pull out of a YouTube video or a pasted text join a spaced-repetition queue. Speaking practice gives word-by-word pronunciation feedback. Your mistakes are grouped into recurring patterns, and an AI tutor uses your plan, your mistakes and your words to suggest the next step. All of it feeds one short daily plan that adjusts as you go, which is exactly what a developer would design if the brief were "stop making the learner decide what to study next."

What still needs a human

None of this replaces talking to people. An AI tutor is a patient practice partner, but it won't give you the pressure of a real conversation, the slang of a particular city, or the motivation of a friend who expects a reply. Models can still be confidently wrong about edge cases in grammar, so treat explanations as a strong first draft rather than the final word.

The most useful way to see an AI tutor is the same way you see a good developer tool: it automates the repetitive parts, like scheduling reviews, finding words and spotting patterns, so you can spend more of your time on the part only you can do. For language learning, that part is using the language with other people.

Was this page helpful?

Keep reading

More from W3docs.