这不是一个「单词列表 + 刷题页」项目。
这是一个可运行的教育推荐系统缩小版:Retrieval -> Ranking -> Policy。
- 把背单词核心链路做成了推荐系统标准分层,而不是 CRUD:
Recall(rule + embedding) -> Feature(MySQL + Redis) -> LTR -> Re-ranking -> SRS(SM-2)。 - 后端
/v1/review/*API 形状保持不变,内部升级为可扩展的 Learning Pipeline,前端可无缝对接。 - LTR 采用稳定特征契约:
f1...f10+ltr_feature_schema.json+ltr_xgb.json,并在运行时做严格顺序校验,避免训练/线上错位。 - Embedding Recall 设计为工业可扩展接口:
Java 侧
AnnRecallClient通过 HTTP 调用 ANN 服务,异常自动降级为规则召回(服务可用性优先)。 - 前端交互按真实产品质量打磨:
可取消请求、可重试、Review Due 驱动入口、结果
Promise.allSettled提交与失败项重试。 - 工程稳定性考虑到位: JWT 鉴权、限流过滤器、Redis 缓存穿透/击穿防护、Flyway 迁移、可一键拉起本地环境。
React App
|
Spring Boot API Gateway (/v1/*)
|
LearningService
|
CandidateRecallService
|- rule recall: review/hard/new
|- embedding recall: ANN client (HTTP)
|
FeatureService (MySQL + Redis online feature)
|
XgboostLtrRankingService (LTR contract)
|
ReRankingService (配额 + 多样性)
|
SpacedRepetitionScheduler (SM-2 policy)
|
MySQL + Redis
RecallCandidateRecallService组合review/hard/new三路规则召回,并融合 embedding recall 候选。FeatureFeatureService批量组装特征,慢变特征来自 MySQL,快变特征(如 wrong30d/lastRating)优先 Redis。LTR RankingXgboostLtrRankingService读取models/ltr_feature_schema.json与models/ltr_xgb.json,按固定 schema 打分排序。Re-rankingReRankingService按 new/review/hard 配额与连续来源约束做重排,避免体验崩坏。Policy/SchedulingSpacedRepetitionScheduler按 SM-2 更新easeFactor/interval/repetition/nextReviewAt。
- 新增
term_stats表(Flyway V3),为排序提供frequency_rank、difficulty_score。 ReviewService.nextCards()已切换到LearningService编排,提交接口保持原有路径与返回结构。- 提交复习结果时会更新 Redis 在线特征缓存,下一轮推荐可立即感知用户反馈。
- ANN 服务不可用时不会拖垮主流程,系统回退到规则召回继续工作。
- Backend: Java 21, Spring Boot 3, Spring Security, Spring Data JPA, Redis, Flyway
- Frontend: React 18, Redux Toolkit, Axios
- Storage: MySQL 8, Redis 7
- ML/Ranking artifacts: XGBoost-style LTR contract (
f1..f10schema + model artifact) - ANN(可插拔): Faiss via external Python/FastAPI service
- JDK 21
- Node.js 18+
- Docker Desktop(Running)
- PowerShell
cd /d/Github/baicizhan/frontend
npm installcd /d/Github/baicizhan
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./start-dev.ps1启动后访问:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:8080 - Swagger:
http://localhost:8080/swagger-ui.html
cd /d/Github/baicizhan
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./stop-dev.ps1当前仓库已具备 Java 侧 ANN 调用与降级逻辑。
Python ANN 服务可独立部署,通过 HTTP 接入。
conda create -n baicizhan python=3.11 -y
conda activate baicizhan
pip install faiss-cpu fastapi uvicorn numpy如果你已有 ann_service.py:
conda activate baicizhan
uvicorn ann_service:app --host 0.0.0.0 --port 18080POST /v1/auth/register/POST /v1/auth/loginGET /v1/review/next?limit=20获取下一批卡片POST /v1/review/{termId}/result提交评分(支持elapsedMs)- 重复 2/3,可观察推荐结果随用户反馈动态变化
- 数据集位于
datasets/high-frequency-vocabulary/ - 启动脚本会在
terms为空时自动导入 - Flyway 管理 schema,
V3__term_stats.sql已落地
cd /d/Github/baicizhan/demo
./mvnw.cmd -q test
./mvnw.cmd -q -DskipTests package
cd /d/Github/baicizhan/frontend
npm run build- 当前
XgboostLtrRankingService使用轻量线性推断契约(接口与模型工件已稳定)。 - 下一步可无缝替换为原生 XGBoost 在线推断(保持
RankingService接口不变)。 - ANN 服务目前是外部可插拔组件;后续可补齐仓库内置 FastAPI + Faiss 服务实现。
baicizhan/
├─ demo/ # Spring Boot backend
├─ frontend/ # React frontend
├─ datasets/ # 高频词数据
├─ start-dev.ps1 # 一键启动
├─ stop-dev.ps1 # 一键停止
├─ deep-research-report.md
└─ HOW_TO_RUN.md
- Name:
yang yu - LinkedIn:
https://www.linkedin.com/in/yy030305/?locale=zh - GitHub:
https://github.com/eyesofish - Email:
devilsrocbuddhasgildedimage@gmail.com


