henkan 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +25 -0
- package/LICENSE.md +21 -0
- package/README.md +82 -0
- package/SECURITY.md +20 -0
- package/dist/index.cjs.js +2257 -0
- package/dist/index.cjs.js.map +7 -0
- package/dist/index.mjs +2199 -0
- package/dist/index.mjs.map +7 -0
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +680 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils.d.ts +135 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/docs/api/README.md +62 -0
- package/docs/api/functions/capitalizeString.md +27 -0
- package/docs/api/functions/convertJMdict.md +27 -0
- package/docs/api/functions/convertKanjiDic.md +27 -0
- package/docs/api/functions/convertKradFile.md +39 -0
- package/docs/api/functions/convertRadkFile.md +33 -0
- package/docs/api/functions/convertTanakaCorpus.md +33 -0
- package/docs/api/functions/generateAnkiNote.md +27 -0
- package/docs/api/functions/generateAnkiNotesFile.md +27 -0
- package/docs/api/functions/getKanji.md +57 -0
- package/docs/api/functions/getKanjiExtended.md +69 -0
- package/docs/api/functions/getWord.md +63 -0
- package/docs/api/functions/isStringArray.md +27 -0
- package/docs/api/functions/isValidArray.md +27 -0
- package/docs/api/functions/isValidArrayWithFirstElement.md +27 -0
- package/docs/api/functions/makeSSML.md +33 -0
- package/docs/api/functions/shuffleArray.md +33 -0
- package/docs/api/functions/synthesizeSpeech.md +39 -0
- package/docs/api/interfaces/DictKanji.md +43 -0
- package/docs/api/interfaces/DictKanjiForm.md +51 -0
- package/docs/api/interfaces/DictKanjiMisc.md +61 -0
- package/docs/api/interfaces/DictKanjiReading.md +31 -0
- package/docs/api/interfaces/DictKanjiReadingMeaning.md +33 -0
- package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +33 -0
- package/docs/api/interfaces/DictKanjiWithRadicals.md +33 -0
- package/docs/api/interfaces/DictMeaning.md +129 -0
- package/docs/api/interfaces/DictRadical.md +41 -0
- package/docs/api/interfaces/DictReading.md +61 -0
- package/docs/api/interfaces/DictWord.md +53 -0
- package/docs/api/interfaces/ExamplePart.md +75 -0
- package/docs/api/interfaces/Grammar.md +165 -0
- package/docs/api/interfaces/GrammarMeaning.md +31 -0
- package/docs/api/interfaces/Kana.md +125 -0
- package/docs/api/interfaces/Kanji.md +239 -0
- package/docs/api/interfaces/KanjiComponent.md +31 -0
- package/docs/api/interfaces/KanjiForm.md +33 -0
- package/docs/api/interfaces/Phrase.md +47 -0
- package/docs/api/interfaces/Radical.md +165 -0
- package/docs/api/interfaces/Reading.md +43 -0
- package/docs/api/interfaces/ResultEntry.md +75 -0
- package/docs/api/interfaces/TanakaExample.md +51 -0
- package/docs/api/interfaces/Translation.md +33 -0
- package/docs/api/interfaces/UsefulRegExps.md +93 -0
- package/docs/api/interfaces/Word.md +149 -0
- package/docs/api/type-aliases/Dict.md +13 -0
- package/docs/api/type-aliases/DictName.md +13 -0
- package/docs/api/type-aliases/EntryType.md +13 -0
- package/docs/api/type-aliases/JLPT.md +13 -0
- package/docs/api/type-aliases/Result.md +13 -0
- package/package.json +87 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Submitting Pull Requests
|
|
6
|
+
|
|
7
|
+
1. **Fork** the repo.
|
|
8
|
+
2. Create a branch off `main` named `fix/<short-description>` or `feat/<short-description>`.
|
|
9
|
+
3. Make your changes against that branch and push everything to the remote forked repo.
|
|
10
|
+
4. Submit a PR from that new branch and link any relevant issue(s).
|
|
11
|
+
|
|
12
|
+
### Your PR should include:
|
|
13
|
+
|
|
14
|
+
- A clear title, describing your changes in as very little details as possible.
|
|
15
|
+
- A description of **what** you changed and **why**.
|
|
16
|
+
- Screenshots or examples of the changes. *(if applicable)*
|
|
17
|
+
|
|
18
|
+
## **Security vulnerabilities**
|
|
19
|
+
- See [Security Policy](https://github.com/Ronokof/Henkan/security/policy).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## License & Code of Conduct
|
|
24
|
+
- By contributing, you agree that your work will be licensed under and must comply with this repository’s [LICENSE.md](LICENSE.md).
|
|
25
|
+
- Please also respect the [Code of Conduct](CODE_OF_CONDUCT.md).
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ronokof
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# henkan
|
|
2
|
+
|
|
3
|
+
A Node.JS library that helps you convert any dictionary from [EDRDG](https://www.edrdg.org/), transform their entries into more user-friendly schemas and create Anki notes from the them.
|
|
4
|
+
|
|
5
|
+
> The library is used for the [Full Japanese Study Deck](https://ankiweb.net/shared/info/1407096987), so some features might be tailored specifically to the deck.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/henkan) []()
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Table of contents
|
|
12
|
+
|
|
13
|
+
- [Install](#install)
|
|
14
|
+
- [Features](#features)
|
|
15
|
+
- [Example](#example)
|
|
16
|
+
- [API](#api)
|
|
17
|
+
- [Contributing](#contributing)
|
|
18
|
+
- [License](#license)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# npm
|
|
26
|
+
npm install henkan
|
|
27
|
+
|
|
28
|
+
# or yarn
|
|
29
|
+
yarn add henkan
|
|
30
|
+
|
|
31
|
+
# or pnpm
|
|
32
|
+
pnpm add henkan
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
# Features
|
|
36
|
+
- JMdict, KANJIDIC, Tanaka Corpus, RADK and KRAD conversion
|
|
37
|
+
- User-friendly schemas for dictionary entries
|
|
38
|
+
- Anki note generation
|
|
39
|
+
- Other useful tools (AWS Polly audio generation, Japanese RegExps, array checking etc.)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Example
|
|
44
|
+
|
|
45
|
+
Download the [JMdict_e.gz](http://ftp.edrdg.org/pub/Nihongo/JMdict_e.gz) archive and extract `JMdict_e` from it.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
import fs from 'fs';
|
|
49
|
+
import { convertJMdict, generateAnkiNotesFile, getWord } from 'henkan';
|
|
50
|
+
//const fs = require('fs');
|
|
51
|
+
//const { convertJMdict, generateAnkiNotesFile, getWord } = require('henkan');
|
|
52
|
+
|
|
53
|
+
const dictPath = './JMdict_e';
|
|
54
|
+
const dictContent = fs.readFileSync(dictPath, 'utf-8');
|
|
55
|
+
|
|
56
|
+
const dictWords = convertJMdict(dictContent);
|
|
57
|
+
|
|
58
|
+
const noteTypeName = 'Word';
|
|
59
|
+
const deckName = 'Japanese::Vocabulary::No kanji form words';
|
|
60
|
+
|
|
61
|
+
const noKanjiFormWords = dictWords
|
|
62
|
+
.filter(word => word.kanjiForms === undefined)
|
|
63
|
+
.map(word => getWord(undefined, undefined, undefined, undefined, word, noteTypeName, deckName));
|
|
64
|
+
|
|
65
|
+
const ankiNotesFile = generateAnkiNotesFile(noKanjiFormWords);
|
|
66
|
+
|
|
67
|
+
if (ankiNotesFile) fs.writeFileSync('./nokfwords.json', ankiNotesFile, 'utf-8');
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
# API
|
|
71
|
+
|
|
72
|
+
See [API README](docs/api/README.md)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
# Contributing
|
|
77
|
+
|
|
78
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
79
|
+
|
|
80
|
+
# License
|
|
81
|
+
|
|
82
|
+
This library is licensed under the [MIT License](LICENSE.md).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
This project takes security seriously. Report any vulnerability or security issue regarding the library to *ronokoffjsd@gmail.com*. **Please do not open a public issue!**
|
|
4
|
+
|
|
5
|
+
### The report should include:
|
|
6
|
+
- A clear and detailed description of the issue
|
|
7
|
+
- Steps to reproduce
|
|
8
|
+
- Any PoC or sample files (if applicable)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Supported Versions
|
|
13
|
+
|
|
14
|
+
Always consider the [latest version](https://github.com/Ronokof/Henkan/releases/latest) as the **only** supported version.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
By using this project you agree to the repository's [LICENSE.md](LICENSE.md).
|