@storyteller-platform/align 0.1.56 → 0.1.58
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/dist/align/align.cjs +38 -19
- package/dist/align/align.d.cts +12 -1
- package/dist/align/align.d.ts +12 -1
- package/dist/align/align.js +38 -19
- package/dist/align/ctc/Aligner.cjs +800 -0
- package/dist/align/ctc/Aligner.d.cts +56 -0
- package/dist/align/ctc/Aligner.d.ts +56 -0
- package/dist/align/ctc/Aligner.js +789 -0
- package/dist/align/ctc/align.cjs +189 -0
- package/dist/align/ctc/align.d.cts +14 -0
- package/dist/align/ctc/align.d.ts +14 -0
- package/dist/align/ctc/align.js +132 -0
- package/dist/{process/mime.cjs → align/ctc/emissions.cjs} +7 -20
- package/dist/align/ctc/emissions.d.cts +6 -0
- package/dist/align/ctc/emissions.d.ts +6 -0
- package/dist/align/ctc/emissions.js +7 -0
- package/dist/align/ctc/forcedAlign.cjs +273 -0
- package/dist/align/ctc/forcedAlign.d.cts +21 -0
- package/dist/align/ctc/forcedAlign.d.ts +21 -0
- package/dist/align/ctc/forcedAlign.js +248 -0
- package/dist/align/ctc/greedyDecode.cjs +61 -0
- package/dist/align/ctc/greedyDecode.d.cts +15 -0
- package/dist/align/ctc/greedyDecode.d.ts +15 -0
- package/dist/align/ctc/greedyDecode.js +37 -0
- package/dist/align/ctc/mediaOverlay.cjs +248 -0
- package/dist/align/ctc/mediaOverlay.d.cts +16 -0
- package/dist/align/ctc/mediaOverlay.d.ts +16 -0
- package/dist/align/ctc/mediaOverlay.js +224 -0
- package/dist/align/ctc/report.cjs +66 -0
- package/dist/align/ctc/report.d.cts +79 -0
- package/dist/align/ctc/report.d.ts +79 -0
- package/dist/align/ctc/report.js +42 -0
- package/dist/align/ctc/search.cjs +437 -0
- package/dist/align/ctc/search.d.cts +46 -0
- package/dist/align/ctc/search.d.ts +46 -0
- package/dist/align/ctc/search.js +412 -0
- package/dist/align/getSentenceRanges.cjs +9 -3
- package/dist/align/getSentenceRanges.d.cts +1 -0
- package/dist/align/getSentenceRanges.d.ts +1 -0
- package/dist/align/getSentenceRanges.js +9 -3
- package/dist/align/parse.cjs +17 -4
- package/dist/align/parse.d.cts +8 -4
- package/dist/align/parse.d.ts +8 -4
- package/dist/align/parse.js +19 -4
- package/dist/align/search.cjs +76 -23
- package/dist/align/search.d.cts +8 -4
- package/dist/align/search.d.ts +8 -4
- package/dist/align/search.js +76 -24
- package/dist/align/slugify.cjs +3 -2
- package/dist/align/slugify.d.cts +1 -1
- package/dist/align/slugify.d.ts +1 -1
- package/dist/align/slugify.js +3 -2
- package/dist/cli/bin.cjs +204 -114
- package/dist/cli/bin.js +194 -103
- package/dist/common/ffmpeg.cjs +10 -5
- package/dist/common/ffmpeg.js +10 -5
- package/dist/common/logging.cjs +33 -1
- package/dist/common/logging.js +33 -1
- package/dist/emit/emit.cjs +105 -0
- package/dist/emit/emit.d.cts +15 -0
- package/dist/emit/emit.d.ts +15 -0
- package/dist/emit/emit.js +86 -0
- package/dist/emit/fs.cjs +227 -0
- package/dist/emit/fs.d.cts +22 -0
- package/dist/emit/fs.d.ts +22 -0
- package/dist/emit/fs.js +162 -0
- package/dist/emit/parse.cjs +68 -0
- package/dist/emit/parse.d.cts +26 -0
- package/dist/emit/parse.d.ts +26 -0
- package/dist/emit/parse.js +58 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/markup/model.cjs +0 -16
- package/dist/markup/model.d.cts +1 -1
- package/dist/markup/model.d.ts +1 -1
- package/dist/markup/model.js +0 -12
- package/dist/markup/parseDom.cjs +13 -14
- package/dist/markup/parseDom.d.cts +2 -2
- package/dist/markup/parseDom.d.ts +2 -2
- package/dist/markup/parseDom.js +13 -18
- package/dist/markup/resolvedPos.d.cts +1 -1
- package/dist/markup/resolvedPos.d.ts +1 -1
- package/dist/markup/segmentation.cjs +3 -1
- package/dist/markup/segmentation.js +3 -1
- package/dist/markup/serializeDom.cjs +1 -1
- package/dist/markup/serializeDom.d.cts +1 -1
- package/dist/markup/serializeDom.d.ts +1 -1
- package/dist/markup/serializeDom.js +1 -1
- package/dist/markup/transform.cjs +5 -2
- package/dist/markup/transform.d.cts +1 -1
- package/dist/markup/transform.d.ts +1 -1
- package/dist/markup/transform.js +5 -4
- package/dist/{model-CZ2mMHJO.d.cts → model-CeOMDDgt.d.cts} +3 -11
- package/dist/{model-CZ2mMHJO.d.ts → model-CeOMDDgt.d.ts} +3 -11
- package/dist/process/processAudiobook.cjs +12 -23
- package/dist/process/processAudiobook.js +14 -30
- package/dist/process/ranges.cjs +2 -2
- package/dist/process/ranges.js +2 -2
- package/dist/readium/guidedNavigation.cjs +8 -8
- package/dist/readium/guidedNavigation.js +8 -8
- package/dist/readium/manifest.cjs +5 -4
- package/dist/readium/manifest.js +5 -4
- package/dist/snapshot/ctc/snapshot.cjs +261 -0
- package/dist/snapshot/ctc/snapshot.d.cts +6 -0
- package/dist/snapshot/ctc/snapshot.d.ts +6 -0
- package/dist/snapshot/ctc/snapshot.js +200 -0
- package/dist/snapshot/parse.cjs +29 -16
- package/dist/snapshot/parse.d.cts +14 -10
- package/dist/snapshot/parse.d.ts +14 -10
- package/dist/snapshot/parse.js +32 -17
- package/dist/transcribe/parse.d.cts +6 -6
- package/dist/transcribe/parse.d.ts +6 -6
- package/dist/transcribe/transcribe.cjs +4 -2
- package/dist/transcribe/transcribe.js +4 -2
- package/package.json +6 -4
- package/dist/process/mime.d.cts +0 -3
- package/dist/process/mime.d.ts +0 -3
- package/dist/process/mime.js +0 -24
|
@@ -2,10 +2,10 @@ import * as _optique_core from '@optique/core';
|
|
|
2
2
|
|
|
3
3
|
declare const transcribeParser: _optique_core.Parser<"sync", {
|
|
4
4
|
readonly engine: "whisper.cpp";
|
|
5
|
-
readonly model: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
5
|
+
readonly model: "small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0";
|
|
6
6
|
readonly threads: number;
|
|
7
7
|
readonly processors: number;
|
|
8
|
-
readonly cpuOverride: "
|
|
8
|
+
readonly cpuOverride: "cpu" | "blas" | undefined;
|
|
9
9
|
} | {
|
|
10
10
|
readonly engine: "whisper-server";
|
|
11
11
|
readonly whisperServerUrl: string;
|
|
@@ -34,10 +34,10 @@ declare const transcribeParser: _optique_core.Parser<"sync", {
|
|
|
34
34
|
readonly deepgramModel: string;
|
|
35
35
|
}, [0, _optique_core.ParserResult<{
|
|
36
36
|
readonly engine: _optique_core.ValueParserResult<"whisper.cpp"> | undefined;
|
|
37
|
-
readonly model: [_optique_core.ValueParserResult<"tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
37
|
+
readonly model: [_optique_core.ValueParserResult<"small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0"> | undefined] | undefined;
|
|
38
38
|
readonly threads: [_optique_core.ValueParserResult<number> | undefined] | undefined;
|
|
39
39
|
readonly processors: [_optique_core.ValueParserResult<number> | undefined] | undefined;
|
|
40
|
-
readonly cpuOverride: [_optique_core.ValueParserResult<"
|
|
40
|
+
readonly cpuOverride: [_optique_core.ValueParserResult<"cpu" | "blas"> | undefined] | undefined;
|
|
41
41
|
}>] | [1, _optique_core.ParserResult<{
|
|
42
42
|
readonly engine: _optique_core.ValueParserResult<"whisper-server"> | undefined;
|
|
43
43
|
readonly whisperServerUrl: _optique_core.ValueParserResult<URL> | undefined;
|
|
@@ -75,10 +75,10 @@ declare const transcribeCommand: _optique_core.Parser<"sync", {
|
|
|
75
75
|
readonly language: Intl.Locale | undefined;
|
|
76
76
|
} & (({
|
|
77
77
|
readonly engine: "whisper.cpp";
|
|
78
|
-
readonly model: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
78
|
+
readonly model: "small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0";
|
|
79
79
|
readonly threads: number;
|
|
80
80
|
readonly processors: number;
|
|
81
|
-
readonly cpuOverride: "
|
|
81
|
+
readonly cpuOverride: "cpu" | "blas" | undefined;
|
|
82
82
|
} | {
|
|
83
83
|
readonly engine: "whisper-server";
|
|
84
84
|
readonly whisperServerUrl: string;
|
|
@@ -2,10 +2,10 @@ import * as _optique_core from '@optique/core';
|
|
|
2
2
|
|
|
3
3
|
declare const transcribeParser: _optique_core.Parser<"sync", {
|
|
4
4
|
readonly engine: "whisper.cpp";
|
|
5
|
-
readonly model: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
5
|
+
readonly model: "small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0";
|
|
6
6
|
readonly threads: number;
|
|
7
7
|
readonly processors: number;
|
|
8
|
-
readonly cpuOverride: "
|
|
8
|
+
readonly cpuOverride: "cpu" | "blas" | undefined;
|
|
9
9
|
} | {
|
|
10
10
|
readonly engine: "whisper-server";
|
|
11
11
|
readonly whisperServerUrl: string;
|
|
@@ -34,10 +34,10 @@ declare const transcribeParser: _optique_core.Parser<"sync", {
|
|
|
34
34
|
readonly deepgramModel: string;
|
|
35
35
|
}, [0, _optique_core.ParserResult<{
|
|
36
36
|
readonly engine: _optique_core.ValueParserResult<"whisper.cpp"> | undefined;
|
|
37
|
-
readonly model: [_optique_core.ValueParserResult<"tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
37
|
+
readonly model: [_optique_core.ValueParserResult<"small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0"> | undefined] | undefined;
|
|
38
38
|
readonly threads: [_optique_core.ValueParserResult<number> | undefined] | undefined;
|
|
39
39
|
readonly processors: [_optique_core.ValueParserResult<number> | undefined] | undefined;
|
|
40
|
-
readonly cpuOverride: [_optique_core.ValueParserResult<"
|
|
40
|
+
readonly cpuOverride: [_optique_core.ValueParserResult<"cpu" | "blas"> | undefined] | undefined;
|
|
41
41
|
}>] | [1, _optique_core.ParserResult<{
|
|
42
42
|
readonly engine: _optique_core.ValueParserResult<"whisper-server"> | undefined;
|
|
43
43
|
readonly whisperServerUrl: _optique_core.ValueParserResult<URL> | undefined;
|
|
@@ -75,10 +75,10 @@ declare const transcribeCommand: _optique_core.Parser<"sync", {
|
|
|
75
75
|
readonly language: Intl.Locale | undefined;
|
|
76
76
|
} & (({
|
|
77
77
|
readonly engine: "whisper.cpp";
|
|
78
|
-
readonly model: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small
|
|
78
|
+
readonly model: "small" | "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0";
|
|
79
79
|
readonly threads: number;
|
|
80
80
|
readonly processors: number;
|
|
81
|
-
readonly cpuOverride: "
|
|
81
|
+
readonly cpuOverride: "cpu" | "blas" | undefined;
|
|
82
82
|
} | {
|
|
83
83
|
readonly engine: "whisper-server";
|
|
84
84
|
readonly whisperServerUrl: string;
|
|
@@ -81,8 +81,8 @@ var import_promises = require("node:fs/promises");
|
|
|
81
81
|
var os = __toESM(require("node:os"), 1);
|
|
82
82
|
var import_node_path = require("node:path");
|
|
83
83
|
var import_async_semaphore = require("@esfx/async-semaphore");
|
|
84
|
-
var import_audiobook = require("@storyteller-platform/audiobook");
|
|
85
84
|
var import_ghost_story = require("@storyteller-platform/ghost-story");
|
|
85
|
+
var import_media_types = require("@storyteller-platform/media-types");
|
|
86
86
|
async function transcribe(input, output, locale, options) {
|
|
87
87
|
const semaphore = new import_async_semaphore.AsyncSemaphore(options.parallelism ?? 1);
|
|
88
88
|
const controller = new AbortController();
|
|
@@ -92,7 +92,9 @@ async function transcribe(input, output, locale, options) {
|
|
|
92
92
|
]);
|
|
93
93
|
await (0, import_promises.mkdir)(output, { recursive: true });
|
|
94
94
|
const allFiles = await (0, import_promises.readdir)(input, { recursive: true });
|
|
95
|
-
const filenames = allFiles.filter(
|
|
95
|
+
const filenames = allFiles.filter(
|
|
96
|
+
(f) => import_media_types.MediaType.fromPath(f)?.kind === "audio"
|
|
97
|
+
);
|
|
96
98
|
if (!filenames.length) {
|
|
97
99
|
throw new Error(
|
|
98
100
|
`Failed to transcribe audio: found no audio files in ${input}`
|
|
@@ -6,7 +6,6 @@ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
import { basename, extname, join, resolve } from "node:path";
|
|
8
8
|
import { AsyncSemaphore } from "@esfx/async-semaphore";
|
|
9
|
-
import { isAudioFile } from "@storyteller-platform/audiobook";
|
|
10
9
|
import {
|
|
11
10
|
applyLegacyCpuFallback,
|
|
12
11
|
createAggregator,
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
formatSingleReport,
|
|
15
14
|
recognize
|
|
16
15
|
} from "@storyteller-platform/ghost-story";
|
|
16
|
+
import { MediaType } from "@storyteller-platform/media-types";
|
|
17
17
|
async function transcribe(input, output, locale, options) {
|
|
18
18
|
const semaphore = new AsyncSemaphore(options.parallelism ?? 1);
|
|
19
19
|
const controller = new AbortController();
|
|
@@ -23,7 +23,9 @@ async function transcribe(input, output, locale, options) {
|
|
|
23
23
|
]);
|
|
24
24
|
await mkdir(output, { recursive: true });
|
|
25
25
|
const allFiles = await readdir(input, { recursive: true });
|
|
26
|
-
const filenames = allFiles.filter(
|
|
26
|
+
const filenames = allFiles.filter(
|
|
27
|
+
(f) => MediaType.fromPath(f)?.kind === "audio"
|
|
28
|
+
);
|
|
27
29
|
if (!filenames.length) {
|
|
28
30
|
throw new Error(
|
|
29
31
|
`Failed to transcribe audio: found no audio files in ${input}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyteller-platform/align",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58",
|
|
4
4
|
"description": "A library and CLI for automatically aligning audiobooks and EPUBs to produce Media Overlays",
|
|
5
5
|
"author": "Shane Friedman",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,10 +70,12 @@
|
|
|
70
70
|
"@optique/core": "^0.10.7",
|
|
71
71
|
"@optique/run": "^0.10.7",
|
|
72
72
|
"@readium/shared": "^2.2.0",
|
|
73
|
-
"@storyteller-platform/audiobook": "^0.5.
|
|
74
|
-
"@storyteller-platform/epub": "^0.7.
|
|
75
|
-
"@storyteller-platform/
|
|
73
|
+
"@storyteller-platform/audiobook": "^0.5.1",
|
|
74
|
+
"@storyteller-platform/epub": "^0.7.1",
|
|
75
|
+
"@storyteller-platform/fs": "^0.2.0",
|
|
76
|
+
"@storyteller-platform/ghost-story": "^0.1.15",
|
|
76
77
|
"@storyteller-platform/mapping": "0.1.3",
|
|
78
|
+
"@storyteller-platform/media-types": "^0.1.0",
|
|
77
79
|
"@storyteller-platform/transliteration": "^4.0.6",
|
|
78
80
|
"chalk": "^5.4.1",
|
|
79
81
|
"change-case": "^5.4.4",
|
package/dist/process/mime.d.cts
DELETED
package/dist/process/mime.d.ts
DELETED
package/dist/process/mime.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "../chunk-BIEQXUOY.js";
|
|
2
|
-
import {
|
|
3
|
-
MP3_FILE_EXTENSIONS,
|
|
4
|
-
MPEG4_FILE_EXTENSIONS,
|
|
5
|
-
OPUS_FILE_EXTENSIONS
|
|
6
|
-
} from "@storyteller-platform/audiobook";
|
|
7
|
-
function areSameType(filepathA, filepathB) {
|
|
8
|
-
if (filepathA === filepathB) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (MPEG4_FILE_EXTENSIONS.some((ext) => filepathA.endsWith(ext)) && MPEG4_FILE_EXTENSIONS.some((ext) => filepathB.endsWith(ext))) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
if (MP3_FILE_EXTENSIONS.some((ext) => filepathA.endsWith(ext)) && MP3_FILE_EXTENSIONS.some((ext) => filepathB.endsWith(ext))) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
if (OPUS_FILE_EXTENSIONS.some((ext) => filepathA.endsWith(ext)) && OPUS_FILE_EXTENSIONS.some((ext) => filepathB.endsWith(ext))) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
areSameType
|
|
24
|
-
};
|