S
Speakly.PRO

Templates & DSL

Use the lesson builder DSL to create structured lessons from templates.

The Lex Platform includes a powerful lesson builder that uses a Domain-Specific Language (DSL) to define structured lessons from reusable templates. Instead of building every lesson from scratch in the editor, you can use templates and DSL syntax to quickly scaffold complete lessons with consistent structure and quality.

What Are Lesson Templates?

Lesson templates are pre-built frameworks that define the structure, flow, and exercise types of a lesson. Think of them as blueprints: you select a template, customize the content, and the system generates a fully structured lesson ready for the Lex Editor.

Why Use Templates?

  • Speed: Build lessons in minutes instead of hours
  • Consistency: Every lesson follows a proven pedagogical structure
  • Quality: Templates are designed by experienced educators
  • Flexibility: Customize any section after generation
  • Scalability: Build an entire course from a consistent set of templates

Templates do not replace your creativity -- they give you a head start. You can always modify, extend, or completely rework any generated lesson.

Available Template Types

Grammar Lesson Template

A structured lesson focused on teaching a specific grammar point.

Sections:

  1. Introduction -- Real-world context showing why this grammar matters
  2. Rule Presentation -- Clear explanation with visual aids
  3. Example Sentences -- 5-10 graded examples
  4. Common Mistakes -- Typical errors and how to avoid them
  5. Guided Practice -- Fill-in-blank and multiple choice exercises
  6. Free Practice -- Writing or speaking prompts applying the grammar
  7. Summary -- Quick-reference card of the rule

Vocabulary Lesson Template

Build a thematic vocabulary lesson with images, audio, and practice activities.

Sections:

  1. Theme Introduction -- Context for the vocabulary set
  2. Word Presentation -- New words with definitions, images, and pronunciation
  3. Contextual Sentences -- Each word used in a sentence
  4. Matching Activity -- Pair words with definitions
  5. Fill-in-Blank Practice -- Use new words in sentences
  6. Production Task -- Write or speak using the new vocabulary
  7. Review Game -- Interactive flashcard-style review

Conversation Practice Template

A lesson designed around dialogue and spoken interaction.

Sections:

  1. Situation Setup -- Describe the real-world scenario
  2. Model Dialogue -- Sample conversation with audio
  3. Key Phrases -- Essential expressions for the situation
  4. Comprehension Check -- Questions about the model dialogue
  5. Guided Role-Play -- Structured practice with prompts
  6. Free Role-Play -- Open conversation activity
  7. Reflection -- Self-assessment and vocabulary log

Assessment Template

A template for quizzes and tests with multiple exercise types.

Sections:

  1. Instructions -- Clear directions and time limits
  2. Section A: Multiple Choice -- Grammar and vocabulary recognition
  3. Section B: Fill-in-Blank -- Application of rules
  4. Section C: Matching -- Vocabulary or concept pairing
  5. Section D: Writing -- Short essay or paragraph
  6. Answer Key -- Hidden answers for teacher reference

Understanding the DSL

The lesson DSL lets you define lesson structure in a compact, readable format. Each lesson is described as a series of sections, and each section contains widgets -- the building blocks of your content.

Section Structure

A lesson is divided into sections, each with a type and a list of widgets:

Section: Introduction
  - widget: text
    content: "Welcome to this lesson on the present tense..."
  - widget: image
    src: greeting.jpg
    alt: "Students greeting each other"

Section: Practice
  - widget: exercise
    type: fill-in-blank
    items:
      - "She _____ (go) to school every day." -> "goes"
      - "They _____ (have) two cats." -> "have"

Widget Types

The DSL supports a rich set of widget types that map to Lex Editor content blocks:

WidgetDescriptionUse Case
textRich text paragraphExplanations, instructions
headingSection heading (H1-H3)Organizing content
imageImage with alt textVisual aids, diagrams
audioAudio playerPronunciation, listening
videoEmbedded videoYouTube, Vimeo clips
exerciseInteractive exercisePractice and assessment
tableData tableConjugation charts, comparisons
calloutHighlighted boxTips, warnings, cultural notes
collapsibleExpandable sectionAnswer keys, extra info
sentence-builderDrag-and-drop sentence constructionWord order practice

Exercise Widgets in Detail

The exercise widget supports several types:

Multiple Choice:

- widget: exercise
  type: multiple-choice
  question: "Which is the correct past tense of 'go'?"
  options:
    - "goed"
    - "went"  [correct]
    - "gone"
    - "going"
  feedback: "'Went' is the irregular past tense of 'go'."

Fill-in-Blank:

- widget: exercise
  type: fill-in-blank
  sentence: "Yesterday, I _____ to the park."
  answer: "went"
  alternatives: ["walked"]
  hint: "Irregular past tense of 'go'"

Matching:

- widget: exercise
  type: matching
  pairs:
    - ["hello", "hola"]
    - ["goodbye", "adios"]
    - ["please", "por favor"]
  distractors: true

Sentence Builder:

- widget: exercise
  type: sentence-builder
  target: "The cat is sitting on the mat"
  words: ["mat", "The", "on", "sitting", "is", "the", "cat"]
  distractors: ["dog", "under"]

The distractors toggle adds extra wrong options to matching and sentence-builder exercises, increasing difficulty. This is recommended for B1+ students.

Using Templates in Practice

Creating a Lesson from a Template

Choose a Template

Navigate to Courses -> your course -> "Add Lesson". Select "From Template" instead of blank lesson. Browse the template gallery and pick the one that matches your lesson goal.

Configure Template Parameters

Fill in the template-specific fields:

  • Topic: e.g., "Spanish present tense -AR verbs"
  • Target Language: e.g., Spanish
  • CEFR Level: e.g., A1
  • Number of Exercises: e.g., 8
  • Include Audio: Yes/No

Preview the Structure

The system shows you the generated lesson outline with all sections and placeholder widgets. Review the structure before proceeding.

Generate the Lesson

Click "Generate". The system creates the full lesson in the Lex Editor with all sections, exercises, and formatting in place.

Customize and Refine

Open the generated lesson in the editor. Replace placeholder text with your content, adjust exercise difficulty, add your own images and audio, personalize the tone and examples.

Saving Custom Templates

If you have built a lesson structure you want to reuse:

  1. Open the lesson in the editor
  2. Click "Save as Template" from the toolbar
  3. Give your template a name and description
  4. Choose visibility: Personal (only you) or Organization (all teachers in your school)
  5. Save

Your custom template now appears in the template gallery alongside the built-in options.

Browsing Public Templates

Course templates shared by other teachers or organizations can be viewed in read-only mode. When you open a public lesson template you do not own, the full DSL editor opens with all editing controls hidden and form fields disabled. This lets you review the complete template structure and content before deciding whether to purchase or adapt it.

Demo Content Badge

In the course templates list, templates that include pre-generated demo lessons show a "Demo" badge. Hover over the badge to see the number of demo lessons available. Click the badge to navigate to the template detail page with the demo filter enabled, so you can preview the sample content.

Template Best Practices

Start with Built-in Templates:

For your first few lessons, use the built-in templates to learn the structure. Once you are comfortable, create your own.

Customize, Do Not Over-Customize:

Templates work best when you keep the overall structure and focus on swapping content. Rearranging entire sections defeats the purpose of consistency.

Match Template to Lesson Type:

  • Class Lessons -> Grammar or Vocabulary template
  • Exercise Sets -> Assessment template (without the essay section)
  • Homework -> Assessment template or Vocabulary review template

Use AI with Templates:

Combine templates with AI Lesson Generation for maximum efficiency. Select a template for structure, then let AI fill in the content.

Troubleshooting

Template Not Generating

Check:

  • All required fields filled in
  • Valid CEFR level selected
  • Sufficient tokens (if AI-powered generation is used)
  • Stable internet connection

Generated Content Looks Wrong

Solutions:

  • Re-check the template parameters (wrong level or language can produce poor results)
  • Try a different template type
  • Edit manually in the Lex Editor after generation
  • Regenerate specific sections rather than the whole lesson

Can't Find My Saved Template

Check:

  • Visibility setting (Personal vs. Organization)
  • Template gallery filter (make sure "My Templates" is selected)
  • Template may have been archived -- check the archive section

Next Steps


Q&A

Do I need to know the DSL syntax to use templates?

No. The template gallery provides a visual interface for selecting and configuring templates. The DSL syntax is used internally and is only relevant if you want to build advanced custom templates.

Can I share my custom templates with teachers at other schools?

Currently, custom templates can be shared within your organization. Sharing across organizations is on the roadmap.

How do templates differ from AI generation?

Templates define the structure of a lesson (which sections, what exercise types, in what order). AI generation fills in the content (the actual text, questions, and examples). You can use them independently or together.

Can I edit the DSL directly?

Advanced users can access the DSL definition of a template for fine-tuned control. This is available under Template Settings -> "Edit DSL" for custom templates you own.

Are there templates for specific languages?

The built-in templates are language-agnostic -- they define structure, not content. When you configure a template, you specify the target language, and the content is generated accordingly.