@boringparts/lioni 0.0.0-stage → 0.4.2
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/LICENSE +21 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +959 -0
- package/dist/dist-BjI3h4o3.js +3797 -0
- package/dist/index.d.ts +724 -0
- package/dist/index.js +3862 -0
- package/dist/node-Bb9WsnGu.js +233 -0
- package/dist/node.d.ts +26 -0
- package/dist/node.js +108 -0
- package/dist/report-EsWS84c0.js +93 -0
- package/dist/yaml-DX1EEaWD.js +331 -0
- package/dist/yaml-Dn7jqV-s.d.ts +1027 -0
- package/package.json +72 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { $ as UpdateResult, $n as defaultCompare, $t as validateQaSuppressionFile, A as SourceAdapter, An as TranslationWritebackAdapter, At as QualityDiagnostic, B as TranslationRead, Bn as StandardSchemaV1, Bt as defineChecker, C as DuplicateTranslationUnitKeyError, Cn as TranslationWriteConditionResult, Ct as QualityCheckResult, D as QualityConfiguration, Dn as TranslationWriteStatus, Dt as QualityDataLoadInput, E as ProjectSnapshot, En as TranslationWriteSourceExpectation, Et as QualityCoverage, F as Translation, Fn as validateTranslationWriteRequest, Ft as QualityReadCoverage, G as defineConfig, Gn as CompareInput, Gt as QaSuppressionFile, H as TranslationReadScope, Hn as StandardSchemaV1Result, Ht as CreateQaSuppressionInput, I as TranslationAdapter, In as writeTranslationRequests, It as QualityRelationship, J as readSourceSnapshot, Jn as ComparisonStatus, Jt as QaSuppressionFormatErrorReason, K as readComparisonSnapshot, Kn as ComparisonContractError, Kt as QaSuppressionFingerprintSummary, L as TranslationAssociation, Ln as JsonValue, Lt as QualityRunResult, M as SourceReadCoverage, Mn as TranslationWritebackResolution, Mt as QualityFinding, N as SourceSnapshot, Nn as TranslationWritebackTarget, Nt as QualityLocation, O as ReadRecord, On as TranslationWriteTarget, Ot as QualityDataReader, P as SourceUnit, Pn as validateTranslationCandidate, Pt as QualityObject, Q as UpdatePlanExecutionStatus, Qn as compareSnapshots, Qt as validateQaSuppression, R as TranslationAssociationStatus, Rn as StandardSchemaContractError, Rt as QualitySubject, S as CoverageStatus, Sn as TranslationWriteConditionInput, St as QualityCheckExecution, T as FrameworkConfig, Tn as TranslationWriteResult, Tt as QualityCheckerContractError, U as TranslationReadScopeCoverage, Un as LanguageSelectionOptions, Ut as QaSuppression, V as TranslationReadCoverage, Vn as StandardSchemaV1Issue, Vt as QualityCheckResultCache, W as TranslationUnitInput, Wn as Compare, Wt as QaSuppressionExecution, X as UpdatePlanApplyResult, Xn as SourceChange, Xt as createQaSuppression, Y as runQa, Yn as SnapshotReadEvidence, Yt as QaSuppressionStore, Z as UpdatePlanExecutionItemResult, Zn as TranslationChange, Zt as upsertQaSuppressionFromReport, _ as createTermbase, _n as previewUpdate, _t as TranslationIdentityContractError, a as JsonValue$1, an as UpdatePlanData, ar as createMemoScope, at as ComparisonBaselineSelection, b as BodyAvailability, bn as TranslationWriteBatchResult, bt as CheckerPrepareInput, c as TermContractIssue, cn as UpdatePlanSourceChange, cr as QualityProfileCandidateStatus, ct as recordComparisonBaseline, d as TermLanguageData, dn as UpdatePlanWriteRequest, dr as QualityProfileStage, dt as QualityReportDecision, en as validateQaSuppressions, er as validateComparisonInput, et as applyUpdatePlan, f as TermSelection, fn as UpdatePolicy, fr as QualityProfileTiming, ft as QualityReportDecisionStatus, g as TermbaseData, gn as defaultUpdatePolicy, gt as isQualityReportPassing, h as Termbase, hn as createUpdatePlan, hr as createQualityProfiler, ht as formatQualityReport, i as parseTermbaseYaml, in as UpdatePlanComparisons, ir as MemoScopeClosedError, it as ComparisonBaselineIncompleteSnapshotError, j as SourceRead, jn as TranslationWritebackInput, jt as QualityEvidence, k as ReadScope, kn as TranslationWriteTargetExpectation, kt as QualityDataReaderContractError, l as TermExpression, lr as QualityProfileCheck, lt as replaceComparisonBaseline, m as TermUsage, mn as UpdateTargetExpectation, mr as QualityProfilerOptions, mt as decideQualityReport, n as TermbaseYamlFiles, nn as UpdatePlanAction, nr as MemoOptions, nt as ComparisonBaseline, o as TermConceptData, on as UpdatePlanInput, or as QualityProfileCache, ot as ComparisonBaselineStore, p as TermType, pn as UpdateSourceExpectation, pr as QualityProfiler, pt as QualityReportFormatOptions, q as readProjectSnapshot, qn as ComparisonResult, qt as QaSuppressionFormatError, r as TermbaseYamlIssue, rn as UpdatePlanAssociations, rr as MemoScope, rt as ComparisonBaselineFormatError, s as TermContractError, sn as UpdatePlanItem, sr as QualityProfileCandidate, st as RecordComparisonBaselineResult, t as TermbaseYamlError, tn as UpdatePlan, tr as validateComparisonResult, tt as update, u as TermExpressionData, un as UpdatePlanTranslationChange, ur as QualityProfileReport, ut as validateComparisonBaseline, v as selectTerms, vn as validateUpdatePlan, vt as CheckerDefinition, w as EnumerationCompleteness, wn as TranslationWriteRequest, wt as QualityCheckScope, x as ComparisonSnapshot, xn as TranslationWriteCondition, xt as QualityCheckDefinition, y as Awaitable, yn as TranslationCandidate, yt as CheckerLoadInput, z as TranslationIdentity, zn as StandardSchemaFailureKind, zt as TranslationProgress } from "./yaml-Dn7jqV-s.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
4
|
+
/** 只检查是否提供了候选正文。空字符串也是已提供的译文。 */
|
|
5
|
+
export declare function createMissingTranslationChecker<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = unknown>(): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "missing-translation">;
|
|
6
|
+
/** 仅对字符串正文执行精确比较,保留空格、大小写和 Unicode 表示差异。 */
|
|
7
|
+
export declare function createSameTextChecker<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = unknown>(): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "same-text">;
|
|
8
|
+
type NumberTextInput = {
|
|
9
|
+
readonly source: string;
|
|
10
|
+
readonly target: string;
|
|
11
|
+
readonly subject: QualitySubject;
|
|
12
|
+
readonly sourceLocation: QualityLocation;
|
|
13
|
+
readonly targetLocation: QualityLocation;
|
|
14
|
+
readonly targetContent: unknown;
|
|
15
|
+
};
|
|
16
|
+
type NumberCheckerPreparation = {
|
|
17
|
+
readonly source: string;
|
|
18
|
+
readonly target: string;
|
|
19
|
+
readonly sourceLocation?: QualityLocation;
|
|
20
|
+
readonly targetLocation?: QualityLocation;
|
|
21
|
+
} | null;
|
|
22
|
+
type NumberCheckerOptions<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = unknown> = {
|
|
23
|
+
/** 为结构化正文明确提供文本提取与适用范围。 */
|
|
24
|
+
readonly prepare?: (input: CheckerPrepareInput<TUnit, TTranslation, TBody, TUnavailable>) => Awaitable<NumberCheckerPreparation>;
|
|
25
|
+
};
|
|
26
|
+
type NumberCheckerDefinition<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable> = QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "number-correspondence">;
|
|
27
|
+
/** 默认比较字符串正文;结构化正文可通过 prepare 明确提供适配。 */
|
|
28
|
+
declare function createNumberCheckerImplementation<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = unknown>(options?: NumberCheckerOptions<TUnit, TTranslation, TBody, TUnavailable>): NumberCheckerDefinition<TUnit, TTranslation, TBody, TUnavailable>;
|
|
29
|
+
declare function createNumberCheckerWithTypes<TUnit extends TranslationUnitInput, TTranslation, TBody = unknown, TUnavailable = unknown>(): (options?: NumberCheckerOptions<TUnit, TTranslation, TBody, TUnavailable>) => NumberCheckerDefinition<TUnit, TTranslation, TBody, TUnavailable>;
|
|
30
|
+
/** 内置版本、默认文本提取和定位由本包维护。 */
|
|
31
|
+
export declare const createNumberChecker: typeof createNumberCheckerImplementation & {
|
|
32
|
+
withTypes: typeof createNumberCheckerWithTypes;
|
|
33
|
+
};
|
|
34
|
+
export declare function compareNumberText(input: NumberTextInput): readonly QualityFinding[];
|
|
35
|
+
type TermRange = {
|
|
36
|
+
readonly start: number;
|
|
37
|
+
readonly end: number;
|
|
38
|
+
};
|
|
39
|
+
type TermFragment = {
|
|
40
|
+
readonly ref: JsonValue$1;
|
|
41
|
+
readonly text: string;
|
|
42
|
+
readonly protectedRanges?: readonly TermRange[];
|
|
43
|
+
};
|
|
44
|
+
type TermTextInput = {
|
|
45
|
+
readonly language: string;
|
|
46
|
+
readonly fragments: readonly TermFragment[];
|
|
47
|
+
/** 省略表示宿主已提供此侧完整的比较范围。 */
|
|
48
|
+
readonly complete?: boolean;
|
|
49
|
+
};
|
|
50
|
+
type TermComparisonGroup = {
|
|
51
|
+
readonly ref?: JsonValue$1;
|
|
52
|
+
readonly source: TermTextInput;
|
|
53
|
+
readonly target: TermTextInput;
|
|
54
|
+
};
|
|
55
|
+
type TermComparisonInput = {
|
|
56
|
+
readonly groups: readonly TermComparisonGroup[];
|
|
57
|
+
};
|
|
58
|
+
/** 原文中的 UTF-16 半开区间,不切开代理对。 */
|
|
59
|
+
type TextRange = {
|
|
60
|
+
readonly start: number;
|
|
61
|
+
readonly end: number;
|
|
62
|
+
};
|
|
63
|
+
type TextInput = {
|
|
64
|
+
readonly text: string;
|
|
65
|
+
readonly language: string;
|
|
66
|
+
readonly protectedRanges?: readonly TextRange[];
|
|
67
|
+
};
|
|
68
|
+
type TextAnalysisIssue = {
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly message: string;
|
|
71
|
+
readonly range?: TextRange;
|
|
72
|
+
};
|
|
73
|
+
type TextToken = TextRange & {
|
|
74
|
+
readonly kind: string;
|
|
75
|
+
readonly identity?: string;
|
|
76
|
+
readonly value?: unknown;
|
|
77
|
+
/** 显式保护该区间;种类名称不隐式决定保护行为。 */
|
|
78
|
+
readonly protect?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/** Recognizer 的已知命中与能力完整性分别表达;返回 token 数组是完整结果的简写。 */
|
|
81
|
+
type RecognitionResult = {
|
|
82
|
+
/** 此识别器能确认的命中;不完整结果仍保留这些命中。 */
|
|
83
|
+
readonly tokens: readonly TextToken[];
|
|
84
|
+
/** false 表示本识别器的可用范围内仍可能有未报告命中。 */
|
|
85
|
+
readonly complete: boolean;
|
|
86
|
+
/** 与本识别器限制或分析结果相关的问题。 */
|
|
87
|
+
readonly issues: readonly TextAnalysisIssue[];
|
|
88
|
+
};
|
|
89
|
+
type RecognitionInput = TextInput & {
|
|
90
|
+
/** 尚未被保护或由更高优先级识别器占用的原文区间。 */
|
|
91
|
+
readonly availableRanges: readonly TextRange[];
|
|
92
|
+
};
|
|
93
|
+
type TextRecognizer = (input: RecognitionInput) => readonly TextToken[] | RecognitionResult | Promise<readonly TextToken[] | RecognitionResult>;
|
|
94
|
+
type StructureAnalysis = {
|
|
95
|
+
readonly text: string;
|
|
96
|
+
readonly language: string;
|
|
97
|
+
readonly tokens: readonly TextToken[];
|
|
98
|
+
readonly protectedRanges: readonly TextRange[];
|
|
99
|
+
readonly availableRanges: readonly TextRange[];
|
|
100
|
+
/** 所有配置的识别器均完整时为 true;已知命中可与问题同时存在。 */
|
|
101
|
+
readonly complete: boolean;
|
|
102
|
+
/** 按识别器配置顺序累积的问题。 */
|
|
103
|
+
readonly issues: readonly TextAnalysisIssue[];
|
|
104
|
+
};
|
|
105
|
+
type WordToken = TextRange & {
|
|
106
|
+
readonly text: string;
|
|
107
|
+
};
|
|
108
|
+
type WordAnalysis = {
|
|
109
|
+
readonly words: readonly WordToken[];
|
|
110
|
+
readonly boundaries: readonly number[];
|
|
111
|
+
/** 结构和词界阶段均完整时为 true;两阶段的问题按顺序合并。 */
|
|
112
|
+
readonly complete: boolean;
|
|
113
|
+
/** 结构问题先于词界问题,均保留原始范围和说明。 */
|
|
114
|
+
readonly issues: readonly TextAnalysisIssue[];
|
|
115
|
+
};
|
|
116
|
+
type WordSegmenter = (input: TextInput) => WordAnalysis | Promise<WordAnalysis>;
|
|
117
|
+
type AnalysisRuntime = {
|
|
118
|
+
readonly memo?: MemoScope;
|
|
119
|
+
};
|
|
120
|
+
export declare class TextAnalysisContractError extends Error {
|
|
121
|
+
readonly code: string;
|
|
122
|
+
constructor(code: string, message: string);
|
|
123
|
+
}
|
|
124
|
+
type SlotIdentity = {
|
|
125
|
+
readonly kind: string;
|
|
126
|
+
readonly identity: string;
|
|
127
|
+
};
|
|
128
|
+
type SignaturePart = {
|
|
129
|
+
readonly type: "text";
|
|
130
|
+
readonly text: string;
|
|
131
|
+
} | ({
|
|
132
|
+
readonly type: "slot";
|
|
133
|
+
} & SlotIdentity);
|
|
134
|
+
type TemplateSlot = TextRange & SlotIdentity & {
|
|
135
|
+
readonly raw: string;
|
|
136
|
+
readonly value?: unknown;
|
|
137
|
+
};
|
|
138
|
+
type TemplateSignature = {
|
|
139
|
+
readonly parts: readonly SignaturePart[];
|
|
140
|
+
readonly slots: readonly TemplateSlot[];
|
|
141
|
+
};
|
|
142
|
+
type TemplateOptions = {
|
|
143
|
+
readonly abstract: (token: TextToken) => SlotIdentity | undefined;
|
|
144
|
+
};
|
|
145
|
+
/** 只抽象明确选中的 token;保护区间和未抽象内容仍作为原样文本参与比较。 */
|
|
146
|
+
export declare function createTemplateSignature(analysis: StructureAnalysis, options: TemplateOptions): TemplateSignature;
|
|
147
|
+
/** 结构编码不会把原值、原文长度或来源位置当作模板等价条件。 */
|
|
148
|
+
export declare function signatureKey(signature: TemplateSignature): string;
|
|
149
|
+
/** 声明等价关系;未声明的签名保留自身类别,不构成白名单失败。 */
|
|
150
|
+
export declare function createSignatureEquivalence(groups: readonly (readonly TemplateSignature[])[]): (signature: TemplateSignature) => string;
|
|
151
|
+
type TextAnalysisOptions = {
|
|
152
|
+
readonly recognizers?: readonly TextRecognizer[];
|
|
153
|
+
readonly segmenter?: WordSegmenter;
|
|
154
|
+
};
|
|
155
|
+
type TextAnalysis = {
|
|
156
|
+
readonly structures: (input: TextInput, runtime?: AnalysisRuntime) => Promise<StructureAnalysis>;
|
|
157
|
+
readonly words: (input: TextInput, runtime?: AnalysisRuntime) => Promise<WordAnalysis>;
|
|
158
|
+
readonly signature: (input: TextInput, options: TemplateOptions, runtime?: AnalysisRuntime) => Promise<TemplateSignature>;
|
|
159
|
+
};
|
|
160
|
+
/** 配置只固定函数和政策;调用时才计算,借入的 memo 生命周期由调用方管理。 */
|
|
161
|
+
export declare function createTextAnalysis(options?: TextAnalysisOptions): TextAnalysis;
|
|
162
|
+
type NormalizedText = {
|
|
163
|
+
readonly original: string;
|
|
164
|
+
readonly text: string;
|
|
165
|
+
/** 无法由连续原文精确表示时返回 null,不扩大区间冒充精确命中。 */
|
|
166
|
+
readonly mapRange: (range: TextRange) => TextRange | null;
|
|
167
|
+
};
|
|
168
|
+
/** NFC 比较视图;分解字符保留来源,再验证选中原文的规范化结果。 */
|
|
169
|
+
export declare function normalizeText(original: string): NormalizedText;
|
|
170
|
+
type RegexTokenOptions = {
|
|
171
|
+
readonly kind: string;
|
|
172
|
+
readonly pattern: RegExp;
|
|
173
|
+
readonly identity?: (match: RegExpExecArray) => string;
|
|
174
|
+
readonly value?: (match: RegExpExecArray) => unknown;
|
|
175
|
+
readonly protect?: boolean;
|
|
176
|
+
};
|
|
177
|
+
/** 每个可用原文区间独立扫描,不共享 RegExp.lastIndex。 */
|
|
178
|
+
export declare function regexTokens(options: RegexTokenOptions): TextRecognizer;
|
|
179
|
+
/** ASCII 整数与小数,保留符号、前导零及全部原始数字,不解析为浮点数。 */
|
|
180
|
+
export declare function asciiNumbers(): TextRecognizer;
|
|
181
|
+
/** 仅为显式选择的示例语法;不包含数字索引、嵌套或字面转义。 */
|
|
182
|
+
export declare function braceVariables(options?: {
|
|
183
|
+
readonly protect?: boolean;
|
|
184
|
+
}): TextRecognizer;
|
|
185
|
+
export declare function literalMarkers(markers: readonly string[], options?: {
|
|
186
|
+
readonly kind?: string;
|
|
187
|
+
readonly protect?: boolean;
|
|
188
|
+
}): TextRecognizer;
|
|
189
|
+
/** 基础词界只承诺 en/zh/ja;其他语言由调用方明确替换。 */
|
|
190
|
+
export declare function segmentWords(input: TextInput): WordAnalysis;
|
|
191
|
+
type QuantityOptions = {
|
|
192
|
+
readonly aliases?: Readonly<Record<string, string>>;
|
|
193
|
+
readonly defaultUnit?: string;
|
|
194
|
+
readonly ignoredLiterals?: readonly string[];
|
|
195
|
+
};
|
|
196
|
+
type QuantityProfile = {
|
|
197
|
+
readonly id: string;
|
|
198
|
+
readonly supports: (language: string) => boolean;
|
|
199
|
+
readonly facts: (text: string, options: QuantityOptions) => Set<string>;
|
|
200
|
+
readonly unitAfter: (text: string, options: QuantityOptions) => string | undefined;
|
|
201
|
+
};
|
|
202
|
+
/** 显式选择能力;不会把未知语言悄悄交给另一种语言的词法。 */
|
|
203
|
+
export declare function quantityProfile(id: string | undefined, language: string): QuantityProfile | undefined;
|
|
204
|
+
type TermBoundaryInput = {
|
|
205
|
+
readonly text: string;
|
|
206
|
+
readonly range: TermRange;
|
|
207
|
+
readonly entry: TermExpression;
|
|
208
|
+
};
|
|
209
|
+
type TermMatchingPolicy = {
|
|
210
|
+
readonly id: string;
|
|
211
|
+
readonly boundary: "literal" | "word" | ((input: TermBoundaryInput) => boolean | PromiseLike<boolean>);
|
|
212
|
+
readonly normalize?: (text: string) => NormalizedText;
|
|
213
|
+
/** 额外识别形式,不修改规范资料中的表达或使用地位。 */
|
|
214
|
+
readonly forms?: (entry: TermExpression) => readonly string[];
|
|
215
|
+
};
|
|
216
|
+
type CompileTermsOptions = {
|
|
217
|
+
readonly analysis?: TextAnalysis;
|
|
218
|
+
readonly policy?: TermMatchingPolicy;
|
|
219
|
+
readonly policyFor?: (entry: TermExpression) => TermMatchingPolicy | undefined;
|
|
220
|
+
};
|
|
221
|
+
type CompiledTerms = {
|
|
222
|
+
readonly termbase: Termbase;
|
|
223
|
+
readonly languages: readonly string[];
|
|
224
|
+
readonly analysis: TextAnalysis;
|
|
225
|
+
};
|
|
226
|
+
export declare function defaultTermMatchingPolicy(language: string): TermMatchingPolicy | undefined;
|
|
227
|
+
export declare function compileTerms(termbase: Termbase, options?: CompileTermsOptions): CompiledTerms;
|
|
228
|
+
type TermRuntime = {
|
|
229
|
+
readonly memo?: MemoScope;
|
|
230
|
+
};
|
|
231
|
+
type TermAnalysisIssue = {
|
|
232
|
+
readonly code: string;
|
|
233
|
+
readonly message: string;
|
|
234
|
+
readonly fragmentIndex?: number;
|
|
235
|
+
readonly conceptId?: string;
|
|
236
|
+
readonly expressionId?: string;
|
|
237
|
+
};
|
|
238
|
+
type TermMatch = {
|
|
239
|
+
readonly conceptId: string;
|
|
240
|
+
readonly expressionId: string;
|
|
241
|
+
readonly language: string;
|
|
242
|
+
readonly usage: TermUsage;
|
|
243
|
+
readonly fragmentIndex: number;
|
|
244
|
+
readonly ref: JsonValue$1;
|
|
245
|
+
readonly range: TermRange;
|
|
246
|
+
readonly text: string;
|
|
247
|
+
readonly expressionText: string;
|
|
248
|
+
readonly form: string;
|
|
249
|
+
readonly policyId: string;
|
|
250
|
+
readonly entry: TermExpression;
|
|
251
|
+
};
|
|
252
|
+
type TermAmbiguity = {
|
|
253
|
+
readonly reason: "same-span-concepts" | "crossing-overlap" | "conflicting-usage";
|
|
254
|
+
readonly matches: readonly TermMatch[];
|
|
255
|
+
};
|
|
256
|
+
type TermMatches = {
|
|
257
|
+
readonly status: "complete" | "incomplete";
|
|
258
|
+
readonly matches: readonly TermMatch[];
|
|
259
|
+
readonly active: readonly TermMatch[];
|
|
260
|
+
readonly certain: readonly TermMatch[];
|
|
261
|
+
readonly suppressed: readonly {
|
|
262
|
+
readonly match: TermMatch;
|
|
263
|
+
readonly by: readonly TermMatch[];
|
|
264
|
+
}[];
|
|
265
|
+
readonly ambiguities: readonly TermAmbiguity[];
|
|
266
|
+
readonly issues: readonly TermAnalysisIssue[];
|
|
267
|
+
};
|
|
268
|
+
type FindTermsOptions = TermRuntime & {
|
|
269
|
+
readonly conceptIds?: readonly string[];
|
|
270
|
+
};
|
|
271
|
+
/** 同一 memo 范围内,按完整识别依赖复用术语匹配与解释。 */
|
|
272
|
+
export declare function findTerms(terms: CompiledTerms, input: TermTextInput, options?: FindTermsOptions): Promise<TermMatches>;
|
|
273
|
+
type TermRuleId = "require-allowed-translation" | "reject-forbidden-translation";
|
|
274
|
+
type RequireAllowedTranslationRule = {
|
|
275
|
+
readonly id: "require-allowed-translation";
|
|
276
|
+
};
|
|
277
|
+
type RejectForbiddenTranslationRule = {
|
|
278
|
+
readonly id: "reject-forbidden-translation";
|
|
279
|
+
};
|
|
280
|
+
type TermRule = RequireAllowedTranslationRule | RejectForbiddenTranslationRule;
|
|
281
|
+
export declare function requireAllowedTranslation(): RequireAllowedTranslationRule;
|
|
282
|
+
export declare function rejectForbiddenTranslation(): RejectForbiddenTranslationRule;
|
|
283
|
+
type TermRulesConfiguration = {
|
|
284
|
+
readonly rules: readonly TermRuleId[];
|
|
285
|
+
};
|
|
286
|
+
export declare const termRulesConfigurationSchema: StandardSchemaV1$1<TermRulesConfiguration>;
|
|
287
|
+
type TermGroupAnalysis = {
|
|
288
|
+
readonly source: TermMatches;
|
|
289
|
+
readonly target: TermMatches;
|
|
290
|
+
readonly applicableConcepts: readonly TermConceptData[];
|
|
291
|
+
};
|
|
292
|
+
type TermUseAnalysis = {
|
|
293
|
+
readonly input: TermComparisonInput;
|
|
294
|
+
readonly groups: readonly TermGroupAnalysis[];
|
|
295
|
+
};
|
|
296
|
+
/** 识别信息独立于规则;目标端只解释源端确定适用的概念。 */
|
|
297
|
+
export declare function analyzeTermUse(terms: CompiledTerms, input: TermComparisonInput, runtime?: TermRuntime): Promise<TermUseAnalysis>;
|
|
298
|
+
type TermProblem = {
|
|
299
|
+
readonly code: "missing-allowed-translation" | "forbidden-translation";
|
|
300
|
+
readonly ruleId: TermRuleId;
|
|
301
|
+
readonly message: string;
|
|
302
|
+
readonly groupIndex: number;
|
|
303
|
+
readonly conceptId: string;
|
|
304
|
+
readonly sourceMatches: readonly TermMatch[];
|
|
305
|
+
readonly targetMatches: readonly TermMatch[];
|
|
306
|
+
};
|
|
307
|
+
type TermAssessmentIssue = {
|
|
308
|
+
readonly code: string;
|
|
309
|
+
readonly message: string;
|
|
310
|
+
readonly groupIndex: number;
|
|
311
|
+
readonly conceptId?: string;
|
|
312
|
+
readonly ruleId?: TermRuleId;
|
|
313
|
+
};
|
|
314
|
+
type TermAssessment = {
|
|
315
|
+
readonly status: "complete" | "incomplete";
|
|
316
|
+
readonly problems: readonly TermProblem[];
|
|
317
|
+
readonly issues: readonly TermAssessmentIssue[];
|
|
318
|
+
};
|
|
319
|
+
type TermAssessmentOptions = {
|
|
320
|
+
readonly rules?: readonly TermRule[];
|
|
321
|
+
};
|
|
322
|
+
type EvaluateTermsOptions = TermAssessmentOptions & TermRuntime;
|
|
323
|
+
/** 只消费已有信息,不分词、查缓存或访问外部资料。 */
|
|
324
|
+
export declare function assessTermUse(input: TermComparisonInput, analysis: TermUseAnalysis, options?: TermAssessmentOptions): TermAssessment;
|
|
325
|
+
/** 完整入口复用同一分析与判断实现;关闭全部规则时不进行分析。 */
|
|
326
|
+
export declare function evaluateTerms(terms: CompiledTerms, input: TermComparisonInput, options?: EvaluateTermsOptions): Promise<TermAssessment>;
|
|
327
|
+
type TermCorpusEntry = {
|
|
328
|
+
readonly ref: JsonValue$1;
|
|
329
|
+
readonly fragments: readonly TermFragment[];
|
|
330
|
+
};
|
|
331
|
+
type TermDiscoveryCorpus = {
|
|
332
|
+
readonly language: string;
|
|
333
|
+
readonly entries: readonly TermCorpusEntry[];
|
|
334
|
+
readonly complete?: boolean;
|
|
335
|
+
};
|
|
336
|
+
type TermCandidateOccurrence = {
|
|
337
|
+
readonly entryIndex: number;
|
|
338
|
+
readonly entryRef: JsonValue$1;
|
|
339
|
+
readonly fragmentIndex: number;
|
|
340
|
+
readonly ref: JsonValue$1;
|
|
341
|
+
readonly range: TermRange;
|
|
342
|
+
readonly text: string;
|
|
343
|
+
readonly context: string;
|
|
344
|
+
};
|
|
345
|
+
type TermCandidateRanking = {
|
|
346
|
+
readonly method: string;
|
|
347
|
+
readonly maxWordCount: number;
|
|
348
|
+
readonly score: number;
|
|
349
|
+
};
|
|
350
|
+
type TermCandidate = {
|
|
351
|
+
readonly text: string;
|
|
352
|
+
readonly language: string;
|
|
353
|
+
readonly occurrences: number;
|
|
354
|
+
/** 覆盖的输入条目位置数,不根据文字或不透明引用隐式合并条目。 */
|
|
355
|
+
readonly entryCount: number;
|
|
356
|
+
readonly examples: readonly TermCandidateOccurrence[];
|
|
357
|
+
readonly examplesTruncated: boolean;
|
|
358
|
+
readonly ranking: TermCandidateRanking;
|
|
359
|
+
};
|
|
360
|
+
type TermCandidateGenerationInput = {
|
|
361
|
+
readonly language: string;
|
|
362
|
+
readonly text: string;
|
|
363
|
+
readonly words: readonly WordToken[];
|
|
364
|
+
readonly protectedRanges: readonly TermRange[];
|
|
365
|
+
readonly maxWords: number;
|
|
366
|
+
readonly maxCharacters: number;
|
|
367
|
+
};
|
|
368
|
+
type TermCandidateGenerator = (input: TermCandidateGenerationInput) => readonly TermRange[];
|
|
369
|
+
type TermCandidateRankResult = {
|
|
370
|
+
readonly method: string;
|
|
371
|
+
readonly score: number;
|
|
372
|
+
};
|
|
373
|
+
type TermCandidateRanker = (candidate: TermCandidate) => TermCandidateRankResult;
|
|
374
|
+
type TermDiscoveryIssue = {
|
|
375
|
+
readonly code: string;
|
|
376
|
+
readonly message: string;
|
|
377
|
+
readonly entryIndex?: number;
|
|
378
|
+
readonly fragmentIndex?: number;
|
|
379
|
+
readonly range?: TermRange;
|
|
380
|
+
};
|
|
381
|
+
type DiscoverTermsOptions = TermRuntime & {
|
|
382
|
+
readonly maxWords?: number;
|
|
383
|
+
readonly maxCharacters?: number;
|
|
384
|
+
readonly minOccurrences?: number;
|
|
385
|
+
readonly limit?: number;
|
|
386
|
+
readonly maxExamples?: number;
|
|
387
|
+
readonly analysis?: TextAnalysis;
|
|
388
|
+
/** 替换默认词组生成,包括语言相关的首尾过滤;词界与预算验证仍由发现入口执行。 */
|
|
389
|
+
readonly candidateGenerator?: TermCandidateGenerator;
|
|
390
|
+
readonly candidateRanker?: TermCandidateRanker;
|
|
391
|
+
readonly include?: (candidate: TermCandidate) => boolean;
|
|
392
|
+
};
|
|
393
|
+
type TermDiscovery = {
|
|
394
|
+
readonly status: "complete" | "incomplete";
|
|
395
|
+
readonly candidates: readonly TermCandidate[];
|
|
396
|
+
readonly issues: readonly TermDiscoveryIssue[];
|
|
397
|
+
readonly statistics: {
|
|
398
|
+
readonly entries: number;
|
|
399
|
+
readonly distinctCandidates: number;
|
|
400
|
+
readonly eligibleCandidates: number;
|
|
401
|
+
readonly omittedCandidates: number;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* 有界词组发现,默认允许词间连接符并按语言过滤功能词首尾。
|
|
406
|
+
* 低频候选仍由 minOccurrences 决定,排名只表示审阅顺序,不证明候选是术语。
|
|
407
|
+
*/
|
|
408
|
+
export declare function discoverTerms(corpus: TermDiscoveryCorpus, options?: DiscoverTermsOptions): Promise<TermDiscovery>;
|
|
409
|
+
type TermCheckerLoaded<TContext> = {
|
|
410
|
+
/** 编译器对象只在本次检查运行中交接,不进入指纹或报告。 */
|
|
411
|
+
readonly terms: CompiledTerms;
|
|
412
|
+
/** 术语规则适配器按需读取的附加运行时上下文。 */
|
|
413
|
+
readonly context: TContext;
|
|
414
|
+
};
|
|
415
|
+
type TermCheckerPreparation<TSubject> = {
|
|
416
|
+
readonly comparison: TermComparisonInput;
|
|
417
|
+
readonly subject: TSubject;
|
|
418
|
+
} | null;
|
|
419
|
+
type TermCheckerLocationInput<TSubject> = {
|
|
420
|
+
readonly ref: JsonValue$1;
|
|
421
|
+
readonly language: string;
|
|
422
|
+
readonly sourceKey: string;
|
|
423
|
+
readonly side: "source" | "target";
|
|
424
|
+
readonly subject: TSubject;
|
|
425
|
+
readonly groupIndex: number;
|
|
426
|
+
readonly fragmentIndex?: number;
|
|
427
|
+
};
|
|
428
|
+
type TermCheckerGroupLocations = {
|
|
429
|
+
readonly source: readonly QualityLocation[];
|
|
430
|
+
readonly target: readonly QualityLocation[];
|
|
431
|
+
readonly targetFallback: QualityLocation;
|
|
432
|
+
};
|
|
433
|
+
/** check 消费的固定 JSON 输入;完整分析保留命中、歧义、缺失和覆盖信息。 */
|
|
434
|
+
type TermCheckerInput = {
|
|
435
|
+
readonly sourceKey: string;
|
|
436
|
+
readonly language: string;
|
|
437
|
+
readonly ruleId: TermRuleId;
|
|
438
|
+
/** 完整术语分析的固定 JSON 快照,运行时交给术语判断。 */
|
|
439
|
+
readonly analysis: JsonValue$1;
|
|
440
|
+
readonly locations: readonly TermCheckerGroupLocations[];
|
|
441
|
+
};
|
|
442
|
+
type TermCheckerOptions<TUnit extends TranslationUnitInput, TTranslation, TSubject, TBody = unknown, TUnavailable = never, TId extends string | undefined = undefined, TRule extends TermRule = TermRule, TContext = undefined> = {
|
|
443
|
+
/** 普通或可选 string ID 返回 string,并使配置中的检查项联合退化为 string。 */
|
|
444
|
+
readonly id?: TId;
|
|
445
|
+
/** 静态编译结果,或在本次 load 中读取并编译的术语资料。 */
|
|
446
|
+
readonly terms: CompiledTerms | ((input: CheckerLoadInput<TUnit, TTranslation, TBody, TUnavailable>) => Awaitable<CompiledTerms>);
|
|
447
|
+
/** 术语规则适配器所需的附加资料;和术语编译结果一并在 load 中准备。 */
|
|
448
|
+
readonly load?: (input: CheckerLoadInput<TUnit, TTranslation, TBody, TUnavailable>) => Awaitable<TContext>;
|
|
449
|
+
readonly rule: TRule;
|
|
450
|
+
/** 将当前候选适配为术语比较;函数只在 prepare 阶段运行。 */
|
|
451
|
+
readonly prepare: (input: CheckerPrepareInput<TUnit, TTranslation, TBody, TUnavailable, TermCheckerLoaded<TContext>>) => Awaitable<TermCheckerPreparation<TSubject>>;
|
|
452
|
+
/** 在 prepare 中把术语片段引用映射为稳定的宿主资源位置。 */
|
|
453
|
+
readonly location?: (input: TermCheckerLocationInput<TSubject>) => QualityLocation;
|
|
454
|
+
};
|
|
455
|
+
/** 一次绑定一条规则;加载资料和分析在 prepare 中交接给纯判断。 */
|
|
456
|
+
declare function createTermCheckerImplementation<TUnit extends TranslationUnitInput, TTranslation, TSubject, TBody = unknown, TUnavailable = never, const TRule extends TermRule = TermRule, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, undefined, TRule, TContext> & {
|
|
457
|
+
readonly id?: undefined;
|
|
458
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, `terminology/${TRule["id"]}`>;
|
|
459
|
+
declare function createTermCheckerImplementation<TUnit extends TranslationUnitInput, TTranslation, TSubject, TBody = unknown, TUnavailable = never, const TRule extends TermRule = TermRule, const TId extends string = string, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, TId, TRule, TContext> & {
|
|
460
|
+
readonly id: TId;
|
|
461
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
462
|
+
declare function createTermCheckerImplementation<TUnit extends TranslationUnitInput, TTranslation, TSubject, TBody = unknown, TUnavailable = never, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, string | undefined, TermRule, TContext>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, string>;
|
|
463
|
+
declare function createTermCheckerWithTypes<TUnit extends TranslationUnitInput, TTranslation, TSubject, TBody = unknown, TUnavailable = never>(): {
|
|
464
|
+
<const TRule extends TermRule, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, undefined, TRule, TContext>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, `terminology/${TRule["id"]}`>;
|
|
465
|
+
<const TRule extends TermRule, const TId extends string, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, TId, TRule, TContext> & {
|
|
466
|
+
readonly id: TId;
|
|
467
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
468
|
+
<TRule extends TermRule, TContext = undefined>(options: TermCheckerOptions<TUnit, TTranslation, TSubject, TBody, TUnavailable, string | undefined, TRule, TContext>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, string>;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* 术语规则工厂;显式宿主泛型先经 withTypes 绑定,规则与覆盖 ID 由调用推断。
|
|
472
|
+
* 规则识别分析由工厂完成;prepare 只适配当前候选的术语比较及宿主上下文。
|
|
473
|
+
*/
|
|
474
|
+
export declare const createTermChecker: typeof createTermCheckerImplementation & {
|
|
475
|
+
withTypes: typeof createTermCheckerWithTypes;
|
|
476
|
+
};
|
|
477
|
+
type MessageFamilyIssue = {
|
|
478
|
+
readonly code: string;
|
|
479
|
+
readonly message: string;
|
|
480
|
+
readonly language?: string | undefined;
|
|
481
|
+
readonly sourceKey?: string | undefined;
|
|
482
|
+
readonly ref?: JsonValue | undefined;
|
|
483
|
+
readonly range?: TextRange | undefined;
|
|
484
|
+
};
|
|
485
|
+
type MessageFragment = {
|
|
486
|
+
readonly ref: JsonValue;
|
|
487
|
+
readonly text: string;
|
|
488
|
+
readonly protectedRanges?: readonly TextRange[] | undefined;
|
|
489
|
+
};
|
|
490
|
+
type MessageText = {
|
|
491
|
+
readonly language: string;
|
|
492
|
+
readonly fragments: readonly MessageFragment[];
|
|
493
|
+
readonly complete?: boolean | undefined;
|
|
494
|
+
readonly issues?: readonly MessageFamilyIssue[] | undefined;
|
|
495
|
+
};
|
|
496
|
+
type MessageFamilyGroup = {
|
|
497
|
+
readonly ref: JsonValue;
|
|
498
|
+
readonly scope: string;
|
|
499
|
+
readonly source: MessageText;
|
|
500
|
+
readonly target: MessageText;
|
|
501
|
+
};
|
|
502
|
+
type MessageFamilyInput = {
|
|
503
|
+
readonly groups: readonly MessageFamilyGroup[];
|
|
504
|
+
readonly location?: QualityLocation | undefined;
|
|
505
|
+
readonly complete?: boolean | undefined;
|
|
506
|
+
readonly issues?: readonly MessageFamilyIssue[] | undefined;
|
|
507
|
+
};
|
|
508
|
+
type MessageFamilySignature = {
|
|
509
|
+
readonly familyKey: string;
|
|
510
|
+
readonly targetKey: string;
|
|
511
|
+
};
|
|
512
|
+
type MessageFamilyReference = MessageFamilySignature & {
|
|
513
|
+
readonly translationIndex: number;
|
|
514
|
+
readonly translationIdentity: TranslationIdentity;
|
|
515
|
+
readonly sourceKey: string;
|
|
516
|
+
readonly group: MessageFamilyGroup;
|
|
517
|
+
readonly sourceSignatures: readonly TemplateSignature[];
|
|
518
|
+
readonly targetSignatures: readonly TemplateSignature[];
|
|
519
|
+
readonly translationLocation?: QualityLocation;
|
|
520
|
+
};
|
|
521
|
+
type MessageFamilyLimits = {
|
|
522
|
+
readonly maxCategories: number;
|
|
523
|
+
readonly maxSourcesPerCategory: number;
|
|
524
|
+
};
|
|
525
|
+
type MessageFamilyComparison = {
|
|
526
|
+
readonly status: "no-comparison" | "consistent" | "different";
|
|
527
|
+
/** 保存证据中的表达类别,不将候选重复计入。 */
|
|
528
|
+
readonly categoryCount: number;
|
|
529
|
+
readonly referenceCount: number;
|
|
530
|
+
readonly omittedCategories: number;
|
|
531
|
+
readonly omittedReferences: number;
|
|
532
|
+
readonly categories: readonly {
|
|
533
|
+
readonly key: string;
|
|
534
|
+
readonly referenceCount: number;
|
|
535
|
+
readonly references: readonly MessageFamilyReference[];
|
|
536
|
+
}[];
|
|
537
|
+
};
|
|
538
|
+
type MessageFamilyReferenceProjection<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never> = {
|
|
539
|
+
readonly kind: "reference";
|
|
540
|
+
readonly sourceUnit: SourceUnit<TUnit>;
|
|
541
|
+
readonly sourceKey: string;
|
|
542
|
+
readonly language: string;
|
|
543
|
+
readonly association: TranslationAssociation;
|
|
544
|
+
readonly translation: Translation<TTranslation, TBody, TUnavailable>;
|
|
545
|
+
};
|
|
546
|
+
/** 固定参照解释只读取事实与本次加载的资料,不接收当前候选。 */
|
|
547
|
+
type MessageFamilyContext<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TLoaded = unknown> = Pick<CheckerPrepareInput<TUnit, TTranslation, TBody, TUnavailable, TLoaded>, "snapshot" | "relationships" | "loaded" | "memo">;
|
|
548
|
+
type MessageFamilyCheckerOptions<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TLoaded = undefined> = {
|
|
549
|
+
readonly id?: string;
|
|
550
|
+
/** 已选且存在候选时加载一次;运行时对象只用于准备完整 JSON 输入。 */
|
|
551
|
+
readonly load?: (input: CheckerLoadInput<TUnit, TTranslation, TBody, TUnavailable>) => Awaitable<TLoaded>;
|
|
552
|
+
/** 逐候选选择适用范围并提供实际消息组,参照由工厂统一准备。 */
|
|
553
|
+
readonly prepare: (input: CheckerPrepareInput<TUnit, TTranslation, TBody, TUnavailable, TLoaded>) => Awaitable<MessageFamilyInput | null>;
|
|
554
|
+
readonly reference: (reference: MessageFamilyReferenceProjection<TUnit, TTranslation, TBody, TUnavailable>, context: MessageFamilyContext<TUnit, TTranslation, TBody, TUnavailable, TLoaded>) => Awaitable<MessageFamilyInput>;
|
|
555
|
+
readonly analysis?: TextAnalysis;
|
|
556
|
+
readonly sourceTemplate?: TemplateOptions;
|
|
557
|
+
readonly targetTemplate?: TemplateOptions;
|
|
558
|
+
/** 等价策略解释保存参照与候选时使用同一固定上下文,生成的键进入完整输入。 */
|
|
559
|
+
readonly targetEquivalence?: (signature: TemplateSignature, language: string, context: MessageFamilyContext<TUnit, TTranslation, TBody, TUnavailable, TLoaded>) => string;
|
|
560
|
+
readonly limits?: Partial<MessageFamilyLimits>;
|
|
561
|
+
};
|
|
562
|
+
declare function messageFamilyCheckerFor<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never>(): {
|
|
563
|
+
<TLoaded = undefined>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded> & {
|
|
564
|
+
readonly id?: undefined;
|
|
565
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "message-family-consistency">;
|
|
566
|
+
<TLoaded = undefined, const TId extends string = string>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded> & {
|
|
567
|
+
readonly id: TId;
|
|
568
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
569
|
+
<TLoaded = undefined>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, string>;
|
|
570
|
+
};
|
|
571
|
+
/** 显式宿主类型后继续推导加载资料与检查项 ID。 */
|
|
572
|
+
export declare const createMessageFamilyChecker: typeof messageFamilyChecker & {
|
|
573
|
+
withTypes: typeof messageFamilyCheckerFor;
|
|
574
|
+
};
|
|
575
|
+
/** 共享已保存参照目录;检查规则只消费当前候选的完整、稳定 JSON 输入。 */
|
|
576
|
+
declare function messageFamilyChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TLoaded = undefined>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded> & {
|
|
577
|
+
readonly id?: undefined;
|
|
578
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "message-family-consistency">;
|
|
579
|
+
declare function messageFamilyChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TLoaded = undefined, const TId extends string = string>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded> & {
|
|
580
|
+
readonly id: TId;
|
|
581
|
+
}): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
582
|
+
declare function messageFamilyChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TLoaded = undefined>(options: MessageFamilyCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TLoaded>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, string>;
|
|
583
|
+
type QuantityBranch = {
|
|
584
|
+
readonly values: readonly string[];
|
|
585
|
+
};
|
|
586
|
+
type QuantityBranchIssue = {
|
|
587
|
+
readonly targetBranchIndex: number;
|
|
588
|
+
readonly missing: readonly string[];
|
|
589
|
+
readonly extra: readonly string[];
|
|
590
|
+
};
|
|
591
|
+
/** 按集合比较数量事实,并为每个目标分支选择差异最少的源分支。 */
|
|
592
|
+
export declare function compareQuantityBranches(input: {
|
|
593
|
+
readonly source: readonly QuantityBranch[];
|
|
594
|
+
readonly target: readonly QuantityBranch[];
|
|
595
|
+
}): readonly QuantityBranchIssue[];
|
|
596
|
+
type ProtectedLiteralIssue = {
|
|
597
|
+
readonly literal: string;
|
|
598
|
+
};
|
|
599
|
+
/** 原文实际含有的字面值必须在译文中按 ASCII 标识符边界保留。 */
|
|
600
|
+
export declare function compareProtectedLiterals(input: {
|
|
601
|
+
readonly source: string;
|
|
602
|
+
readonly target: string;
|
|
603
|
+
readonly literals: readonly string[];
|
|
604
|
+
}): readonly ProtectedLiteralIssue[];
|
|
605
|
+
type MessageLocation = {
|
|
606
|
+
readonly language: string | null;
|
|
607
|
+
readonly range: unknown;
|
|
608
|
+
readonly key?: string;
|
|
609
|
+
readonly [key: string]: unknown;
|
|
610
|
+
};
|
|
611
|
+
type VueI18nMessageProjection = {
|
|
612
|
+
readonly key: string;
|
|
613
|
+
readonly language: string;
|
|
614
|
+
readonly source: ({
|
|
615
|
+
readonly status: "available";
|
|
616
|
+
readonly text: string;
|
|
617
|
+
} | {
|
|
618
|
+
readonly status: "unavailable";
|
|
619
|
+
} | {
|
|
620
|
+
readonly status: "absent";
|
|
621
|
+
}) & Readonly<Record<string, unknown>>;
|
|
622
|
+
readonly target: ({
|
|
623
|
+
readonly status: "available";
|
|
624
|
+
readonly text: string;
|
|
625
|
+
} | {
|
|
626
|
+
readonly status: "unavailable";
|
|
627
|
+
} | {
|
|
628
|
+
readonly status: "missing";
|
|
629
|
+
}) & Readonly<Record<string, unknown>>;
|
|
630
|
+
readonly locations: {
|
|
631
|
+
readonly source: MessageLocation;
|
|
632
|
+
readonly target: MessageLocation;
|
|
633
|
+
readonly [key: string]: unknown;
|
|
634
|
+
};
|
|
635
|
+
readonly [key: string]: unknown;
|
|
636
|
+
};
|
|
637
|
+
/** 准备适配保留原始源译单元,但不暴露检查专属加载资料。 */
|
|
638
|
+
type VueI18nPrepareInput<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = never> = Omit<CheckerPrepareInput<TUnit, TTranslation, TBody, TUnavailable, unknown>, "loaded">;
|
|
639
|
+
type VueI18nPreparer<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = never> = (input: VueI18nPrepareInput<TUnit, TTranslation, TBody, TUnavailable>) => Awaitable<VueI18nMessageProjection | null>;
|
|
640
|
+
/** 默认只提取字符串;各项检查自行判断所需一侧的正文可用性。 */
|
|
641
|
+
export declare function prepareVueI18nMessage<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable>(input: VueI18nPrepareInput<TUnit, TTranslation, TBody, TUnavailable>, adapter?: VueI18nPreparer<TUnit, TTranslation, TBody, TUnavailable>): Awaitable<VueI18nMessageProjection | null>;
|
|
642
|
+
type VueI18nQuantityPolicy = QuantityOptions & {
|
|
643
|
+
readonly profile?: string;
|
|
644
|
+
readonly byKey?: Readonly<Record<string, QuantityOptions>>;
|
|
645
|
+
};
|
|
646
|
+
type VueI18nScopeRule = {
|
|
647
|
+
readonly scope: string;
|
|
648
|
+
readonly keys?: readonly string[];
|
|
649
|
+
readonly keyPattern?: string;
|
|
650
|
+
readonly flags?: string;
|
|
651
|
+
};
|
|
652
|
+
/** 语法、变量与术语检查所需的最小语言范围。 */
|
|
653
|
+
type VueI18nLanguagePolicy = {
|
|
654
|
+
readonly sourceLanguage: string;
|
|
655
|
+
readonly targetLanguage: string;
|
|
656
|
+
};
|
|
657
|
+
/** Vue I18n 消息检查共用的语言、资源与规则策略。 */
|
|
658
|
+
type VueI18nPolicy = VueI18nLanguagePolicy & {
|
|
659
|
+
readonly resources: {
|
|
660
|
+
readonly source: {
|
|
661
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
662
|
+
readonly range: JsonValue;
|
|
663
|
+
};
|
|
664
|
+
readonly target: {
|
|
665
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
666
|
+
readonly range: JsonValue;
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
readonly quantities?: {
|
|
670
|
+
readonly source: VueI18nQuantityPolicy;
|
|
671
|
+
readonly target: VueI18nQuantityPolicy;
|
|
672
|
+
};
|
|
673
|
+
readonly protectedLiterals: Readonly<Record<string, readonly string[]>>;
|
|
674
|
+
readonly messageFamilies: {
|
|
675
|
+
readonly scopes: readonly VueI18nScopeRule[];
|
|
676
|
+
readonly targetEquivalences: readonly (readonly string[])[];
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
/** 每项策略允许只携带具体检查项使用的部分;必需字段由该项 schema 校验。 */
|
|
680
|
+
type VueI18nPolicyData = Pick<VueI18nPolicy, "sourceLanguage" | "targetLanguage"> & Partial<Pick<VueI18nPolicy, "resources" | "quantities" | "protectedLiterals" | "messageFamilies">>;
|
|
681
|
+
type VueI18nPolicyRequirement = "resources" | "quantities" | "protectedLiterals" | "messageFamilies";
|
|
682
|
+
/** 宿主按需读取 Vue I18n 检查资料;snapshot 与 memo 可用于选择读取范围。 */
|
|
683
|
+
type VueI18nDataReader<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable, TValue> = (snapshot: ProjectSnapshot<TUnit, TTranslation, TBody, TUnavailable>, memo: MemoScope) => Awaitable<TValue>;
|
|
684
|
+
type VueI18nMessageReference<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never> = MessageFamilyReferenceProjection<TUnit, TTranslation, TBody, TUnavailable> & {
|
|
685
|
+
readonly sourceUnit: SourceUnit<TUnit>;
|
|
686
|
+
readonly association: TranslationAssociation;
|
|
687
|
+
readonly translation: Translation<TTranslation, TBody, TUnavailable>;
|
|
688
|
+
};
|
|
689
|
+
type VueI18nReferenceProjector<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never> = (reference: VueI18nMessageReference<TUnit, TTranslation, TBody, TUnavailable>, input: MessageFamilyContext<TUnit, TTranslation, TBody, TUnavailable>) => VueI18nMessageProjection;
|
|
690
|
+
type VueI18nChecksOptions<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never> = {
|
|
691
|
+
/** 每候选准备一次 Vue 消息及其位置;未提供时沿用字符串正文默认适配。 */
|
|
692
|
+
readonly prepare?: VueI18nPreparer<TUnit, TTranslation, TBody, TUnavailable>;
|
|
693
|
+
/** 只提供语言范围;语法、变量和术语检查不要求消息族策略或术语容器。 */
|
|
694
|
+
readonly loadLanguages?: VueI18nDataReader<TUnit, TTranslation, TBody, TUnavailable, readonly VueI18nLanguagePolicy[]>;
|
|
695
|
+
/** 链接、数量、字面值和消息族检查只验证自己读取的策略字段。 */
|
|
696
|
+
readonly loadPolicies?: VueI18nDataReader<TUnit, TTranslation, TBody, TUnavailable, readonly VueI18nPolicyData[]>;
|
|
697
|
+
/** 术语检查读取原始术语库资料,并在共享计算范围内编译。 */
|
|
698
|
+
readonly loadTerms?: VueI18nDataReader<TUnit, TTranslation, TBody, TUnavailable, TermbaseData>;
|
|
699
|
+
/** 将已保存译文映射为 Vue I18n 消息,供消息族参照检查使用。 */
|
|
700
|
+
readonly reference: VueI18nReferenceProjector<TUnit, TTranslation, TBody, TUnavailable>;
|
|
701
|
+
};
|
|
702
|
+
/** 创建可直接放入 quality.checks 的 Vue I18n 消息检查集合。 */
|
|
703
|
+
export declare function createVueI18nChecks<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never>(options: VueI18nChecksOptions<TUnit, TTranslation, TBody, TUnavailable>): readonly [QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/source-syntax">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/target-syntax">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/variable-correspondence">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/link-target-exists">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/link-cycle">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/protected-literals">, QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/quantities">, ...QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "terminology/reject-forbidden-translation" | "terminology/require-allowed-translation">[], QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "message-family-consistency">];
|
|
704
|
+
type VueI18nSourceSyntaxCheckerOptions<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TId extends string = string> = {
|
|
705
|
+
readonly id: TId;
|
|
706
|
+
readonly prepare?: VueI18nPreparer<TUnit, TTranslation, TBody, TUnavailable>;
|
|
707
|
+
readonly loadLanguages?: VueI18nDataReader<TUnit, TTranslation, TBody, TUnavailable, readonly VueI18nLanguagePolicy[]>;
|
|
708
|
+
};
|
|
709
|
+
type VueI18nTargetSyntaxCheckerOptions<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TId extends string = string> = VueI18nSourceSyntaxCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TId>;
|
|
710
|
+
/** 按检查对象对应的共同消息投影检查原文语法(无译文候选时同样受检)。 */
|
|
711
|
+
export declare function createVueI18nSourceSyntaxChecker<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = never>(): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/source-syntax">;
|
|
712
|
+
export declare function createVueI18nSourceSyntaxChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, const TId extends string = string>(options: VueI18nSourceSyntaxCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TId>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
713
|
+
/** 按候选正文检查目标语法,允许原文正文不可用。 */
|
|
714
|
+
export declare function createVueI18nTargetSyntaxChecker<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = never>(): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/target-syntax">;
|
|
715
|
+
export declare function createVueI18nTargetSyntaxChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, const TId extends string = string>(options: VueI18nTargetSyntaxCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TId>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
716
|
+
type VueI18nVariableCorrespondenceCheckerOptions<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, TId extends string = string> = {
|
|
717
|
+
readonly id: TId;
|
|
718
|
+
readonly prepare?: VueI18nPreparer<TUnit, TTranslation, TBody, TUnavailable>;
|
|
719
|
+
readonly loadLanguages?: VueI18nDataReader<TUnit, TTranslation, TBody, TUnavailable, readonly VueI18nLanguagePolicy[]>;
|
|
720
|
+
};
|
|
721
|
+
/** 严格比较原译各分支中的命名与位置变量身份及出现次数。 */
|
|
722
|
+
export declare function createVueI18nVariableCorrespondenceChecker<TUnit extends TranslationUnitInput = TranslationUnitInput, TTranslation = unknown, TBody = unknown, TUnavailable = never>(): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, "vue-i18n/variable-correspondence">;
|
|
723
|
+
export declare function createVueI18nVariableCorrespondenceChecker<TUnit extends TranslationUnitInput, TTranslation, TBody, TUnavailable = never, const TId extends string = string>(options: VueI18nVariableCorrespondenceCheckerOptions<TUnit, TTranslation, TBody, TUnavailable, TId>): QualityCheckDefinition<TUnit, TTranslation, QualityObject, TBody, TUnavailable, TId>;
|
|
724
|
+
export { type Awaitable, type BodyAvailability, type CheckerDefinition, type CheckerLoadInput, type CheckerPrepareInput, type Compare, type CompareInput, type ComparisonBaseline, ComparisonBaselineFormatError, ComparisonBaselineIncompleteSnapshotError, type ComparisonBaselineSelection, type ComparisonBaselineStore, ComparisonContractError, type ComparisonResult, type ComparisonSnapshot, type ComparisonStatus, type CompiledTerms, type CoverageStatus, type CreateQaSuppressionInput, type DiscoverTermsOptions, DuplicateTranslationUnitKeyError, type EnumerationCompleteness, type FrameworkConfig, type JsonValue, type LanguageSelectionOptions, type MemoOptions, type MemoScope, MemoScopeClosedError, type MessageFamilyCheckerOptions, type MessageFamilyComparison, type MessageFamilyContext, type MessageFamilyInput, type MessageFamilyIssue, type MessageFamilyLimits, type MessageFamilyReference, type MessageFamilyReferenceProjection, type MessageFamilySignature, type MessageFragment, type NormalizedText, type NumberCheckerOptions, type NumberCheckerPreparation, type NumberTextInput, type ProjectSnapshot, type ProtectedLiteralIssue, type QaSuppression, type QaSuppressionExecution, type QaSuppressionFile, type QaSuppressionFingerprintSummary, QaSuppressionFormatError, type QaSuppressionFormatErrorReason, type QaSuppressionStore, type QualityCheckDefinition, type QualityCheckExecution, type QualityCheckResult, type QualityCheckResultCache, type QualityCheckScope, QualityCheckerContractError, type QualityConfiguration, type QualityCoverage, type QualityDataLoadInput, type QualityDataReader, QualityDataReaderContractError, type QualityDiagnostic, type QualityEvidence, type QualityFinding, type QualityLocation, type QualityObject, type QualityProfileCache, type QualityProfileCandidate, type QualityProfileCandidateStatus, type QualityProfileCheck, type QualityProfileReport, type QualityProfileStage, type QualityProfileTiming, type QualityProfiler, type QualityProfilerOptions, type QualityReadCoverage, type QualityRelationship, type QualityReportDecision, type QualityReportDecisionStatus, type QualityReportFormatOptions, type QualityRunResult, type QualitySubject, type QuantityBranch, type QuantityBranchIssue, type QuantityOptions, type QuantityProfile, type ReadRecord, type ReadScope, type RecognitionInput, type RecognitionResult, type RecordComparisonBaselineResult, type RegexTokenOptions, type SignaturePart, type SlotIdentity, type SnapshotReadEvidence, type SourceAdapter, type SourceChange, type SourceRead, type SourceReadCoverage, type SourceSnapshot, type SourceUnit, StandardSchemaContractError, type StandardSchemaFailureKind, type StandardSchemaV1, type StandardSchemaV1Issue, type StandardSchemaV1Result, type StructureAnalysis, type TemplateOptions, type TemplateSignature, type TemplateSlot, type TermAmbiguity, type TermAnalysisIssue, type TermAssessment, type TermAssessmentIssue, type TermAssessmentOptions, type TermBoundaryInput, type TermCandidate, type TermCandidateGenerationInput, type TermCandidateGenerator, type TermCandidateOccurrence, type TermCandidateRankResult, type TermCandidateRanker, type TermCandidateRanking, type TermCheckerGroupLocations, type TermCheckerInput, type TermCheckerLoaded, type TermCheckerLocationInput, type TermCheckerOptions, type TermCheckerPreparation, type TermComparisonGroup, type TermComparisonInput, type TermConceptData, TermContractError, type TermContractIssue, type TermCorpusEntry, type TermDiscovery, type TermDiscoveryIssue, type TermExpression, type TermExpressionData, type TermFragment, type TermGroupAnalysis, type TermLanguageData, type TermMatch, type TermMatchingPolicy, type TermProblem, type TermRange, type TermRule, type TermRuleId, type TermRulesConfiguration, type TermRuntime, type TermSelection, type TermTextInput, type TermType, type TermUsage, type TermUseAnalysis, type Termbase, type TermbaseData, TermbaseYamlError, type TermbaseYamlFiles, type TermbaseYamlIssue, type TextAnalysis, type TextAnalysisIssue, type TextInput, type TextRange, type TextRecognizer, type TextToken, type Translation, type TranslationAdapter, type TranslationAssociation, type TranslationAssociationStatus, type TranslationCandidate, type TranslationChange, type TranslationIdentity, TranslationIdentityContractError, type TranslationProgress, type TranslationRead, type TranslationReadCoverage, type TranslationReadScope, type TranslationReadScopeCoverage, type TranslationUnitInput, type TranslationWriteBatchResult, type TranslationWriteCondition, type TranslationWriteConditionInput, type TranslationWriteConditionResult, type TranslationWriteRequest, type TranslationWriteResult, type TranslationWriteSourceExpectation, type TranslationWriteStatus, type TranslationWriteTarget, type TranslationWriteTargetExpectation, type TranslationWritebackAdapter, type TranslationWritebackInput, type TranslationWritebackResolution, type TranslationWritebackTarget, type UpdatePlan, type UpdatePlanAction, type UpdatePlanApplyResult, type UpdatePlanAssociations, type UpdatePlanComparisons, type UpdatePlanData, type UpdatePlanExecutionItemResult, type UpdatePlanExecutionStatus, type UpdatePlanInput, type UpdatePlanItem, type UpdatePlanSourceChange, type UpdatePlanTranslationChange, type UpdatePlanWriteRequest, type UpdatePolicy, type UpdateResult, type UpdateSourceExpectation, type UpdateTargetExpectation, type VueI18nChecksOptions, type VueI18nDataReader, type VueI18nLanguagePolicy, type VueI18nMessageProjection, type VueI18nPolicy, type VueI18nPolicyData, type VueI18nPolicyRequirement, type VueI18nPrepareInput, type VueI18nPreparer, type VueI18nQuantityPolicy, type VueI18nReferenceProjector, type VueI18nScopeRule, type WordAnalysis, type WordSegmenter, type WordToken, applyUpdatePlan, compareSnapshots, createMemoScope, createQaSuppression, createQualityProfiler, createTermbase, createUpdatePlan, decideQualityReport, defaultCompare, defaultUpdatePolicy, defineChecker, defineConfig, formatQualityReport, isQualityReportPassing, parseTermbaseYaml, previewUpdate, readComparisonSnapshot, readProjectSnapshot, readSourceSnapshot, recordComparisonBaseline, replaceComparisonBaseline, runQa, selectTerms, update, upsertQaSuppressionFromReport, validateComparisonBaseline, validateComparisonInput, validateComparisonResult, validateQaSuppression, validateQaSuppressionFile, validateQaSuppressions, validateTranslationCandidate, validateTranslationWriteRequest, validateUpdatePlan, writeTranslationRequests };
|