Skip to content

Commit 1086bb3

Browse files
许君山许君山
authored andcommitted
feat: v1.1.0 - multi-word-type support, Chinese translation, furigana, UI overhaul
- Support noun, adjective, adverb lookup via Jisho API fallback - Auto-translate English definitions to Chinese via local Ollama - Furigana (ruby) annotation powered by kuromoji tokenizer - Unified search bar UI (input + button combined) - Bug fixes: addToHistory, normalizeJapanese, iku special case, AI error handling - Add .qoder to .gitignore
1 parent 5133efa commit 1086bb3

9 files changed

Lines changed: 1435 additions & 470 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ build/
1717
# IDE and editor files
1818
.vscode/
1919
.idea/
20+
.qoder/
2021
*.swp
2122
*.swo
2223
*~

README.md

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,26 @@
11
<div align="center">
22

3-
# 🌸 Japanese Verb Master (日语动词活用专家)
3+
# 🌸 Japanese Verb Master日语动词活用专家
44

55
[![Vue 3](https://img.shields.io/badge/Vue.js-3.0-4FC08D?style=for-the-badge&logo=vue.js)](https://vuejs.org/)
66
[![Express](https://img.shields.io/badge/Express.js-4.x-000000?style=for-the-badge&logo=express)](https://expressjs.com/)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
88
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com)
99

10-
**The ultimate, precise Japanese verb conjugation tool and API.**
11-
<br>
1210
**一个精准、优雅的日语动词活用在线工具与 RESTful API。**
1311

14-
[English](#english)[简体中文](#简体中文)
12+
[English](./README_EN.md) | [日本語](./README_JA.md)
1513

1614
</div>
1715

1816
---
1917

20-
<h2 id="english">🇬🇧 English</h2>
21-
22-
### ✨ Features
23-
24-
- 🎯 **High Accuracy**: Precise conjugation rules for Godan, Ichidan, and Irregular verbs.
25-
-**Real-time**: Instant results powered by a modern Vue 3 frontend.
26-
- 📚 **Comprehensive**: Covers 10+ forms including Te-form, Ta-form, Passive, Causative, Potential, and more.
27-
- 🔌 **REST API**: Built-in Express backend providing clean JSON APIs for other developers to build upon.
28-
- 📱 **Responsive Design**: Works perfectly on mobile and desktop.
29-
30-
### 🚀 Quick Start
31-
32-
#### 1. Clone the repository
33-
```bash
34-
git clone https://github.com/yuaiccc/japanese-verb-master.git
35-
cd japanese-verb-master
36-
```
37-
38-
#### 2. Start the Backend API
39-
```bash
40-
cd backend
41-
npm install
42-
npm run dev # Runs on port 3000
43-
```
44-
45-
#### 3. Start the Frontend
46-
```bash
47-
cd frontend
48-
npm install
49-
npm run dev # Runs on port 5173
50-
```
51-
52-
### 📖 API Reference
53-
54-
You can easily use our conjugation engine in your own apps!
55-
56-
**Endpoint:** `GET /api/conjugate`
57-
58-
```bash
59-
curl "http://localhost:3000/api/conjugate?verb=飲む&type=GODAN"
60-
```
61-
62-
**Response:**
63-
```json
64-
{
65-
"dictionaryForm": "飲む",
66-
"verbType": "GODAN",
67-
"negative": "飲まない",
68-
"polite": "飲みます",
69-
"teForm": "飲んで",
70-
"taForm": "飲んだ",
71-
"potential": "飲める",
72-
"passive": "飲まれる",
73-
"causative": "飲ませる",
74-
"imperative": "飲め",
75-
"volitional": "飲もう"
76-
}
77-
```
78-
79-
---
80-
81-
<h2 id="简体中文">🇨🇳 简体中文</h2>
82-
8318
### ✨ 项目特色
8419

8520
- 🎯 **极高准确率**:完美支持五段动词、一段动词及各类不规则动词(サ变、カ变)的变形规则。
8621
-**极致响应**:基于 Vue 3 + Vite 构建的前端,提供丝滑的实时交互体验。
8722
- 📚 **全面覆盖**:一键生成 10+ 种常用活用形式(包含て形、た形、被动、使役、可能形等)。
23+
- 🤖 **AI 深度解析**:集成 Ollama 本地模型,自动校对变形结果并生成实用例句。
8824
- 🔌 **开箱即用的 API**:提供轻量级的 Express RESTful API,方便其他开发者接入自己的应用。
8925
- 📱 **响应式设计**:无论是手机背单词还是电脑查资料,都有完美的视觉体验。
9026

@@ -145,17 +81,16 @@ curl "http://localhost:3000/api/conjugate?verb=食べる&type=ICHIDAN"
14581
3. **サ变动词 (Group 3)**:词尾为 する(例:勉強する)
14682
4. **カ变动词 (Group 3)**:来る
14783

148-
## 🤝 参与贡献 (Contributing)
84+
### 🤝 参与贡献
14985

15086
非常欢迎提交 Issue 和 Pull Request!如果你发现了任何动词变形的 Edge Case,或者想添加新的特性(如敬语/谦让语生成),请随时参与进来!
15187
详细指南请参考 [CONTRIBUTING.md](CONTRIBUTING.md)
15288

153-
## 📄 开源协议
89+
### 📄 开源协议
15490

15591
本项目基于 **MIT License** 开源。欢迎自由使用、修改和分发。
15692

15793
---
15894
<div align="center">
159-
If you find this tool helpful, please give it a ⭐️! <br>
16095
如果这个工具对你有帮助,请给它点个 ⭐️ 吧!
16196
</div>

README_EN.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<div align="center">
2+
3+
# 🌸 Japanese Verb Master
4+
5+
[![Vue 3](https://img.shields.io/badge/Vue.js-3.0-4FC08D?style=for-the-badge&logo=vue.js)](https://vuejs.org/)
6+
[![Express](https://img.shields.io/badge/Express.js-4.x-000000?style=for-the-badge&logo=express)](https://expressjs.com/)
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
8+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com)
9+
10+
**The ultimate, precise Japanese verb conjugation tool and API.**
11+
12+
[简体中文](./README.md) | [日本語](./README_JA.md)
13+
14+
</div>
15+
16+
---
17+
18+
### ✨ Features
19+
20+
- 🎯 **High Accuracy**: Precise conjugation rules for Godan, Ichidan, and Irregular verbs (Suru / Kuru).
21+
-**Real-time**: Instant results powered by a modern Vue 3 + Vite frontend.
22+
- 📚 **Comprehensive**: Covers 10+ conjugation forms including Te-form, Ta-form, Passive, Causative, Potential, and more.
23+
- 🤖 **AI-Powered Analysis**: Integrated with Ollama local models for automatic verification and example sentence generation.
24+
- 🔌 **REST API**: Built-in Express backend providing clean JSON APIs for developers to build upon.
25+
- 📱 **Responsive Design**: Works perfectly on both mobile and desktop.
26+
27+
### 🚀 Quick Start
28+
29+
#### 1. Clone the repository
30+
```bash
31+
git clone https://github.com/yuaiccc/japanese-verb-master.git
32+
cd japanese-verb-master
33+
```
34+
35+
#### 2. Start the Backend API
36+
```bash
37+
cd backend
38+
npm install
39+
npm run dev # Runs on port 3000
40+
```
41+
42+
#### 3. Start the Frontend
43+
```bash
44+
cd frontend
45+
npm install
46+
npm run dev # Runs on port 5173
47+
```
48+
49+
### 📖 API Reference
50+
51+
You can easily use our conjugation engine in your own apps!
52+
53+
**Endpoint:** `GET /api/conjugate`
54+
55+
```bash
56+
curl "http://localhost:3000/api/conjugate?verb=飲む&type=GODAN"
57+
```
58+
59+
**Response:**
60+
```json
61+
{
62+
"dictionaryForm": "飲む",
63+
"verbType": "GODAN",
64+
"negative": "飲まない",
65+
"polite": "飲みます",
66+
"teForm": "飲んで",
67+
"taForm": "飲んだ",
68+
"potential": "飲める",
69+
"passive": "飲まれる",
70+
"causative": "飲ませる",
71+
"imperative": "飲め",
72+
"volitional": "飲もう"
73+
}
74+
```
75+
76+
### 🧠 Verb Classification Guide
77+
78+
The engine supports the complete modern Japanese verb classification system:
79+
1. **Godan Verbs (Group 1)**: Endings in う, く, ぐ, す, つ, ぬ, ふ, ぶ, む, る (e.g. 飲む, 書く)
80+
2. **Ichidan Verbs (Group 2)**: Endings in える or いる (e.g. 食べる, 見る)
81+
3. **Suru Verbs (Group 3)**: Endings in する (e.g. 勉強する)
82+
4. **Kuru Verb (Group 3)**: 来る
83+
84+
### 🤝 Contributing
85+
86+
Issues and Pull Requests are very welcome! If you find any edge cases in verb conjugation, or want to add new features (e.g. honorific / humble form generation), feel free to contribute!
87+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
88+
89+
### 📄 License
90+
91+
This project is open-sourced under the **MIT License**. Feel free to use, modify, and distribute.
92+
93+
---
94+
<div align="center">
95+
If you find this tool helpful, please give it a ⭐️!
96+
</div>

README_JA.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<div align="center">
2+
3+
# 🌸 Japanese Verb Master(日本語動詞活用マスター)
4+
5+
[![Vue 3](https://img.shields.io/badge/Vue.js-3.0-4FC08D?style=for-the-badge&logo=vue.js)](https://vuejs.org/)
6+
[![Express](https://img.shields.io/badge/Express.js-4.x-000000?style=for-the-badge&logo=express)](https://expressjs.com/)
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
8+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com)
9+
10+
**正確で使いやすい日本語動詞活用オンラインツール&RESTful API。**
11+
12+
[简体中文](./README.md) | [English](./README_EN.md)
13+
14+
</div>
15+
16+
---
17+
18+
### ✨ 特徴
19+
20+
- 🎯 **高精度**:五段動詞、一段動詞、不規則動詞(サ変・カ変)の活用規則を完全サポート。
21+
-**リアルタイム**:Vue 3 + Vite で構築されたフロントエンドにより、スムーズな操作体験を実現。
22+
- 📚 **網羅的**:て形、た形、受身形、使役形、可能形など、10種類以上の活用形式をワンクリックで生成。
23+
- 🤖 **AI 分析機能**:Ollama ローカルモデルを統合し、活用結果の自動検証と例文生成を実現。
24+
- 🔌 **すぐ使える API**:Express による軽量な RESTful API を提供。他のアプリケーションとの連携も簡単。
25+
- 📱 **レスポンシブデザイン**:スマートフォンでもPCでも快適に利用可能。
26+
27+
### 🚀 クイックスタート
28+
29+
#### 1. リポジトリをクローン
30+
```bash
31+
git clone https://github.com/yuaiccc/japanese-verb-master.git
32+
cd japanese-verb-master
33+
```
34+
35+
#### 2. バックエンドを起動
36+
```bash
37+
cd backend
38+
npm install
39+
npm run dev # ポート3000で起動
40+
```
41+
42+
#### 3. フロントエンドを起動
43+
```bash
44+
cd frontend
45+
npm install
46+
npm run dev # ポート5173で起動
47+
```
48+
49+
### 📖 API リファレンス
50+
51+
本プロジェクトの活用エンジンを、あなた自身のアプリで簡単に利用できます!
52+
53+
**エンドポイント:** `GET /api/conjugate`
54+
55+
```bash
56+
curl "http://localhost:3000/api/conjugate?verb=飲む&type=GODAN"
57+
```
58+
59+
**レスポンス:**
60+
```json
61+
{
62+
"dictionaryForm": "飲む",
63+
"verbType": "GODAN",
64+
"negative": "飲まない",
65+
"polite": "飲みます",
66+
"teForm": "飲んで",
67+
"taForm": "飲んだ",
68+
"potential": "飲める",
69+
"passive": "飲まれる",
70+
"causative": "飲ませる",
71+
"imperative": "飲め",
72+
"volitional": "飲もう"
73+
}
74+
```
75+
76+
### 🧠 動詞分類ガイド
77+
78+
本エンジンは現代日本語の動詞分類体系を完全にサポートしています:
79+
1. **五段動詞(Group 1)**:語尾が う、く、ぐ、す、つ、ぬ、ふ、ぶ、む、る(例:飲む、書く)
80+
2. **一段動詞(Group 2)**:語尾が える または いる(例:食べる、見る)
81+
3. **サ変動詞(Group 3)**:語尾が する(例:勉強する)
82+
4. **カ変動詞(Group 3)**:来る
83+
84+
### 🤝 コントリビューション
85+
86+
Issue や Pull Request を大歓迎しています!動詞活用のエッジケースを発見した場合や、新機能(敬語・謙譲語の生成など)を追加したい場合は、お気軽にご参加ください!
87+
詳細は [CONTRIBUTING.md](CONTRIBUTING.md) をご参照ください。
88+
89+
### 📄 ライセンス
90+
91+
本プロジェクトは **MIT License** の下でオープンソースとして公開されています。自由にご利用・改変・再配布いただけます。
92+
93+
---
94+
<div align="center">
95+
このツールが役に立ったら、ぜひ ⭐️ をお願いします!
96+
</div>

backend/conjugationEngine.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GodanVerb extends Verb {
4949
}
5050

5151
getTeTaSuffix(isTe) {
52-
if (this.dictionaryForm === '行く') {
52+
if (this.dictionaryForm === '行く' || this.dictionaryForm === 'いく') {
5353
return isTe ? 'って' : 'った';
5454
}
5555
const suffixMap = {
@@ -113,19 +113,21 @@ class KuruVerb extends Verb {
113113
constructor(dictionaryForm) {
114114
super();
115115
this.dictionaryForm = dictionaryForm;
116-
this.prefix = dictionaryForm.slice(0, -2);
116+
// 判断是否包含汉字「来」:「来る」→ prefix='来', 「くる」→ prefix=''
117+
this.hasKanji = dictionaryForm.includes('来');
118+
this.prefix = this.hasKanji ? dictionaryForm.slice(0, dictionaryForm.indexOf('来') + 1) : '';
117119
}
118120

119121
getDictionaryForm() { return this.dictionaryForm; }
120-
getNegative() { return this.prefix + 'こない'; }
121-
getPolite() { return this.prefix + 'きます'; }
122-
getTeForm() { return this.prefix + 'きて'; }
123-
getTaForm() { return this.prefix + 'きた'; }
124-
getPotential() { return this.prefix + 'こられる'; }
125-
getPassive() { return this.prefix + 'こられる'; }
126-
getCausative() { return this.prefix + 'こさせる'; }
127-
getImperative() { return this.prefix + 'こい'; }
128-
getVolitional() { return this.prefix + 'こよう'; }
122+
getNegative() { return this.hasKanji ? this.prefix + 'ない' : this.prefix + 'こない'; }
123+
getPolite() { return this.hasKanji ? this.prefix + 'ます' : this.prefix + 'きます'; }
124+
getTeForm() { return this.hasKanji ? this.prefix + 'て' : this.prefix + 'きて'; }
125+
getTaForm() { return this.hasKanji ? this.prefix + 'た' : this.prefix + 'きた'; }
126+
getPotential() { return this.hasKanji ? this.prefix + 'られる' : this.prefix + 'こられる'; }
127+
getPassive() { return this.hasKanji ? this.prefix + 'られる' : this.prefix + 'こられる'; }
128+
getCausative() { return this.hasKanji ? this.prefix + 'させる' : this.prefix + 'こさせる'; }
129+
getImperative() { return this.hasKanji ? this.prefix + 'い' : this.prefix + 'こい'; }
130+
getVolitional() { return this.hasKanji ? this.prefix + 'よう' : this.prefix + 'こよう'; }
129131
}
130132

131133
// 工厂函数

0 commit comments

Comments
 (0)