Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Building an Intelligent English Learning Assistant Based on New Concept English

Tech May 19 2

Hence, we will use New Concept English as the foundation to build a personalized study companion that helps reinforce basic English skills—especially beneficial for elementary and middle school students aiming for strong performance in their high school entrance exams.

Clear Objective

The primary goal of our assistant is to support learners, particularly those with weaker foundations or seeking rapid progress in fundamental English skills. We focus specifically on New Concept English Book One, which lays the groundwork for mastering English grammar, vocabulary, sentence structures, and pronunciation.

The course design emphasizes odd-numbered lessons (e.g., Lesson 1), while even-numbered lessons (e.g., Lesson 2) serve as supplements. Therefore, our approach centers around odd-numbered lessons to maintain coherence and systematic progression, ensuring solid foundational knowledge.

System Setup

When querying directly, the model may not provide accurate responses without prior training on specific datasets. To adress this, we need to integrate a knowledge base or database with the model to deliver precise and comprehensive answers.

Role Definition

To prevent information overload, I’ll share the final version directly instead of detailing intermediate debugging steps:

# Role: 
You are a teacher specializing in New Concept English Book One, well-versed in its contents. You will test users’ English proficiency through questions and offer detailed feedback.

## Background: 
New Concept English Book One serves as an introductory course for English learners, especially suitable for those with weak foundational skills looking to quickly build a solid base.

## Goals:
1. Use [data_sheet_agent] to retrieve lesson-specific English topics.
2. Pose four questions to assess core language comprehension.
3. Generate a personalized review sheet and study recommendations upon completion.

## Constraints:
1. Only ask odd-numbered lessons (e.g., Lesson 1). Never refer to even-numbered ones.
2. At least four practice questions must be asked.
3. Do not ask about vocabulary or phrases beyond the current lesson.
4. Questions must be posed one at a time.
5. All questions must combine Chinese and English; avoid translation tasks.

## Skills:
1. Proficient in English grammar and vocabulary.
2. Capable of designing at least four language exercises.
3. Strong logical reasoning ability.
4. Understands learner psychology and needs.
5. Applies diverse teaching strategies to enhance learning outcomes.

## Workflow:
0. Update the course memory variable using [memory_variable_writer] based on user input.
1. Call [data_sheet_agent] with query pattern "New Concept English - Book One - Lesson XXX", where XXX is a three-digit number like 001 or 005.
2. Introduce the learning objective and key points of the lesson. Example: "Lesson 1 of New Concept English Book One is titled ‘Excuse me!’ The goal is to learn basic daily expressions, focusing on phrases like ‘excuse me’, ‘yes’, and ‘is this’."
3. Ask questions strictly aligned with the lesson's sentences, phrases, and words.
4. Present only one question per round and track the question number.
5. Users must respond with English sentences to proceed.
6. After four questions, invoke the GaiJinYiJianHeXueXiJianYi tool to generate a certificate.

Variable Management

We introduce variables to store context during a session, ensuring that generated certificates accurately reflect the selected lesson. This prevents incorrect certificate generation due to improper initialization.

Default Value

A default value is set for the variable to ensure proper validation in workflows, preventing misuse by users who might bypass testing.

Session-Based Logic

This mechanism applies per session because each conversation may involve different lessons. It avoids generating mismatched certificates.

Database Integration

Web Plugin Considerations

We avoided using web plugins or nodes due to potential instability and ethical concerns regarding data scraping.

Data Cleaning

Raw webpage data often contains noise. Using a third-party tool like Kimi allowed efficient extraction with minimal effort—around two hours for initial processing. For scalability, direct code integration can be considered.

Database vs Knowledge Base

We opted for a database over a knowledge base because of better precision in targeted queries. Knowledge bases can suffer from low recall rates and increased token consumption.

Importing CSV files into the local database requires careful formatting verification before loading to avoid empty results.

Workflow Components

  • Certificate Generation: Encourages learners by acknowledging achievements, promoting continued effort.
  • Performance Summary: Offers tailored feedback based on quiz results to guide improvement.
  • Video Recommendations: Provides supplementary video links related to the current lesson for enhanced engagement.
  • Request Limitation: Ensures users complete the quiz before requesting a certificate to encourage active participation.

Certificate Creation Process

We utilize a third-party API integrating edge computing and CDN services to dynamically generate certificates. The implementation involves signing requests via MD5 hashing:

import json
import hashlib 
from datetime import datetime
import re

def encode_chinese_in_url(url):
    encoded_url = ""
    for char in url:
        if char == ' ':
            encoded_url += '%20'
        elif '\u4e00' <= char <= '\u9fff':
            encoded_char = char.encode('utf-8')
            encoded_url += ''.join(['%' + format(b, '02X') for b in encoded_char])
        else:
            encoded_url += char
    return encoded_url

def get_final_url(template_id, params):
    url_prefix = ''
    format = 'png'
    user_id = ''
    api_key = ''
    sorted_keys = sorted(params.keys())
    search_params = '&'.join(f'{key}={params[key]}' for key in sorted_keys)
    sign_data = json.dumps({
        'apiKey': api_key,
        'searchParams': search_params,
    }, ensure_ascii=False, separators=(",", ":"))
    sign = generate_md5(sign_data)
    final_url = f"{url_prefix}/{sign}/{user_id}/{template_id}.{format}?{search_params}"
    encoded_path = encode_chinese_in_url(final_url)
    return encoded_path

def generate_md5(sign_data):
    md5_hash = hashlib.md5()
    md5_hash.update(sign_data.encode(encoding='UTF-8'))
    return md5_hash.hexdigest()

def main(params):
    curse = params['curse']
    current_date = datetime.now()
    formatted_date = current_date.strftime('%Y-%m-%d')
    template_id = 'ep-vna6OlJNvSwu'
    params = {
        "name": f"{curse}",
        "title": "Congratulations on completing your English studies! Keep up the great work!",
        "date": f"{formatted_date}",
        "award": "New Concept English Learning Assistant"
    }
    final_url = get_final_url(template_id, params)
    output_object = {
        "link": final_url,
    }
    return output_object

Overall Result

The system efficiently delivers accurate responses and generates personalized feedback and certificates. While occasional missteps occur in tracking question rounds, overall functionality remains intact.

Summary

In this tutorial, we explored creating an intelligent English learning assistant using New Concept English Book One. Our approach targets elementary and middle school students, focusing on building solid English fundamentals for academic success.

By emphasizing odd-numbered lessons, we ensure structured learning that builds confidence and clarity. Through interactive questioning and real-time feedback, learners gain deeper understanding and practical application of language skills.

Integrating databases enhances accuracy, while dynamic certificate generation and video suggestions boost motivation and engagement. The iterative process ensures continuous improvement, aligning with learner needs and expectations.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.