"""原生对白的实测逐词时间投影;没有逐词证据时拒绝推算字幕位置。""" import re import unicodedata TURN_POLICY = "h3-two-person-turns-screen-v1" def _normalize(value, *, fold_single_digits): if not isinstance(value, str): raise ValueError("原生对白文字无效") value = unicodedata.normalize("NFKC", value).casefold() # 与推理端内容质检采用相同的普通话同音归一化,原始词和实测时间仍完整保留。 if fold_single_digits: value = re.sub( r"(? 0 and provenance.get("native_av_policy") == "native_av_v1" and type(provenance.get("audio_offset_samples")) is int and provenance["audio_offset_samples"] >= 0 and audio.get("context_hash") == digest(dict(video_sha=video["sha256"], policy="native_av_v1")) )