@readium/speech 0.15.0 → 0.16.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/build/WebSpeech/webSpeechEngine.d.ts +2 -0
- package/build/index.js +930 -859
- package/build/navigator.d.ts +5 -2
- package/build/speechNavigator.d.ts +5 -3
- package/build/utterances/language.d.ts +1 -0
- package/build/utterances/sentenceSegmenter.d.ts +1 -0
- package/build/utterances/types.d.ts +1 -0
- package/build/utterances/walkContext.d.ts +1 -0
- package/package.json +2 -2
package/build/navigator.d.ts
CHANGED
|
@@ -9,10 +9,13 @@ export interface ReadiumSpeechPlaybackEvent {
|
|
|
9
9
|
type: "start" | "pause" | "resume" | "end" | "stop" | "skip" | "error" | "boundary" | "mark" | "idle" | "loading" | "ready" | "voiceschanged" | "languagefallback" | "enginefallback" | "enginerecovered";
|
|
10
10
|
detail?: any;
|
|
11
11
|
}
|
|
12
|
+
export interface ReadiumSpeechContentOptions {
|
|
13
|
+
language?: string;
|
|
14
|
+
}
|
|
12
15
|
export interface ReadiumSpeechNavigatorContract extends Configurable<SpeechSettings, SpeechPreferences> {
|
|
13
16
|
getVoices(): Promise<ReadiumSpeechVoice[]>;
|
|
14
|
-
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[]): void;
|
|
15
|
-
loadGndContent(nodes: GuidedNavigationObject[]): Promise<void>;
|
|
17
|
+
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[], options?: ReadiumSpeechContentOptions): void;
|
|
18
|
+
loadGndContent(nodes: GuidedNavigationObject[], options?: ReadiumSpeechContentOptions): Promise<void>;
|
|
16
19
|
getCurrentContent(): ReadiumSpeechUtterance | null;
|
|
17
20
|
getContentQueue(): ReadiumSpeechUtterance[];
|
|
18
21
|
play(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReadiumSpeechPlaybackEngine } from './engine.js';
|
|
2
2
|
import { GuidedNavigationObject } from '@readium/shared';
|
|
3
|
-
import { ReadiumSpeechNavigatorContract, ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from './navigator.js';
|
|
3
|
+
import { ReadiumSpeechContentOptions, ReadiumSpeechNavigatorContract, ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from './navigator.js';
|
|
4
4
|
import { ISpeechDefaults } from './preferences/SpeechDefaults.js';
|
|
5
5
|
import { ISpeechPreferences, SpeechPreferences } from './preferences/SpeechPreferences.js';
|
|
6
6
|
import { SpeechPreferencesEditor } from './preferences/SpeechPreferencesEditor.js';
|
|
@@ -40,6 +40,7 @@ export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorCon
|
|
|
40
40
|
private readonly contextualizationOverrides?;
|
|
41
41
|
private readonly segmentationOverrides?;
|
|
42
42
|
private source;
|
|
43
|
+
private contentLanguage;
|
|
43
44
|
private contentSources;
|
|
44
45
|
private contentBlockStarts;
|
|
45
46
|
private pendingResumeIndex;
|
|
@@ -51,9 +52,10 @@ export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorCon
|
|
|
51
52
|
private setupEngineListeners;
|
|
52
53
|
private setNavigatorState;
|
|
53
54
|
getVoices(): Promise<ReadiumSpeechVoice[]>;
|
|
54
|
-
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[]): void;
|
|
55
|
-
loadGndContent(nodes: GuidedNavigationObject[]): Promise<void>;
|
|
55
|
+
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[], options?: ReadiumSpeechContentOptions): void;
|
|
56
|
+
loadGndContent(nodes: GuidedNavigationObject[], options?: ReadiumSpeechContentOptions): Promise<void>;
|
|
56
57
|
private setContentQueue;
|
|
58
|
+
private withLanguage;
|
|
57
59
|
private withVoice;
|
|
58
60
|
private reextract;
|
|
59
61
|
private resolveResumeIndex;
|
|
@@ -2,6 +2,7 @@ import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
|
2
2
|
import { WalkContext } from './walkContext.js';
|
|
3
3
|
export declare function stripLangTags(ssml: string): string;
|
|
4
4
|
export declare function overriddenLanguage(language: string | undefined, languageOverrides: Record<string, string>): string | undefined;
|
|
5
|
+
export declare function languageFor(declared: string | undefined, ctx: WalkContext): string | undefined;
|
|
5
6
|
export declare function sameLanguage(a: string | undefined, b: string | undefined): boolean;
|
|
6
7
|
export declare function sharedLanguage(pieces: ReadiumSpeechUtterance[], ctx: WalkContext): string | undefined | null;
|
|
7
8
|
export declare function runLanguage(pieces: ReadiumSpeechUtterance[], ctx: WalkContext): string | undefined | null;
|
|
@@ -5,4 +5,5 @@ export interface SentenceBoundary {
|
|
|
5
5
|
contentEnd: number;
|
|
6
6
|
}
|
|
7
7
|
export type SentenceSegmenter = (language: string, text: string, customSuppressions?: string[]) => Promise<SentenceBoundary[]>;
|
|
8
|
+
export declare function suppressionLanguage(language: string): string;
|
|
8
9
|
export declare function segmentSentences(language: string, text: string, customSuppressions?: string[]): Promise<SentenceBoundary[]>;
|
|
@@ -30,6 +30,7 @@ export interface ExtractUtterancesOptions {
|
|
|
30
30
|
skip?: GndRole[];
|
|
31
31
|
contextualize?: GndRole[];
|
|
32
32
|
language?: LanguageMode;
|
|
33
|
+
contentLanguage?: string;
|
|
33
34
|
languageOverrides?: Record<string, string>;
|
|
34
35
|
inlineContextualization?: GndRole[];
|
|
35
36
|
segmentation?: SegmentationOptions;
|
|
@@ -16,6 +16,7 @@ export interface WalkContext {
|
|
|
16
16
|
inlineContextualization: ReadonlySet<GndRole>;
|
|
17
17
|
language?: LanguageMode;
|
|
18
18
|
languageOverrides: Record<string, string>;
|
|
19
|
+
contentLanguage?: string;
|
|
19
20
|
segmentation: Segmentation;
|
|
20
21
|
segmentationSuppressions: Record<string, string[]>;
|
|
21
22
|
segmenter: SentenceSegmenter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readium/speech",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A TypeScript library for implementing read aloud features with Web technologies, following best practices for digital publishing.",
|
|
5
5
|
"author": "Readium Foundation",
|
|
6
6
|
"keywords": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@readium/decorator": "^1.2.5",
|
|
65
65
|
"@readium/guided-navigation": "^1.1.3",
|
|
66
66
|
"@readium/helpers": "^1.2.0",
|
|
67
|
-
"@readium/shared": "^2.
|
|
67
|
+
"@readium/shared": "^2.8.0",
|
|
68
68
|
"i18next": "^26.4.0"
|
|
69
69
|
}
|
|
70
70
|
}
|