Datasets:
Download code/evaluation-code/ent400-a06a1576/apps/console/web/src/text.ts from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 8.83 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/apps/console/web/src/text.ts
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/ent400-a06a1576/apps/console/web/src/text.ts
-
curl -L -o text.ts https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/ent400-a06a1576/apps/console/web/src/text.ts
8.83 kB
| // Translate explanations at the presentation boundary. Frozen source values, | |
| // identifiers, schema states and diagnostic JSON retain their original bytes. | |
| const EXPLANATIONS: Record<string, string> = { | |
| 'content thresholds await four-segment calibration': '画面内容门槛等待四段样本校准', | |
| 'Legacy observation has no declared ground sampling policy': '旧观测包未声明地面采样规则', | |
| 'No same-observation full-frame sampling audit attached': '未附同一观测包的整帧采样审计', | |
| 'Failed to fetch': '无法连接服务,请检查连接后重试', | |
| 'Load failed': '载入失败,请检查连接后重试', | |
| 'NetworkError when attempting to fetch resource.': '网络请求失败,请检查连接后重试', | |
| 'The operation was aborted.': '请求已取消', | |
| 'The play() request was interrupted by a call to pause().': '播放请求被暂停操作取消', | |
| 'The play() request was interrupted by a new load request.': '播放请求被新的载入操作取消', | |
| 'The element has no supported sources.': '浏览器无法解码这份录像', | |
| time_conflict: '排时未通过', same_route: '仍是同一条路线', | |
| route_geometry_failed: '路线几何失败', accepted: '已接受', | |
| yield: '让行', observer_watch_until_safe_departure: '观察者等待安全离开时刻', | |
| intent_truncated_at_activity_end: '意图在活动结束时截断', | |
| no_nominal_event_time: '没有名义事件时刻', | |
| no_route: '没有可用路线', no_safe_departure: '没有安全离开时刻', | |
| activity_stay: '活动内计划停留', placeholder_horizon_remainder: '剩余活动时段原地停留', | |
| station_watch: '驻守观察', failed_path_time: '路线排时失败后停留', | |
| failed_detour: '绕路失败后停留', no_available_goal: '没有可用目标', | |
| dependent_goal_unreached: '依赖目标未到达', rolling_horizon_stay: '滚动规划剩余时段停留', | |
| requested_horizon_stay: '请求的剩余时段停留', discard_reproposal: '丢弃后重新提案', | |
| anchor_target_occupied: '锚点目标被占用', dynamic_station_watch: '动态驻守观察', | |
| observer_no_safe_destination: '观察者没有安全目的地', | |
| observer_verified_retreat: '观察者沿已核验路线撤离', | |
| observer_time_conflict_or_no_retreat: '观察者排时冲突或没有撤离路线', | |
| time_conflict_or_endpoint_hold: '排时冲突或终点被占用', | |
| reserve_parking_relocation: '移到预留停留位置', | |
| static_disconnected: '静态通路不连通', occupancy_disconnected: '占用使通路不连通', | |
| geometry_failed: '几何规划失败', intent_budget_exhausted: '本意图预算耗尽', | |
| activity_end_during_safe_traversal: '安全通行期间活动结束', | |
| closed_loop_destination: '闭环选出的目的地', rolling_horizon_traversal: '滚动规划通行', | |
| 'Cost path has no valid visibility shortcut': '成本路线没有有效的可见性捷径', | |
| observer_no_collision_free_route: '观察者没有无碰撞路线', | |
| observer_no_candidates_with_dynamic_visibility: '观察者没有满足动态可见性的候选站位', | |
| observer_dynamic_less_than_half_visible: '观察者看到动态主体的时间不足一半', | |
| disconnected_when_other_endpoints_removed: '移除其他终点后通路不连通', | |
| connectivity: '连通性', dynamic_station: '动态驻守', | |
| observer_viewing_turn_misses_dynamic_window: '观察者转向后错过动态观察窗口', | |
| observer_no_route_in_remaining_horizon: '观察者在剩余时段内没有可用路线', | |
| observer_no_safe_wait_or_retreat: '观察者无法安全等待或撤离', | |
| 'horizon_during_failure_chain:No route in the construction free space': '连续规划失败期间活动结束:构造自由空间内没有路线', | |
| path_time: '路线排时', detour: '绕路', | |
| 'No route in the construction free space': '构造自由空间内没有路线', | |
| 'Route endpoints must be in the construction free space': '路线端点必须位于构造自由空间内', | |
| station_intent: '驻守意图', no_record_coverage: '没有构造记录覆盖', | |
| accepted_observer_verified_retreat: '已接受的观察者核验撤离', | |
| accepted_retreat_body_yaw: '已接受撤离期间的机身转向', | |
| accepted_retreat_stationary: '已接受撤离期间的原地停留', | |
| accepted_station_preparation: '已接受的驻守准备', | |
| accepted_station_preparation_body_yaw: '已接受驻守准备期间的机身转向', | |
| recorded_movement: '构造记录中的移动', zero_translation_body_yaw: '无位移时的机身转向', | |
| stationary_inside_movement: '移动记录内的原地等待', | |
| 'path-map must be SOURCE=DESTINATION': '路径映射必须使用 SOURCE=DESTINATION 格式', | |
| 'Path prefixes must be absolute, non-root and contain no traversal': '路径前缀必须为不含上级跳转的绝对路径,且不能是根目录', | |
| 'Duplicate source prefix': '来源路径前缀重复', | |
| 'Mapped destination directory does not exist': '映射目标目录不存在', | |
| 'Input reference must be an absolute path without traversal': '输入引用必须为不含上级跳转的绝对路径', | |
| 'Undeclared input path prefix: ': '输入路径前缀未声明:', | |
| 'Finite monotonic verification deadline required': '校验截止时刻须为有限的单调时钟值', | |
| 'Artifact verification wall budget reached': '产物校验超过墙钟时限', | |
| 'Input changed during verification: ': '校验过程中输入发生变化:', | |
| 'Changed input: ': '输入文件指纹已变化:', | |
| 'Input verification failed; recorded=': '输入校验失败;原记录=', | |
| 'Cyclic artifact inputs': '产物输入引用存在环', | |
| 'Unknown artifact kind or schema version': '产物种类或契约版本未知', | |
| 'Changed artifact manifest': '产物封套指纹已变化', | |
| 'Changed artifact file: ': '产物文件指纹已变化:', | |
| 'Artifact file must be inside its bundle': '产物文件必须位于所属包内', | |
| 'Artifact file escapes bundle': '产物文件越出所属包目录', | |
| 'Recorded input must be absolute without ..: ': '原记录输入须为不含上级跳转的绝对路径:', | |
| 'Producer source changed during operation': '操作过程中生产者源码发生变化', | |
| 'Expected finite vector of length ': '预期有限向量,长度为 ', | |
| 'Identifier must be a short ASCII name, never a path': '标识须为简短的 ASCII 名称,不能是路径', | |
| 'Run name must be a string': '运行名称须为字符串', | |
| 'Run name must not contain control characters or path separators': '运行名称不能含控制字符或路径分隔符', | |
| 'Unknown run name stage suffix: ': '运行名称的阶段后缀未知:', | |
| 'No such file or directory': '文件或目录不存在', | |
| 'Permission denied': '没有读取或操作权限', | |
| 'Not a directory': '该路径不是目录', | |
| }; | |
| export function explanation(value: unknown): string { | |
| if (value == null || value === '') return '无'; | |
| const text = String(value); | |
| if (EXPLANATIONS[text]) return EXPLANATIONS[text]; | |
| // Source explanations can include several reason codes and Chinese context. | |
| let translated=text; | |
| for (const [original, replacement] of Object.entries(EXPLANATIONS)) { | |
| if(original.includes(' '))translated=translated.replaceAll(original,replacement); | |
| } | |
| return translated.replace(/[A-Za-z][A-Za-z0-9_]+/g, token => EXPLANATIONS[token] || token); | |
| } | |
| export function errorText(value: unknown): string { | |
| let text = value instanceof Error ? value.message : String(value); | |
| if (EXPLANATIONS[text]) return EXPLANATIONS[text]; | |
| for (const [original, translated] of Object.entries(EXPLANATIONS)) { | |
| if (original.includes(' ')) text=text.replaceAll(original,translated); | |
| } | |
| text = text.replace(/\bwrong type\b/g, '类型不符') | |
| .replace(/\bconst mismatch\b/g, '固定值不符').replace(/\benum mismatch\b/g, '枚举值不符') | |
| .replace(/\banyOf mismatch\b/g, '不符合任何允许格式') | |
| .replace(/\bwrong array length\b/g, '数组长度不符') | |
| .replace(/\bout of bounds\b/g, '数值超出范围') | |
| .replace(/\bexclusive minimum\b/g, '数值未超过下限') | |
| .replace(/\bExpected ([A-Za-z][A-Za-z0-9_/-]*), got /g, '预期 $1,实际为 ') | |
| .replace(/\bUnknown kind\b/g, '种类未知') | |
| .replace(/\bmust be positive and finite\b/g, '必须为有限正数') | |
| .replace(/\bRun name exceeds (\d+) characters\b/g, '运行名称超过 $1 个字符') | |
| .replace(/\bmissing (?=[A-Za-z_])/g, '缺少字段 ').replace(/\bunexpected (?=[A-Za-z_])/g, '未知字段 '); | |
| if (value instanceof SyntaxError) return 'JSON 格式无效,请检查输入或服务响应'; | |
| return text.replace(/^(?:Error|TypeError|SyntaxError):\s*/, ''); | |
| } | |
| export function durationTier(value: string): string { | |
| return ({short: '短档', medium: '中档', long: '长档'} as Record<string, string>)[value] || value; | |
| } | |