henkan 0.8.0 → 0.9.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/README.md +1 -1
- package/dist/index.cjs.js +8 -25
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +10 -25
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts +8 -11
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/capitalizeString.md +1 -1
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertKanjiDic.md +1 -1
- package/docs/api/functions/convertKradFile.md +1 -1
- package/docs/api/functions/convertRadkFile.md +1 -1
- package/docs/api/functions/convertTanakaCorpus.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +1 -1
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getWord.md +1 -1
- package/docs/api/functions/isStringArray.md +1 -1
- package/docs/api/functions/isValidArray.md +1 -1
- package/docs/api/functions/isValidArrayWithFirstElement.md +1 -1
- package/docs/api/functions/shuffleArray.md +1 -1
- package/docs/api/functions/synthesizeSpeech.md +13 -25
- package/docs/api/interfaces/DictKanji.md +5 -5
- package/docs/api/interfaces/DictKanjiForm.md +4 -4
- package/docs/api/interfaces/DictKanjiMisc.md +5 -5
- package/docs/api/interfaces/DictKanjiReading.md +3 -3
- package/docs/api/interfaces/DictKanjiReadingMeaning.md +3 -3
- package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +3 -3
- package/docs/api/interfaces/DictKanjiWithRadicals.md +3 -3
- package/docs/api/interfaces/DictMeaning.md +11 -11
- package/docs/api/interfaces/DictRadical.md +4 -4
- package/docs/api/interfaces/DictReading.md +5 -5
- package/docs/api/interfaces/DictWord.md +8 -8
- package/docs/api/interfaces/ExamplePart.md +7 -7
- package/docs/api/interfaces/GlossSpecificNumber.md +3 -3
- package/docs/api/interfaces/Grammar.md +15 -15
- package/docs/api/interfaces/GrammarMeaning.md +3 -3
- package/docs/api/interfaces/Kana.md +11 -11
- package/docs/api/interfaces/Kanji.md +22 -22
- package/docs/api/interfaces/KanjiComponent.md +3 -3
- package/docs/api/interfaces/KanjiForm.md +4 -4
- package/docs/api/interfaces/NoteAndTag.md +3 -3
- package/docs/api/interfaces/Phrase.md +5 -5
- package/docs/api/interfaces/Radical.md +16 -16
- package/docs/api/interfaces/Reading.md +5 -5
- package/docs/api/interfaces/ResultEntry.md +7 -7
- package/docs/api/interfaces/TanakaExample.md +7 -7
- package/docs/api/interfaces/Translation.md +3 -3
- package/docs/api/interfaces/UsefulRegExps.md +8 -8
- package/docs/api/interfaces/Word.md +14 -14
- package/docs/api/type-aliases/Dict.md +1 -1
- package/docs/api/type-aliases/DictName.md +1 -1
- package/docs/api/type-aliases/EntryType.md +1 -1
- package/docs/api/type-aliases/JLPT.md +1 -1
- package/docs/api/type-aliases/Result.md +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ pnpm add henkan
|
|
|
36
36
|
- JMdict, KANJIDIC, Tanaka Corpus, RADK and KRAD conversion
|
|
37
37
|
- User-friendly schemas for dictionary entries
|
|
38
38
|
- Anki note generation
|
|
39
|
-
- Other useful tools (
|
|
39
|
+
- Other useful tools (Amazon Polly audio generation, Japanese RegExps, array checking etc.)
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1134,7 +1134,7 @@ var noteMap = /* @__PURE__ */ new Map([
|
|
|
1134
1134
|
var import_libxmljs2 = __toESM(require("libxmljs2"));
|
|
1135
1135
|
var import_xml2js = __toESM(require("xml2js"));
|
|
1136
1136
|
var import_iconv_lite = __toESM(require("iconv-lite"));
|
|
1137
|
-
var
|
|
1137
|
+
var import_client_polly = require("@aws-sdk/client-polly");
|
|
1138
1138
|
var Kuroshiro = require("kuroshiro");
|
|
1139
1139
|
var KuromojiAnalyzer = require("kuroshiro-analyzer-kuromoji");
|
|
1140
1140
|
function capitalizeString(value) {
|
|
@@ -2002,34 +2002,17 @@ function getKanjiExtended(kanjiChar, info, dict, useJpdbWords, jmDict, svgList,
|
|
|
2002
2002
|
throw err;
|
|
2003
2003
|
}
|
|
2004
2004
|
}
|
|
2005
|
-
async function synthesizeSpeech(
|
|
2005
|
+
async function synthesizeSpeech(client, input, options) {
|
|
2006
2006
|
return await new Promise(
|
|
2007
2007
|
async (resolve, reject) => {
|
|
2008
2008
|
try {
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
text: textOrSSML,
|
|
2013
|
-
...options
|
|
2014
|
-
}),
|
|
2015
|
-
headers: {
|
|
2016
|
-
"Content-Type": "application/json",
|
|
2017
|
-
apikey: apiKey
|
|
2018
|
-
}
|
|
2009
|
+
const command = new import_client_polly.SynthesizeSpeechCommand({
|
|
2010
|
+
Text: input,
|
|
2011
|
+
...options
|
|
2019
2012
|
});
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
${res.status}: ${res.statusText}`
|
|
2024
|
-
);
|
|
2025
|
-
const data = await res.json();
|
|
2026
|
-
if (data.status !== "success" || data.mess !== "success" || data.audioData.length === 0)
|
|
2027
|
-
throw new Error("Invalid TTS response data");
|
|
2028
|
-
const mp3Buffer = Buffer.from(
|
|
2029
|
-
data.audioData,
|
|
2030
|
-
"base64"
|
|
2031
|
-
);
|
|
2032
|
-
resolve(mp3Buffer);
|
|
2013
|
+
const response = await client.send(command);
|
|
2014
|
+
const stream = response.AudioStream ? Buffer.from(await response.AudioStream.transformToByteArray()) : null;
|
|
2015
|
+
resolve(stream);
|
|
2033
2016
|
} catch (err) {
|
|
2034
2017
|
reject(err);
|
|
2035
2018
|
}
|