henkan 1.1.2 → 2.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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs.js +1047 -1115
  3. package/dist/index.cjs.js.map +3 -3
  4. package/dist/index.mjs +1042 -1113
  5. package/dist/index.mjs.map +3 -3
  6. package/dist/types/constants.d.ts +3 -2
  7. package/dist/types/constants.d.ts.map +1 -1
  8. package/dist/types/types.d.ts +74 -15
  9. package/dist/types/types.d.ts.map +1 -1
  10. package/dist/types/utils.d.ts +49 -40
  11. package/dist/types/utils.d.ts.map +1 -1
  12. package/docs/api/README.md +6 -2
  13. package/docs/api/functions/capitalizeString.md +1 -1
  14. package/docs/api/functions/convertJMdict.md +2 -2
  15. package/docs/api/functions/convertJawiktionaryAsync.md +29 -0
  16. package/docs/api/functions/convertJawiktionarySync.md +29 -0
  17. package/docs/api/functions/convertKanjiDic.md +1 -1
  18. package/docs/api/functions/convertKradFile.md +3 -3
  19. package/docs/api/functions/convertRadkFile.md +2 -2
  20. package/docs/api/functions/convertTanakaCorpus.md +3 -9
  21. package/docs/api/functions/convertTanakaCorpusWithFurigana.md +27 -0
  22. package/docs/api/functions/generateAnkiNote.md +1 -1
  23. package/docs/api/functions/generateAnkiNotesFile.md +9 -3
  24. package/docs/api/functions/getKanji.md +13 -19
  25. package/docs/api/functions/getKanjiExtended.md +18 -18
  26. package/docs/api/functions/getWord.md +17 -23
  27. package/docs/api/functions/getWordDefinitions.md +6 -12
  28. package/docs/api/functions/getWordDefinitionsWithFurigana.md +33 -0
  29. package/docs/api/functions/isStringArray.md +1 -1
  30. package/docs/api/functions/isValidArray.md +1 -1
  31. package/docs/api/functions/isValidArrayWithFirstElement.md +1 -1
  32. package/docs/api/functions/shuffleArray.md +2 -2
  33. package/docs/api/interfaces/DefaultNoteInfo.md +51 -0
  34. package/docs/api/interfaces/DictKanjiMisc.md +2 -2
  35. package/docs/api/interfaces/DictKanjiReadingMeaning.md +2 -2
  36. package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +4 -4
  37. package/docs/api/interfaces/DictKanjiWithRadicals.md +2 -2
  38. package/docs/api/interfaces/DictWord.md +1 -1
  39. package/docs/api/interfaces/Grammar.md +2 -2
  40. package/docs/api/interfaces/Kana.md +2 -2
  41. package/docs/api/interfaces/Kanji.md +12 -12
  42. package/docs/api/interfaces/NoteAndTag.md +2 -2
  43. package/docs/api/interfaces/NoteHeaderKeys.md +75 -0
  44. package/docs/api/interfaces/Radical.md +5 -5
  45. package/docs/api/interfaces/ResultEntry.md +2 -2
  46. package/docs/api/interfaces/TanakaExample.md +1 -1
  47. package/docs/api/interfaces/UsefulRegExps.md +8 -8
  48. package/docs/api/interfaces/Word.md +2 -2
  49. package/package.json +11 -12
  50. package/docs/api/functions/convertJawiktionary.md +0 -29
  51. package/docs/api/functions/synthesizeSpeech.md +0 -39
@@ -0,0 +1,75 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / NoteHeaderKeys
6
+
7
+ # Interface: NoteHeaderKeys
8
+
9
+ Defined in: [types.ts:905](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L905)
10
+
11
+ Anki note file headers keys
12
+
13
+ ## See
14
+
15
+ [https://docs.ankiweb.net/importing/text-files.html#file-headers](https://docs.ankiweb.net/importing/text-files.html#file-headers)
16
+
17
+ ## Properties
18
+
19
+ ### deck
20
+
21
+ > `readonly` **deck**: `` `${string}:` ``
22
+
23
+ Defined in: [types.ts:925](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L925)
24
+
25
+ Deck name column header
26
+
27
+ ***
28
+
29
+ ### guid
30
+
31
+ > `readonly` **guid**: `` `${string}:` ``
32
+
33
+ Defined in: [types.ts:917](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L917)
34
+
35
+ GUID column header
36
+
37
+ ***
38
+
39
+ ### html
40
+
41
+ > `readonly` **html**: `` `${string}:false` `` \| `` `${string}:true` ``
42
+
43
+ Defined in: [types.ts:913](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L913)
44
+
45
+ HTML treatment
46
+
47
+ ***
48
+
49
+ ### notetype
50
+
51
+ > `readonly` **notetype**: `` `${string}:` ``
52
+
53
+ Defined in: [types.ts:921](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L921)
54
+
55
+ Note type column header
56
+
57
+ ***
58
+
59
+ ### separator
60
+
61
+ > `readonly` **separator**: `` `${string}:${string}` ``
62
+
63
+ Defined in: [types.ts:909](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L909)
64
+
65
+ Field separator
66
+
67
+ ***
68
+
69
+ ### tags
70
+
71
+ > `readonly` **tags**: `` `${string}:` ``
72
+
73
+ Defined in: [types.ts:929](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L929)
74
+
75
+ Tags column header (*must be completed with a number after `:`*)
@@ -44,19 +44,19 @@ Whether or not this entry should be converted into an Anki note
44
44
 
45
45
  ***
46
46
 
47
- ### fromJpdb?
47
+ ### externalInfo?
48
48
 
49
- > `optional` **fromJpdb**: `true`
49
+ > `optional` **externalInfo**: `true`
50
50
 
51
51
  Defined in: [types.ts:725](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L725)
52
52
 
53
- Whether or not this radical/component object contains information **only** from `jpdb.io`
53
+ Whether or not this radical/component object contains information extracted from [sources](#sources)
54
54
 
55
55
  ***
56
56
 
57
57
  ### id?
58
58
 
59
- > `readonly` `optional` **id**: `string`
59
+ > `optional` **id**: `` `${number}` ``
60
60
 
61
61
  Defined in: [types.ts:507](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L507)
62
62
 
@@ -100,7 +100,7 @@ The radical/component mnemonic
100
100
 
101
101
  ### noteID?
102
102
 
103
- > `readonly` `optional` **noteID**: `` `radical_${string}` ``
103
+ > `optional` **noteID**: `string`
104
104
 
105
105
  Defined in: [types.ts:503](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L503)
106
106
 
@@ -48,7 +48,7 @@ Whether or not this entry should be converted into an Anki note
48
48
 
49
49
  ### id?
50
50
 
51
- > `readonly` `optional` **id**: `string`
51
+ > `optional` **id**: `` `${number}` ``
52
52
 
53
53
  Defined in: [types.ts:507](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L507)
54
54
 
@@ -58,7 +58,7 @@ ID used for the Anki note ID
58
58
 
59
59
  ### noteID?
60
60
 
61
- > `readonly` `optional` **noteID**: `` `${EntryType}_${string}` ``
61
+ > `optional` **noteID**: `string`
62
62
 
63
63
  Defined in: [types.ts:503](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L503)
64
64
 
@@ -14,7 +14,7 @@ Tanaka Corpus `examples.utf` examples
14
14
 
15
15
  ### furigana?
16
16
 
17
- > `readonly` `optional` **furigana**: `string`
17
+ > `optional` **furigana**: `string`
18
18
 
19
19
  Defined in: [types.ts:414](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L414)
20
20
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: UsefulRegExps
8
8
 
9
- Defined in: [types.ts:874](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L874)
9
+ Defined in: [types.ts:935](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L935)
10
10
 
11
11
  Some useful regular expressions
12
12
 
@@ -16,7 +16,7 @@ Some useful regular expressions
16
16
 
17
17
  > `readonly` **hiragana**: `RegExp`
18
18
 
19
- Defined in: [types.ts:878](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L878)
19
+ Defined in: [types.ts:939](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L939)
20
20
 
21
21
  Matches any *hiragana* character(s)
22
22
 
@@ -26,7 +26,7 @@ Matches any *hiragana* character(s)
26
26
 
27
27
  > `readonly` **kanji**: `RegExp`
28
28
 
29
- Defined in: [types.ts:886](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L886)
29
+ Defined in: [types.ts:947](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L947)
30
30
 
31
31
  Matches any *kanji* character(s)
32
32
 
@@ -36,7 +36,7 @@ Matches any *kanji* character(s)
36
36
 
37
37
  > `readonly` **katakana**: `RegExp`
38
38
 
39
- Defined in: [types.ts:882](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L882)
39
+ Defined in: [types.ts:943](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L943)
40
40
 
41
41
  Matches any *katakana* character(s)
42
42
 
@@ -46,7 +46,7 @@ Matches any *katakana* character(s)
46
46
 
47
47
  > `readonly` **regExChars**: `RegExp`
48
48
 
49
- Defined in: [types.ts:890](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L890)
49
+ Defined in: [types.ts:951](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L951)
50
50
 
51
51
  Matches any character that is part of the regex syntax
52
52
 
@@ -56,7 +56,7 @@ Matches any character that is part of the regex syntax
56
56
 
57
57
  > `readonly` **tanakaID**: `RegExp`
58
58
 
59
- Defined in: [types.ts:894](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L894)
59
+ Defined in: [types.ts:955](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L955)
60
60
 
61
61
  Matches the `#ID=` part in a Tanaka Corpus `examples.utf` file
62
62
 
@@ -66,7 +66,7 @@ Matches the `#ID=` part in a Tanaka Corpus `examples.utf` file
66
66
 
67
67
  > `readonly` **tanakaPart**: `RegExp`
68
68
 
69
- Defined in: [types.ts:898](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L898)
69
+ Defined in: [types.ts:959](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L959)
70
70
 
71
71
  Matches and splits a part found in the `B` section of a Tanaka Corpus `examples.utf` file
72
72
 
@@ -76,6 +76,6 @@ Matches and splits a part found in the `B` section of a Tanaka Corpus `examples.
76
76
 
77
77
  > `readonly` **tanakaReferenceID**: `RegExp`
78
78
 
79
- Defined in: [types.ts:902](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L902)
79
+ Defined in: [types.ts:963](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L963)
80
80
 
81
81
  Matches the reference ID element of a Tanaka example part
@@ -70,7 +70,7 @@ Whether or not this entry should be converted into an Anki note
70
70
 
71
71
  ### id?
72
72
 
73
- > `readonly` `optional` **id**: `string`
73
+ > `optional` **id**: `` `${number}` ``
74
74
 
75
75
  Defined in: [types.ts:507](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L507)
76
76
 
@@ -104,7 +104,7 @@ The word kanji forms
104
104
 
105
105
  ### noteID?
106
106
 
107
- > `readonly` `optional` **noteID**: `` `word_${string}` ``
107
+ > `optional` **noteID**: `string`
108
108
 
109
109
  Defined in: [types.ts:503](https://github.com/Ronokof/Henkan/blob/main/src/types.ts#L503)
110
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "henkan",
3
- "version": "1.1.2",
3
+ "version": "2.0.0",
4
4
  "description": "A Node.JS library that helps you convert any dictionary from EDRDG, transform their entries into more user-friendly schemas and create Anki notes from them.",
5
5
  "keywords": [
6
6
  "fjsd",
@@ -52,24 +52,24 @@
52
52
  "scripts": {
53
53
  "test": "vitest",
54
54
  "test:watch": "vitest --watch",
55
- "test:coverage": "vitest run --coverage",
56
55
  "test:ci": "vitest run --coverage",
57
56
  "clean": "rimraf dist",
58
57
  "build:types": "tsc -p tsconfig.types.json",
59
58
  "build:cjs": "node ./scripts/build-esbuild.cjs cjs",
60
59
  "build:esm": "node ./scripts/build-esbuild.cjs esm",
61
60
  "build": "npm run clean && npm run build:types && npm run build:esm && npm run build:cjs",
62
- "lint": "eslint 'src/**/*.{ts,tsx}' --fix && eslint 'test/**/*.{ts,tsx}' --fix",
61
+ "lint": "eslint src --ext .ts,.tsx --fix --fix-type problem,suggestion,layout && eslint test --ext .ts,.tsx --fix --fix-type problem,suggestion,layout",
63
62
  "prepare": "npm run lint && npm run build && npm run docs:api",
64
- "docs:api": "typedoc --plugin typedoc-plugin-markdown --out docs/api src/index.ts --readme none --excludePrivate --excludeProtected --excludeNotDocumented --hideGenerator --sourceLinkTemplate \"https://github.com/Ronokof/Henkan/blob/{gitRevision}/{path}#L{line}\" --gitRevision main"
63
+ "docs:api": "typedoc --plugin typedoc-plugin-markdown --out docs/api src/index.ts --readme none --excludePrivate --excludeProtected --excludeNotDocumented --hideGenerator --sourceLinkTemplate \"https://github.com/Ronokof/Henkan/blob/{gitRevision}/{path}#L{line}\" --gitRevision main",
64
+ "sync-node-types": "node ./scripts/sync-node-types.cjs"
65
65
  },
66
66
  "devDependencies": {
67
- "@types/node": "^25.0.1",
67
+ "@types/node": "^24.10.4",
68
68
  "@types/xml2js": "^0.4.14",
69
- "@typescript-eslint/eslint-plugin": "^8.49.0",
70
- "@typescript-eslint/parser": "^8.49.0",
71
- "@vitest/coverage-v8": "^4.0.15",
72
- "esbuild": "^0.27.1",
69
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
70
+ "@typescript-eslint/parser": "^8.50.0",
71
+ "@vitest/coverage-v8": "^4.0.16",
72
+ "esbuild": "^0.27.2",
73
73
  "eslint": "^9.39.2",
74
74
  "eslint-plugin-prettier": "^5.5.4",
75
75
  "prettier": "^3.7.4",
@@ -77,10 +77,9 @@
77
77
  "typedoc": "^0.28.15",
78
78
  "typedoc-plugin-markdown": "^4.9.0",
79
79
  "typescript": "^5.9.3",
80
- "vitest": "^4.0.15"
80
+ "vitest": "^4.0.16"
81
81
  },
82
82
  "dependencies": {
83
- "@aws-sdk/client-polly": "^3.948.0",
84
83
  "fflate": "^0.8.2",
85
84
  "iconv-lite": "^0.7.1",
86
85
  "kuroshiro": "^1.2.0",
@@ -89,6 +88,6 @@
89
88
  "xml2js": "^0.6.2"
90
89
  },
91
90
  "engines": {
92
- "node": ">=22.17.0"
91
+ "node": ">=24.12.0"
93
92
  }
94
93
  }
@@ -1,29 +0,0 @@
1
- [**henkan**](../README.md)
2
-
3
- ***
4
-
5
- [henkan](../README.md) / convertJawiktionary
6
-
7
- # Function: convertJawiktionary()
8
-
9
- > **convertJawiktionary**(`stream`): `Promise`\<`any`[]\>
10
-
11
- Defined in: [utils.ts:781](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L781)
12
-
13
- Converts and filters a `ja.wiktionary.org` JSONL dump
14
-
15
- The dump file needs to be converted from a `jawiktionary-latest-pages-articles.xml.bz2` file from [https://dumps.wikimedia.org/jawiktionary/latest/](https://dumps.wikimedia.org/jawiktionary/latest/) using [wiktextract](https://github.com/tatuylonen/wiktextract).
16
-
17
- ## Parameters
18
-
19
- ### stream
20
-
21
- `ReadStream`
22
-
23
- The stream of a JSONL dump file
24
-
25
- ## Returns
26
-
27
- `Promise`\<`any`[]\>
28
-
29
- An array containing only Japanese entries
@@ -1,39 +0,0 @@
1
- [**henkan**](../README.md)
2
-
3
- ***
4
-
5
- [henkan](../README.md) / synthesizeSpeech
6
-
7
- # Function: synthesizeSpeech()
8
-
9
- > **synthesizeSpeech**(`client`, `input`, `options`): `Promise`\<`Buffer`\<`ArrayBuffer`\> \| `null`\>
10
-
11
- Defined in: [utils.ts:2398](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2398)
12
-
13
- Synthesizes text to speech audio using [Amazon Polly](https://aws.amazon.com/polly/).
14
-
15
- ## Parameters
16
-
17
- ### client
18
-
19
- `PollyClient`
20
-
21
- An Amazon Polly Client instance
22
-
23
- ### input
24
-
25
- `string`
26
-
27
- The input in SSML format or plain text (adjust `TextType` property in `options`)
28
-
29
- ### options
30
-
31
- `Omit`\<`SynthesizeSpeechCommandInput`, `"Text"`\>
32
-
33
- Speech generation settings
34
-
35
- ## Returns
36
-
37
- `Promise`\<`Buffer`\<`ArrayBuffer`\> \| `null`\>
38
-
39
- A promise resolving with an audio stream buffer or with `null` if the generation failed