speech

Guided Navigation

Guided Navigation (GND) generation lives in @readium/guided-navigation. Its output, @readium/shared’s GuidedNavigationObject[], is what Utterance Extraction and loadGndContent() take.

import { parseMarkup } from "@readium/guided-navigation";
import { extractUtterances } from "@readium/speech";

const gnd = parseMarkup(html, undefined, { textrefs: true });
const utterances = await extractUtterances(gnd);

Pass objects returned by parseMarkup() (or makeGnd()’s .guided) rather than deserialized JSON: text taken from aria-label/aria-labelledby is only known on those, and without it such text gets quote-located instead of located on its element.