@readium/speech 0.14.0 → 0.15.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 +3 -1
- package/build/Fallback/fallbackSpeechEngine.d.ts +0 -2
- package/build/SpeechServer/speechServerEngine.d.ts +8 -3
- package/build/WebSpeech/WebSpeechVoiceManager.d.ts +8 -0
- package/build/WebSpeech/webSpeechEngine.d.ts +5 -5
- package/build/engine.d.ts +0 -2
- package/build/index.d.ts +3 -1
- package/build/index.js +1806 -1455
- package/build/navigator.d.ts +0 -4
- package/build/preferences/SpeechDefaults.d.ts +7 -3
- package/build/preferences/SpeechPreferences.d.ts +7 -2
- package/build/preferences/SpeechPreferencesEditor.d.ts +5 -3
- package/build/preferences/SpeechSettings.d.ts +9 -3
- package/build/preferences/guards.d.ts +2 -0
- package/build/preferences/index.d.ts +1 -1
- package/build/speechNavigator.d.ts +5 -4
- package/build/utils/language.d.ts +8 -0
- package/build/utterance.d.ts +1 -0
- package/build/utterances/contextualizations.d.ts +1 -0
- package/build/utterances/index.d.ts +1 -1
- package/build/utterances/language.d.ts +9 -0
- package/build/utterances/mergeUtterances.d.ts +3 -2
- package/build/utterances/nodeFields.d.ts +1 -0
- package/build/utterances/pageNumber.d.ts +1 -0
- package/build/utterances/roles.d.ts +1 -1
- package/build/utterances/types.d.ts +2 -1
- package/build/utterances/utteranceOutput.d.ts +2 -0
- package/build/utterances/walkContext.d.ts +8 -2
- package/build/voices/languageMatching.d.ts +3 -0
- package/build/voices/voiceId.d.ts +2 -0
- package/package.json +2 -2
package/build/navigator.d.ts
CHANGED
|
@@ -11,10 +11,6 @@ export interface ReadiumSpeechPlaybackEvent {
|
|
|
11
11
|
}
|
|
12
12
|
export interface ReadiumSpeechNavigatorContract extends Configurable<SpeechSettings, SpeechPreferences> {
|
|
13
13
|
getVoices(): Promise<ReadiumSpeechVoice[]>;
|
|
14
|
-
setVoice(voice: ReadiumSpeechVoice | string): void;
|
|
15
|
-
getCurrentVoice(): ReadiumSpeechVoice | null;
|
|
16
|
-
setSpeakInContentLanguage(enabled: boolean): void;
|
|
17
|
-
getSpeakInContentLanguage(): boolean;
|
|
18
14
|
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[]): void;
|
|
19
15
|
loadGndContent(nodes: GuidedNavigationObject[]): Promise<void>;
|
|
20
16
|
getCurrentContent(): ReadiumSpeechUtterance | null;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { GndRole } from '@readium/guided-navigation';
|
|
2
|
-
import { AutoPauseScope, VerbosityPreset } from './SpeechPreferences.js';
|
|
2
|
+
import { AutoPauseScope, VerbosityPreset, VoicePreference } from './SpeechPreferences.js';
|
|
3
3
|
import { ExtractionFormat, LanguageMode, Segmentation } from '../utterances/types.js';
|
|
4
4
|
export interface ISpeechDefaults {
|
|
5
5
|
format?: ExtractionFormat | null;
|
|
6
|
-
inlineContextualization?:
|
|
6
|
+
inlineContextualization?: GndRole[] | null;
|
|
7
7
|
verbosity?: VerbosityPreset | null;
|
|
8
8
|
skip?: GndRole[] | null;
|
|
9
9
|
contextualize?: GndRole[] | null;
|
|
10
10
|
language?: LanguageMode | null;
|
|
11
|
+
languageOverrides?: Record<string, string> | null;
|
|
11
12
|
segmentation?: Segmentation | null;
|
|
13
|
+
voice?: VoicePreference | null;
|
|
12
14
|
pauseDuration?: number | null;
|
|
13
15
|
autoPause?: AutoPauseScope | null;
|
|
14
16
|
rate?: number | null;
|
|
@@ -17,12 +19,14 @@ export interface ISpeechDefaults {
|
|
|
17
19
|
}
|
|
18
20
|
export declare class SpeechDefaults {
|
|
19
21
|
readonly format: ExtractionFormat;
|
|
20
|
-
readonly inlineContextualization:
|
|
22
|
+
readonly inlineContextualization: GndRole[];
|
|
21
23
|
readonly verbosity: VerbosityPreset;
|
|
22
24
|
readonly skip: GndRole[];
|
|
23
25
|
readonly contextualize: GndRole[];
|
|
24
26
|
readonly language: LanguageMode;
|
|
27
|
+
readonly languageOverrides: Record<string, string>;
|
|
25
28
|
readonly segmentation: Segmentation;
|
|
29
|
+
readonly voice: VoicePreference | null;
|
|
26
30
|
readonly pauseDuration: number;
|
|
27
31
|
readonly autoPause: AutoPauseScope;
|
|
28
32
|
readonly rate: number;
|
|
@@ -3,14 +3,17 @@ import { ExtractionFormat, LanguageMode, Segmentation } from '../utterances/type
|
|
|
3
3
|
import { ConfigurablePreferences } from './Configurable.js';
|
|
4
4
|
export type VerbosityPreset = "none" | "few" | "some" | "most" | "custom";
|
|
5
5
|
export type AutoPauseScope = "none" | "utterance" | "block";
|
|
6
|
+
export type VoicePreference = string | Record<string, string>;
|
|
6
7
|
export interface ISpeechPreferences {
|
|
7
8
|
format?: ExtractionFormat | null;
|
|
8
|
-
inlineContextualization?:
|
|
9
|
+
inlineContextualization?: GndRole[] | null;
|
|
9
10
|
verbosity?: VerbosityPreset | null;
|
|
10
11
|
skip?: GndRole[] | null;
|
|
11
12
|
contextualize?: GndRole[] | null;
|
|
12
13
|
language?: LanguageMode | null;
|
|
14
|
+
languageOverrides?: Record<string, string> | null;
|
|
13
15
|
segmentation?: Segmentation | null;
|
|
16
|
+
voice?: VoicePreference | null;
|
|
14
17
|
pauseDuration?: number | null;
|
|
15
18
|
autoPause?: AutoPauseScope | null;
|
|
16
19
|
rate?: number | null;
|
|
@@ -19,12 +22,14 @@ export interface ISpeechPreferences {
|
|
|
19
22
|
}
|
|
20
23
|
export declare class SpeechPreferences implements ISpeechPreferences, ConfigurablePreferences<SpeechPreferences> {
|
|
21
24
|
format: ExtractionFormat | null | undefined;
|
|
22
|
-
inlineContextualization:
|
|
25
|
+
inlineContextualization: GndRole[] | null | undefined;
|
|
23
26
|
verbosity: VerbosityPreset | null | undefined;
|
|
24
27
|
skip: GndRole[] | null | undefined;
|
|
25
28
|
contextualize: GndRole[] | null | undefined;
|
|
26
29
|
language: LanguageMode | null | undefined;
|
|
30
|
+
languageOverrides: Record<string, string> | null | undefined;
|
|
27
31
|
segmentation: Segmentation | null | undefined;
|
|
32
|
+
voice: VoicePreference | null | undefined;
|
|
28
33
|
pauseDuration: number | null | undefined;
|
|
29
34
|
autoPause: AutoPauseScope | null | undefined;
|
|
30
35
|
rate: number | null | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPreferencesEditor } from './PreferencesEditor.js';
|
|
2
|
-
import {
|
|
3
|
-
import { SpeechPreferences, VerbosityPreset, AutoPauseScope } from './SpeechPreferences.js';
|
|
2
|
+
import { EnumPreference, Preference, RangePreference, StringArrayPreference } from './Preference.js';
|
|
3
|
+
import { SpeechPreferences, VerbosityPreset, AutoPauseScope, VoicePreference } from './SpeechPreferences.js';
|
|
4
4
|
import { SpeechSettings } from './SpeechSettings.js';
|
|
5
5
|
import { ExtractionFormat, LanguageMode, Segmentation } from '../utterances/types.js';
|
|
6
6
|
export declare class SpeechPreferencesEditor implements IPreferencesEditor {
|
|
@@ -10,12 +10,14 @@ export declare class SpeechPreferencesEditor implements IPreferencesEditor {
|
|
|
10
10
|
clear(): void;
|
|
11
11
|
private updatePreference;
|
|
12
12
|
get format(): EnumPreference<ExtractionFormat>;
|
|
13
|
-
get inlineContextualization():
|
|
13
|
+
get inlineContextualization(): StringArrayPreference;
|
|
14
14
|
get verbosity(): EnumPreference<VerbosityPreset>;
|
|
15
15
|
get skip(): StringArrayPreference;
|
|
16
16
|
get contextualize(): StringArrayPreference;
|
|
17
17
|
get language(): EnumPreference<LanguageMode>;
|
|
18
|
+
get languageOverrides(): Preference<Record<string, string>>;
|
|
18
19
|
get segmentation(): EnumPreference<Segmentation>;
|
|
20
|
+
get voice(): Preference<VoicePreference>;
|
|
19
21
|
get pauseDuration(): RangePreference<number>;
|
|
20
22
|
get autoPause(): EnumPreference<AutoPauseScope>;
|
|
21
23
|
get rate(): RangePreference<number>;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { GndRole } from '@readium/guided-navigation';
|
|
2
2
|
import { ConfigurableSettings } from './Configurable.js';
|
|
3
3
|
import { SpeechDefaults } from './SpeechDefaults.js';
|
|
4
|
-
import { AutoPauseScope, SpeechPreferences, VerbosityPreset } from './SpeechPreferences.js';
|
|
4
|
+
import { AutoPauseScope, SpeechPreferences, VerbosityPreset, VoicePreference } from './SpeechPreferences.js';
|
|
5
5
|
import { ExtractionFormat, LanguageMode, Segmentation } from '../utterances/types.js';
|
|
6
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
6
7
|
export declare class SpeechSettings implements ConfigurableSettings {
|
|
7
8
|
[key: string]: unknown;
|
|
8
9
|
readonly format: ExtractionFormat;
|
|
9
|
-
readonly inlineContextualization:
|
|
10
|
+
readonly inlineContextualization: GndRole[];
|
|
10
11
|
readonly verbosity: VerbosityPreset;
|
|
11
12
|
readonly skip: GndRole[];
|
|
12
13
|
readonly contextualize: GndRole[];
|
|
13
14
|
readonly language: LanguageMode;
|
|
15
|
+
readonly languageOverrides: Record<string, string>;
|
|
14
16
|
readonly segmentation: Segmentation;
|
|
17
|
+
readonly voice: VoicePreference | null;
|
|
15
18
|
readonly pauseDuration: number;
|
|
16
19
|
readonly autoPause: AutoPauseScope;
|
|
17
20
|
readonly rate: number;
|
|
18
21
|
readonly pitch: number;
|
|
19
22
|
readonly volume: number;
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @param engineVoice The engine's voice, which `voice` falls back to: when unset, or for its language in a record without it.
|
|
25
|
+
*/
|
|
26
|
+
constructor(preferences: SpeechPreferences, defaults: SpeechDefaults, engineVoice?: ReadiumSpeechVoice | null);
|
|
21
27
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare function ensureBoolean(value: boolean | null | undefined): boolean | null | undefined;
|
|
2
2
|
export declare function ensureEnumValue<T extends string | number | symbol>(value: T | null | undefined, supportedValues: readonly T[]): T | null | undefined;
|
|
3
3
|
export declare function ensureValueInRange(value: number | null | undefined, range: readonly [number, number]): number | null | undefined;
|
|
4
|
+
export declare function ensureStringRecord(value: Record<string, string> | null | undefined): Record<string, string> | null | undefined;
|
|
5
|
+
export declare function ensureStringOrStringRecord(value: string | Record<string, string> | null | undefined): string | Record<string, string> | null | undefined;
|
|
4
6
|
export declare function ensureStringArray(value: string[] | null | undefined): string[] | null | undefined;
|
|
@@ -3,7 +3,7 @@ export type { IPreferencesEditor } from './PreferencesEditor.js';
|
|
|
3
3
|
export { BooleanPreference, EnumPreference, Preference, RangePreference, StringArrayPreference } from './Preference.js';
|
|
4
4
|
export type { IEnumPreference, IPreference, IRangePreference } from './Preference.js';
|
|
5
5
|
export { SpeechPreferences } from './SpeechPreferences.js';
|
|
6
|
-
export type { AutoPauseScope, ISpeechPreferences, VerbosityPreset } from './SpeechPreferences.js';
|
|
6
|
+
export type { AutoPauseScope, ISpeechPreferences, VerbosityPreset, VoicePreference } from './SpeechPreferences.js';
|
|
7
7
|
export type { ExtractionFormat, LanguageMode, Segmentation } from '../utterances/types.js';
|
|
8
8
|
export { autoPauseScopes, extractionFormats, extractionPreferenceKeys, languageModes, pauseDurationRangeConfig, pitchRangeConfig, rateRangeConfig, segmentationModes, verbosityPresets, volumeRangeConfig, } from './constraints.js';
|
|
9
9
|
export type { RangeConfig } from './constraints.js';
|
|
@@ -28,6 +28,7 @@ export interface ReadiumSpeechNavigatorConfiguration {
|
|
|
28
28
|
export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorContract {
|
|
29
29
|
private engine;
|
|
30
30
|
private contentQueue;
|
|
31
|
+
private loadedQueue;
|
|
31
32
|
private readonly events;
|
|
32
33
|
private navigatorState;
|
|
33
34
|
private pendingAdvanceTimeout;
|
|
@@ -35,6 +36,7 @@ export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorCon
|
|
|
35
36
|
private _preferences;
|
|
36
37
|
private _settings;
|
|
37
38
|
private _preferencesEditor;
|
|
39
|
+
private preferencesEditorEngineVoice;
|
|
38
40
|
private readonly contextualizationOverrides?;
|
|
39
41
|
private readonly segmentationOverrides?;
|
|
40
42
|
private source;
|
|
@@ -49,18 +51,17 @@ export declare class ReadiumSpeechNavigator implements ReadiumSpeechNavigatorCon
|
|
|
49
51
|
private setupEngineListeners;
|
|
50
52
|
private setNavigatorState;
|
|
51
53
|
getVoices(): Promise<ReadiumSpeechVoice[]>;
|
|
52
|
-
setVoice(voice: ReadiumSpeechVoice | string): void;
|
|
53
|
-
getCurrentVoice(): ReadiumSpeechVoice | null;
|
|
54
|
-
setSpeakInContentLanguage(enabled: boolean): void;
|
|
55
|
-
getSpeakInContentLanguage(): boolean;
|
|
56
54
|
loadContent(content: ReadiumSpeechUtterance | ReadiumSpeechUtterance[]): void;
|
|
57
55
|
loadGndContent(nodes: GuidedNavigationObject[]): Promise<void>;
|
|
58
56
|
private setContentQueue;
|
|
57
|
+
private withVoice;
|
|
59
58
|
private reextract;
|
|
60
59
|
private resolveResumeIndex;
|
|
61
60
|
getCurrentContent(): ReadiumSpeechUtterance | null;
|
|
62
61
|
getContentQueue(): ReadiumSpeechUtterance[];
|
|
63
62
|
private getCurrentUtteranceIndex;
|
|
63
|
+
private resumePosition;
|
|
64
|
+
private resumeTarget;
|
|
64
65
|
play(): void;
|
|
65
66
|
pause(): void;
|
|
66
67
|
stop(): void;
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* @returns A tuple containing [language, region] where region is optional
|
|
5
5
|
*/
|
|
6
6
|
export declare const extractLangRegionFromBCP47: (lang: string) => [string, string | undefined];
|
|
7
|
+
/**
|
|
8
|
+
* Looks up the value of a language-keyed map that applies to a BCP 47 tag:
|
|
9
|
+
* the exact tag's, else the primary language subtag's, matched case-insensitively.
|
|
10
|
+
* @param valuesByLanguage - Map keyed by language tag (e.g., { en: "fr", "en-GB": "de" })
|
|
11
|
+
* @param lang - The BCP 47 language tag (e.g., "en-US")
|
|
12
|
+
* @returns The value, or undefined if no key matches
|
|
13
|
+
*/
|
|
14
|
+
export declare const valueForLanguage: <T>(valuesByLanguage: Record<string, T>, lang: string) => T | undefined;
|
|
7
15
|
/**
|
|
8
16
|
* Collects the entries of a language-keyed map that apply to a BCP 47 tag:
|
|
9
17
|
* the primary language subtag's entries plus the exact tag's, matched case-insensitively.
|
package/build/utterance.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Contextualizations } from './types.js';
|
|
2
2
|
export declare const defaultContextualizations: Contextualizations;
|
|
3
|
+
export declare function catalogLocale(locale: string): string;
|
|
3
4
|
export declare function contextualizationsForLocale(locale: string): Promise<Contextualizations>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { extractUtterances } from './extractUtterances.js';
|
|
2
2
|
export { resolveBoundaryLocate } from './boundaryLocate.js';
|
|
3
3
|
export { resolveUtteranceLocate } from './utteranceLocate.js';
|
|
4
|
-
export { blockLevelRoles, skippableRoles } from './roles.js';
|
|
4
|
+
export { blockLevelRoles, inlineContextualizationRoles, skippableRoles } from './roles.js';
|
|
5
5
|
export { defaultContextualizations } from './contextualizations.js';
|
|
6
6
|
export type { ContextualizationEntry, Contextualizations, ContextualizationOptions, ExtractUtterancesOptions, Segmentation, SegmentationOptions, } from './types.js';
|
|
7
7
|
export type { SentenceBoundary, SentenceSegmenter } from './sentenceSegmenter.js';
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
2
|
+
import { WalkContext } from './walkContext.js';
|
|
1
3
|
export declare function stripLangTags(ssml: string): string;
|
|
4
|
+
export declare function overriddenLanguage(language: string | undefined, languageOverrides: Record<string, string>): string | undefined;
|
|
5
|
+
export declare function sameLanguage(a: string | undefined, b: string | undefined): boolean;
|
|
6
|
+
export declare function sharedLanguage(pieces: ReadiumSpeechUtterance[], ctx: WalkContext): string | undefined | null;
|
|
7
|
+
export declare function runLanguage(pieces: ReadiumSpeechUtterance[], ctx: WalkContext): string | undefined | null;
|
|
8
|
+
export declare function ssmlInLanguage(piece: ReadiumSpeechUtterance, language: string | undefined, ctx: WalkContext): string;
|
|
9
|
+
export declare function languageRuns(pieces: ReadiumSpeechUtterance[], ctx: WalkContext): [number, number][];
|
|
10
|
+
export declare function overrideLangTags(ssml: string, languageOverrides: Record<string, string>): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GuidedNavigationObject } from '@readium/shared';
|
|
2
2
|
import { LocatorOptions } from '../decorator/createLocator.js';
|
|
3
|
-
import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
3
|
+
import { ReadiumSpeechUtterance, UtteranceOffset } from '../utterance.js';
|
|
4
4
|
import { ResolvedNodeText } from './text.js';
|
|
5
5
|
import { ExtractionFormat, LanguageMode } from './types.js';
|
|
6
6
|
import { SourceTrace, WalkContext } from './walkContext.js';
|
|
7
|
-
export declare function joinPieceTexts(parts: string[]): {
|
|
7
|
+
export declare function joinPieceTexts(parts: string[], plainParts?: string[]): {
|
|
8
8
|
joined: string;
|
|
9
9
|
ranges: {
|
|
10
10
|
start: number;
|
|
@@ -12,6 +12,7 @@ export declare function joinPieceTexts(parts: string[]): {
|
|
|
12
12
|
}[];
|
|
13
13
|
};
|
|
14
14
|
export declare function substitutedBareLocate(node: GuidedNavigationObject, ctx: WalkContext): LocatorOptions | undefined;
|
|
15
|
+
export declare function buildMergeOffsets(pieces: ReadiumSpeechUtterance[], pieceSources: SourceTrace, ctx: WalkContext): UtteranceOffset[];
|
|
15
16
|
export declare function mergeUtterances(pieces: ReadiumSpeechUtterance[], pieceSources: SourceTrace, ctx: WalkContext): ReadiumSpeechUtterance | undefined;
|
|
16
17
|
export declare function applyFormat(resolved: ResolvedNodeText, format: ExtractionFormat, language: LanguageMode | undefined, ctx: WalkContext): ReadiumSpeechUtterance[];
|
|
17
18
|
export declare function plainOf(text: string, format: ExtractionFormat): string;
|
|
@@ -3,3 +3,4 @@ import { GndRole } from '@readium/guided-navigation';
|
|
|
3
3
|
export declare function nodeRoles(node: GuidedNavigationObject): GndRole[];
|
|
4
4
|
export declare function spokenText(node: GuidedNavigationObject): GuidedNavigationText | undefined;
|
|
5
5
|
export declare function descriptionOf(node: GuidedNavigationObject): string | undefined;
|
|
6
|
+
export declare function descriptionLanguageOf(node: GuidedNavigationObject): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPageNumber(label: string): boolean;
|
|
@@ -5,7 +5,7 @@ export declare const roleDropOverrides: Partial<Record<GndRole, {
|
|
|
5
5
|
drops: GndRole[];
|
|
6
6
|
unconditional?: boolean;
|
|
7
7
|
}>>;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const inlineContextualizationRoles: GndRole[];
|
|
9
9
|
export declare const descriptionFoldingRoles: GndRole[];
|
|
10
10
|
export declare const valueFoldingRoles: GndRole[];
|
|
11
11
|
export declare const contentlessRoles: GndRole[];
|
|
@@ -30,7 +30,8 @@ export interface ExtractUtterancesOptions {
|
|
|
30
30
|
skip?: GndRole[];
|
|
31
31
|
contextualize?: GndRole[];
|
|
32
32
|
language?: LanguageMode;
|
|
33
|
-
|
|
33
|
+
languageOverrides?: Record<string, string>;
|
|
34
|
+
inlineContextualization?: GndRole[];
|
|
34
35
|
segmentation?: SegmentationOptions;
|
|
35
36
|
substitutions?: SubstitutionTable;
|
|
36
37
|
}
|
|
@@ -2,5 +2,7 @@ import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
|
2
2
|
import { GuidedNavigationObject } from '@readium/shared';
|
|
3
3
|
import { SourceTrace, WalkContext } from './walkContext.js';
|
|
4
4
|
export declare function formatPlain(text: string, ctx: WalkContext): ReadiumSpeechUtterance;
|
|
5
|
+
export declare function formatEntryText(text: string, ctx: WalkContext): ReadiumSpeechUtterance;
|
|
6
|
+
export declare function formatDescription(text: string, node: GuidedNavigationObject, ctx: WalkContext): ReadiumSpeechUtterance;
|
|
5
7
|
export declare function push(out: ReadiumSpeechUtterance[], sources: SourceTrace, node: SourceTrace[number], items: ReadiumSpeechUtterance[]): void;
|
|
6
8
|
export declare function pushPiecesOrMerged(out: ReadiumSpeechUtterance[], sources: SourceTrace, ctx: WalkContext, node: GuidedNavigationObject, pieces: ReadiumSpeechUtterance[], pieceSources: SourceTrace, merged: ReadiumSpeechUtterance | undefined): void;
|
|
@@ -7,13 +7,15 @@ import { SentenceSegmenter } from './sentenceSegmenter.js';
|
|
|
7
7
|
import { ExtractionFormat, ExtractUtterancesOptions, LanguageMode, Segmentation, SubstitutionTable } from './types.js';
|
|
8
8
|
export interface WalkContext {
|
|
9
9
|
i18n: i18n;
|
|
10
|
+
contextualizationLanguage: string;
|
|
10
11
|
skip: ReadonlySet<GndRole>;
|
|
11
12
|
contextualize: ReadonlySet<GndRole>;
|
|
12
13
|
contextualizationShapes: Partial<Record<GndRole, "inline" | "block">>;
|
|
13
14
|
contextualizationParams?: (role: GndRole, node: GuidedNavigationObject) => Record<string, string> | undefined;
|
|
14
15
|
format: ExtractionFormat;
|
|
15
|
-
inlineContextualization:
|
|
16
|
+
inlineContextualization: ReadonlySet<GndRole>;
|
|
16
17
|
language?: LanguageMode;
|
|
18
|
+
languageOverrides: Record<string, string>;
|
|
17
19
|
segmentation: Segmentation;
|
|
18
20
|
segmentationSuppressions: Record<string, string[]>;
|
|
19
21
|
segmenter: SentenceSegmenter;
|
|
@@ -31,10 +33,14 @@ export interface WalkContext {
|
|
|
31
33
|
leading?: LocatorOptions;
|
|
32
34
|
trailing?: LocatorOptions;
|
|
33
35
|
}>;
|
|
36
|
+
placeholderPieces: Map<ReadiumSpeechUtterance, {
|
|
37
|
+
node: GuidedNavigationObject;
|
|
38
|
+
placement?: "inline" | "after";
|
|
39
|
+
}>;
|
|
34
40
|
}
|
|
35
41
|
export type SourceTrace = (GuidedNavigationObject | [GuidedNavigationObject, GuidedNavigationObject] | undefined)[];
|
|
36
42
|
export declare const blockLevelRoleSet: ReadonlySet<GndRole>;
|
|
37
|
-
export declare const
|
|
43
|
+
export declare const inlineContextualizationRoleSet: ReadonlySet<GndRole>;
|
|
38
44
|
export declare const descriptionFoldingRoleSet: ReadonlySet<GndRole>;
|
|
39
45
|
export declare const valueFoldingRoleSet: ReadonlySet<GndRole>;
|
|
40
46
|
export declare const contentlessRoleSet: ReadonlySet<GndRole>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readium/speech",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@readium/decorator": "^1.2.5",
|
|
65
|
-
"@readium/guided-navigation": "^1.1.
|
|
65
|
+
"@readium/guided-navigation": "^1.1.3",
|
|
66
66
|
"@readium/helpers": "^1.2.0",
|
|
67
67
|
"@readium/shared": "^2.7.0",
|
|
68
68
|
"i18next": "^26.4.0"
|