Interactive English vocabulary learning with visual feedback from error images
Left: Initial (Question) • Right: Result (Incorrect with error image)
This system couples multimedia learning, cognitive load minimization, and error-based learning.
When a learner answers a fill-in-the-blank item, the app compares the chosen option with the target and—if it’s wrong—generates an error image for the selected word. Placing the original image and the error image side-by-side creates a clear visual conflict that makes the misconception obvious and easier to revise without relying on L1 labels.
Flow (A–F in the figure):
- Initial perception (A) – The item, image, and three options are shown contiguously to reduce split-attention.
- Option selection (B) – The learner forms a hypothesis; near-neighbor distractors (e.g., hanging vs. hugging) capture typical errors.
- Misconception (C, t1→t2) – The wrong form is tentatively encoded with the visual context.
- Error visualization (D, t2→t3) – An image for the wrong word induces cognitive conflict.
- Error recognition (E) – The visual contrast reveals the semantic mismatch (e.g., hanging ≠ the original hugging scene).
- Conceptual reconstruction (F, t3→t4) – The mapping is re-encoded toward the correct concept with less L1 dependence.
- 📚 Fill‑in‑the‑blank items with COCO images
- 🎯 Adaptive distractors (Levenshtein distance, CEFR level)
- 🖼️ Error‑image generation using OpenAI Images (DALL·E 3)
- 📊 Learning analytics: personal history & progress
- 🔄 Review mode for items you previously missed
- 💾 SQLite persistence for items, answers, images
Language note: UI & docs are in English. Some inline source comments remain in Japanese.
- OS: Windows 10/11 + WSL2 (Ubuntu 22.04/24.04), or native Linux/macOS
- Python: 3.8.x required
The current dependency pins (e.g.,
numpy==1.24.4,pandas==2.0.3, spaCy 3.5.x) target Python 3.8. Running on 3.12 will fail. - RAM: 2 GB+ recommended
- Disk: 1 GB+ (more if you store many images)
- Editor: VS Code (Remote — WSL recommended on Windows)
| Purpose | WSL path | Windows path |
|---|---|---|
| Project root | /mnt/c/L-VEIGe_Original |
C:\L-VEIGe_Original |
| Static images | /mnt/c/L-VEIGe_Original/static/images3 |
C:\L-VEIGe_Original\static\images3 |
.env |
/mnt/c/L-VEIGe_Original/.env |
C:\L-VEIGe_Original\.env |
| Virtual env (example) | /home/<user>/.venvs/lveige38 |
\\wsl$\Ubuntu\home\<user>\.venvs\lveige38 |
Tip: Keep the virtualenv on the Linux home side (e.g.,
~/.venvs/...). Creating it under/mnt/ccan cause permission/execute‑bit issues and slower builds.
Run these in a WSL (Ubuntu) terminal.
A. apt (if sudo is available)
sudo apt update
sudo apt install -y python3.8 python3.8-venv python3.8-distutils python3.8-dev build-essential
python3.8 -V # 3.8.xB. Conda (no sudo / locked‑down machines)
cd ~
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
conda create -n lveige38 python=3.8 -y
conda activate lveige38mkdir -p ~/.venvs
python3.8 -m venv ~/.venvs/lveige38 || true
# If your distro’s ensurepip is broken, fall back to manual pip:
python3.8 -m venv --without-pip ~/.venvs/lveige38
source ~/.venvs/lveige38/bin/activate
wget -O get-pip.py https://bootstrap.pypa.io/pip/3.8/get-pip.py
python get-pip.py && rm get-pip.pycd /mnt/c/L-VEIGe_Original
python -V
python -m pip -V
# Remove a spurious freeze artifact if present
sed -i '/^pkg_resources==0\.0\.0$/d' requirements-lock-py38.txt 2>/dev/null || true
python -m pip install --upgrade pip
python -m pip install -r requirements-lock-py38.txt || python -m pip install -r requirements.txtecho "FLASK_SECRET_KEY=$(python -c 'import secrets; print(secrets.token_hex(32))')" > .env
echo "OPENAI_API_KEY=your_openai_api_key_here" >> .envOpen .env in VS Code and Save with Encoding → UTF‑8.
If saved as UTF‑16 by Windows Notepad, you’ll get
UnicodeDecodeError: byte 0xff…on startup.
Filenames are expected like 000000xxxxxxxx.jpg (12 digits, zero‑padded), under:
static/images3
Examples:
mkdir -p static/images3
cp /path/to/your/images/000000*.jpg static/images3/
ls static/images3 | headIf your dataset is large and lives under Linux home, a symlink is handy:
ln -s ~/datasets/coco2017/train2017 static/images3python -m flask --app app run --host 0.0.0.0 --port 5000
# or
# python app.pyOpen: http://127.0.0.1:5000
git clone <repository-url>
cd L-VEIGe_Original # or your repo name
python3.8 -m venv .venv38
source .venv38/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m spacy download en_core_web_sm # if not bundled in requirements-lockThen follow steps 4–6 above for .env, images, and running.
L-VEIGe_Original/
├── app.py
├── requirements.txt / requirements-lock-py38.txt
├── .env # not committed
├── database/
│ └── db_manager.py
├── modules/
│ ├── enhanced_question_gen.py
│ ├── enhanced_candidate_gen.py
│ ├── enhanced_image_gen.py
│ └── result_processor.py
├── templates/
│ ├── base.html
│ ├── login.html
│ ├── question.html
│ ├── result.html
│ └── admin.html
├── static/
│ ├── images3/ # place COCO-like images here
│ └── placeholder.jpg
├── data/
│ ├── coco_cefr_vocab.csv
│ └── captions_val2017_sample10.json
└── tests/
├── test_system.py
└── individual_tests.py
python tests/test_system.py # end‑to‑end
python tests/individual_tests.py # component‑level
python -m pytest tests/ -v # optional, if pytest present-
ModuleNotFoundError: No module named 'flask'You likely installed into a different environment. Usepython -m pip install ...so pip matches the active interpreter. -
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff ….envis UTF‑16. Re‑save as UTF‑8 (no BOM) in VS Code, or run:iconv -f utf-16 -t utf-8 .env -o .env.utf8 && mv .env.utf8 .env && dos2unix .env 2>/dev/null || true -
Static images return 404 (
GET /static/images3/000000xxxxx.jpg 404) Files aren’t present or the path is wrong. Place real images understatic/images3and verify exact 12‑digit names. -
C‑extension build errors (
Python.h: No such file or directory, packages likecymem,murmurhash,preshed) Install headers and toolchain, then retry:sudo apt update && sudo apt install -y build-essential python3.8-dev -
Pip fails on
pkg_resources==0.0.0Remove that single line from the lock file; it’s a harmless freeze artifact. -
Creating venv under
/mnt/craisesOperation not permittedPut venv under Linux home (~/.venvs/lveige38). If you must use/mnt/c, enable metadata in/etc/wsl.confand restart WSL. -
Port already in use Run on a different port with
--port 5050, or find & stop the process:ss -lptn 'sport = :5000' -
OpenAI image generation fails Ensure
OPENAI_API_KEYis set; check any feature flags inmodules/enhanced_image_gen.py; verify network/quota.
export FLASK_SECRET_KEY="your_production_secret_key"
export OPENAI_API_KEY="your_production_api_key"
export FLASK_ENV=production
export FLASK_DEBUG=False- Do not commit
.env(.gitignoreshould exclude it). - Use a real WSGI server (e.g., gunicorn) + reverse proxy in production.
- User authentication
- Richer analytics & recommendations
- Text‑to‑speech support
- Mobile‑friendly UI
This work was supported by JST SPRING, Grant Number JPMJSP2102. :contentReference[oaicite:2]{index=2}
- Code: MIT License (see LICENSE)
- Docs & Images (repo): CC BY 4.0, unless otherwise noted
- COCO images: Not redistributed in this repository. Please obtain the dataset from the original source and follow its licenses.
- AI-generated images: Use governed by the image provider’s latest terms.
See CONTRIBUTING.md. We welcome issues and pull requests!


