1 line
6.7 KiB
JSON
1 line
6.7 KiB
JSON
{"repo": "bkmashiro/kaku-yaku-api", "files": {"README.md": {"7e3e31f536a81788cd05ea9cc9da40a7db011cab": {"t": 1785674037.4982057, "n": 2555, "h": "434a1a9cff74f95f", "c": "# KakuYaku API\n\nNestJS backend for the [KakuYaku Chrome extension](https://github.com/bkmashiro/kaku-yaku-ext). Provides Japanese text analysis, dictionary lookup, and LLM-powered explanations.\n\n## Requirements\n\n- Node.js 18+\n- PostgreSQL 17 with [PGroonga](https://pgroonga.github.io/) extension\n- Sudachi dictionary (system_small)\n\n## Setup\n\n```bash\nnpm install\n```\n\n### Environment\n\nCopy `.env.example` to `.env` and fill in:\n\n```env\n# Database\nDB_HOST=localhost\nDB_PORT=5432\nDB_USERNAME=kakuyaku\nDB_PASSWORD=kakuyaku123\nDB_DATABASE=kakuyaku\nDB_SYNC=true\n\n# Sudachi tokenizer\nDICTIONARY_PATH=/path/to/sudachi/system_small.dic\n\n# LLM (DeepSeek / any OpenAI-compatible API)\nOPENAI_API_KEY=sk-...\nOPENAI_BASE_URL=https://api.deepseek.com/v1\nLLM_MODEL=deepseek-chat\n\n# Skip data import on restart (set to true after first run)\nLOAD_KANJI_DICT=false\nLOAD_JM_DICT=false\nLOAD_TATOEBA=false\nLOAD_ANKI=false\n```\n\n### First Run (data import)\n\nSet `LOAD_*=true` on the first startup to import dictionary data. This takes a few minutes. Set back to `false` afterwards.\n\nRequired data files (not included in repo, place in `data/`):\n\n| File | Source |\n|------|--------|\n| `data/jmdict/JMdict_e` | [JMdict](https://www.edrdg.org/wiki/index.php/JMdict-EDICT_Dictionary_Project) |\n| `data/kanjidic/kanjidic2.xml` | [KANJIDIC2](https://www.edrdg.org/wiki/index.php/KANJIDIC_Project) |\n| `data/tatoeba/jpn_sentences.tsv` | [Tatoeba](https://tatoeba.org/en/downloads) |\n| `data/sudachi/...` | [Sudachi Dictionary](https://github.com/WorksApplications/SudachiDict) |\n\n### Start\n\n```bash\n# Development (watch mode)\nnpm run start:dev\n\n# Production\nnpm run build && npm run start:prod\n```\n\n## API Endpoints\n\n### Analysis\n\n```\nGET /api/analysis/quick?sentence=<text>\n```\n\nReturns tokenized sentence with Sudachi analysis + JMDict lookup for each token.\n\n### LLM\n\n```\nPOST /api/llm/explain-grammar\nBody: { sentence, targetWord, lang? }\n→ { role, function, rule, example, exampleTrans }\n\nPOST /api/llm/translate\nBody: { sentence, lang? }\n→ { translation, chunks: [{ jp, en }] }\n```\n\n`lang` defaults to `\"English\"`. Accepts any language name (e.g. `\"中文\"`, `\"日本語\"`).\n\n### Dictionary\n\n```\nGET /api/dictionary/kanji/:character\nGET /api/dictionary/word/:term\n```\n\n## Architecture\n\n```\nsrc/\n├── modules/\n│ ├── analysis/ Sudachi tokenizer bridge (native Node module)\n│ ├── dictionary/ JMDict + KANJIDIC2 PostgreSQL lookup\n│ ├── llm/ DeepSeek/OpenAI grammar + translation\n│ └── tatoeba/ Example sentence search\n└── app.module.ts\n```\n\n## License\n\nMIT\n"}, "1294a0faadb3861b168699a148862cedeefed737": {"t": 1785763940.4774933, "n": 2555, "h": "434a1a9cff74f95f", "c": "# KakuYaku API\n\nNestJS backend for the [KakuYaku Chrome extension](https://github.com/bkmashiro/kaku-yaku-ext). Provides Japanese text analysis, dictionary lookup, and LLM-powered explanations.\n\n## Requirements\n\n- Node.js 18+\n- PostgreSQL 17 with [PGroonga](https://pgroonga.github.io/) extension\n- Sudachi dictionary (system_small)\n\n## Setup\n\n```bash\nnpm install\n```\n\n### Environment\n\nCopy `.env.example` to `.env` and fill in:\n\n```env\n# Database\nDB_HOST=localhost\nDB_PORT=5432\nDB_USERNAME=kakuyaku\nDB_PASSWORD=kakuyaku123\nDB_DATABASE=kakuyaku\nDB_SYNC=true\n\n# Sudachi tokenizer\nDICTIONARY_PATH=/path/to/sudachi/system_small.dic\n\n# LLM (DeepSeek / any OpenAI-compatible API)\nOPENAI_API_KEY=sk-...\nOPENAI_BASE_URL=https://api.deepseek.com/v1\nLLM_MODEL=deepseek-chat\n\n# Skip data import on restart (set to true after first run)\nLOAD_KANJI_DICT=false\nLOAD_JM_DICT=false\nLOAD_TATOEBA=false\nLOAD_ANKI=false\n```\n\n### First Run (data import)\n\nSet `LOAD_*=true` on the first startup to import dictionary data. This takes a few minutes. Set back to `false` afterwards.\n\nRequired data files (not included in repo, place in `data/`):\n\n| File | Source |\n|------|--------|\n| `data/jmdict/JMdict_e` | [JMdict](https://www.edrdg.org/wiki/index.php/JMdict-EDICT_Dictionary_Project) |\n| `data/kanjidic/kanjidic2.xml` | [KANJIDIC2](https://www.edrdg.org/wiki/index.php/KANJIDIC_Project) |\n| `data/tatoeba/jpn_sentences.tsv` | [Tatoeba](https://tatoeba.org/en/downloads) |\n| `data/sudachi/...` | [Sudachi Dictionary](https://github.com/WorksApplications/SudachiDict) |\n\n### Start\n\n```bash\n# Development (watch mode)\nnpm run start:dev\n\n# Production\nnpm run build && npm run start:prod\n```\n\n## API Endpoints\n\n### Analysis\n\n```\nGET /api/analysis/quick?sentence=<text>\n```\n\nReturns tokenized sentence with Sudachi analysis + JMDict lookup for each token.\n\n### LLM\n\n```\nPOST /api/llm/explain-grammar\nBody: { sentence, targetWord, lang? }\n→ { role, function, rule, example, exampleTrans }\n\nPOST /api/llm/translate\nBody: { sentence, lang? }\n→ { translation, chunks: [{ jp, en }] }\n```\n\n`lang` defaults to `\"English\"`. Accepts any language name (e.g. `\"中文\"`, `\"日本語\"`).\n\n### Dictionary\n\n```\nGET /api/dictionary/kanji/:character\nGET /api/dictionary/word/:term\n```\n\n## Architecture\n\n```\nsrc/\n├── modules/\n│ ├── analysis/ Sudachi tokenizer bridge (native Node module)\n│ ├── dictionary/ JMDict + KANJIDIC2 PostgreSQL lookup\n│ ├── llm/ DeepSeek/OpenAI grammar + translation\n│ └── tatoeba/ Example sentence search\n└── app.module.ts\n```\n\n## License\n\nMIT\n"}, "a6e453a85bcac983d449c5e40fd06fd6f2252d52": {"t": 1785763941.7421477, "n": 995, "h": "5d3d0f9341c18ad8", "c": "# KakuYaku\n\n## Credit\n[Jisho.org](https://jisho.org/about)\n\n[DBpedia](https://www.dbpedia.org/about/)\n\n[KANJIDIC2](https://www.edrdg.org/wiki/index.php/KANJIDIC_Project)\n\n[JMdict](https://www.edrdg.org/wiki/index.php/JMdict-EDICT_Dictionary_Project)\n\n[tatoeba](https://tatoeba.org/en/downloads)\n\n[KanjiVG](https://kanjivg.tagaini.net/)\n\n[Jonathan Waller JLPT](https://www.tanos.co.uk/jlpt/)\n\n[tofugu](https://www.tofugu.com/japanese-learning-resources-database/)\n\n[MeCab](https://taku910.github.io/mecab/)\n\n[masanorihirano llm-japanese-dataset](https://github.com/masanorihirano/llm-japanese-dataset)\n\n[RabbearSu/Japanese-Words](https://github.com/RabbearSu/Japanese-Words)\n\n[Japanese Word Similarity Dataset](https://github.com/tmu-nlp/JapaneseWordSimilarityDataset)\n\n[RabbearSu/Japanese-Words](https://github.com/RabbearSu/Japanese-Words)\n\n[sudachi](https://github.com/WorksApplications/sudachi.rs)\n\n[awesome-japanese-nlp-resources](https://github.com/taishi-i/awesome-japanese-nlp-resources)\n"}}}} |