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/dist/index.mjs
CHANGED
|
@@ -1082,7 +1082,9 @@ var noteMap = /* @__PURE__ */ new Map([
|
|
|
1082
1082
|
import libxml from "libxmljs2";
|
|
1083
1083
|
import xml from "xml2js";
|
|
1084
1084
|
import iconv from "iconv-lite";
|
|
1085
|
-
import
|
|
1085
|
+
import {
|
|
1086
|
+
SynthesizeSpeechCommand
|
|
1087
|
+
} from "@aws-sdk/client-polly";
|
|
1086
1088
|
var Kuroshiro = __require("kuroshiro");
|
|
1087
1089
|
var KuromojiAnalyzer = __require("kuroshiro-analyzer-kuromoji");
|
|
1088
1090
|
function capitalizeString(value) {
|
|
@@ -1945,34 +1947,17 @@ function getKanjiExtended(kanjiChar, info, dict, useJpdbWords, jmDict, svgList,
|
|
|
1945
1947
|
throw err;
|
|
1946
1948
|
}
|
|
1947
1949
|
}
|
|
1948
|
-
async function synthesizeSpeech(
|
|
1950
|
+
async function synthesizeSpeech(client, input, options) {
|
|
1949
1951
|
return await new Promise(
|
|
1950
1952
|
async (resolve, reject) => {
|
|
1951
1953
|
try {
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
text: textOrSSML,
|
|
1956
|
-
...options
|
|
1957
|
-
}),
|
|
1958
|
-
headers: {
|
|
1959
|
-
"Content-Type": "application/json",
|
|
1960
|
-
apikey: apiKey
|
|
1961
|
-
}
|
|
1954
|
+
const command = new SynthesizeSpeechCommand({
|
|
1955
|
+
Text: input,
|
|
1956
|
+
...options
|
|
1962
1957
|
});
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
${res.status}: ${res.statusText}`
|
|
1967
|
-
);
|
|
1968
|
-
const data = await res.json();
|
|
1969
|
-
if (data.status !== "success" || data.mess !== "success" || data.audioData.length === 0)
|
|
1970
|
-
throw new Error("Invalid TTS response data");
|
|
1971
|
-
const mp3Buffer = Buffer.from(
|
|
1972
|
-
data.audioData,
|
|
1973
|
-
"base64"
|
|
1974
|
-
);
|
|
1975
|
-
resolve(mp3Buffer);
|
|
1958
|
+
const response = await client.send(command);
|
|
1959
|
+
const stream = response.AudioStream ? Buffer.from(await response.AudioStream.transformToByteArray()) : null;
|
|
1960
|
+
resolve(stream);
|
|
1976
1961
|
} catch (err) {
|
|
1977
1962
|
reject(err);
|
|
1978
1963
|
}
|