champollion 0.3.4 → 0.4.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 +41 -26
- package/bin/cli.js +53 -5
- package/index.js +63 -2
- package/lib/api-key.js +17 -4
- package/lib/autofix.js +83 -36
- package/lib/bridge/method_bridge.py +15 -3
- package/lib/cards/reader.js +34 -0
- package/lib/cards/remote.js +15 -0
- package/lib/cards/search-names.js +178 -0
- package/lib/command-help.js +286 -85
- package/lib/commands/audit.js +10 -3
- package/lib/commands/card.js +583 -226
- package/lib/commands/doctor.js +54 -18
- package/lib/commands/help.js +37 -32
- package/lib/commands/init.js +1689 -87
- package/lib/commands/integrity.js +127 -40
- package/lib/commands/leaderboard.js +187 -67
- package/lib/commands/models.js +9 -2
- package/lib/commands/provenance.js +7 -2
- package/lib/commands/recommend.js +43 -14
- package/lib/commands/register-corpus.js +632 -125
- package/lib/commands/seal-corpus.js +1 -1
- package/lib/commands/status.js +564 -27
- package/lib/commands/submit.js +17 -12
- package/lib/commands/sync.js +31 -7
- package/lib/commands/tm.js +15 -9
- package/lib/commands/verify.js +27 -3
- package/lib/commands/wrap.js +63 -5
- package/lib/commands/xliff.js +135 -64
- package/lib/commercial-eligibility.js +1 -1
- package/lib/config.js +196 -14
- package/lib/content-estimate.js +96 -0
- package/lib/content-refusals.js +270 -0
- package/lib/content-review.js +372 -0
- package/lib/content-sync.js +1127 -344
- package/lib/content.js +94 -7
- package/lib/corpus-registration.mjs +194 -35
- package/lib/cost-label.js +29 -0
- package/lib/cost-report.js +726 -78
- package/lib/diff.js +38 -4
- package/lib/docusaurus-sync.js +965 -253
- package/lib/edit-distance.js +31 -0
- package/lib/fallback.js +964 -0
- package/lib/file-scope.js +106 -0
- package/lib/flatten.js +80 -3
- package/lib/flutter-locales.js +124 -0
- package/lib/format.js +266 -12
- package/lib/hash.js +146 -21
- package/lib/icu-structure.js +929 -0
- package/lib/integrity.js +223 -75
- package/lib/language-pair.js +157 -0
- package/lib/lint.js +78 -16
- package/lib/local-only-marks.js +106 -0
- package/lib/locale-layout.js +1103 -0
- package/lib/locale-state.js +571 -0
- package/lib/methods/anthropic.js +5 -0
- package/lib/methods/apertium.js +6 -3
- package/lib/methods/api.js +138 -25
- package/lib/methods/base.js +17 -0
- package/lib/methods/coaching-data.js +153 -0
- package/lib/methods/content-separator.js +43 -0
- package/lib/methods/deepl.js +1 -1
- package/lib/methods/direct-llm.js +252 -103
- package/lib/methods/external.js +146 -63
- package/lib/methods/gemini.js +1 -0
- package/lib/methods/google-translate.js +1 -0
- package/lib/methods/http-utils.js +41 -0
- package/lib/methods/libretranslate.js +7 -2
- package/lib/methods/llm-coached.js +68 -128
- package/lib/methods/llm.js +80 -31
- package/lib/methods/local.js +93 -10
- package/lib/methods/microsoft-translator.js +1 -2
- package/lib/methods/openai.js +4 -2
- package/lib/methods/openrouter-client.js +20 -19
- package/lib/methods/openrouter-pricing.js +150 -13
- package/lib/methods/prompt-methods.js +20 -0
- package/lib/methods/provider-pricing.js +42 -1
- package/lib/methods/request-capture.js +104 -0
- package/lib/methods/tilde.js +1 -1
- package/lib/methods/translated.js +1 -2
- package/lib/missing-key.js +93 -0
- package/lib/models.js +11 -0
- package/lib/name-rules.js +32 -0
- package/lib/named-keys.js +172 -0
- package/lib/no-translate.js +4 -3
- package/lib/output.js +160 -19
- package/lib/pairs.js +586 -30
- package/lib/placeholders.js +394 -0
- package/lib/plugins.js +8 -0
- package/lib/plural-gap-redo.js +109 -0
- package/lib/plurals.js +323 -0
- package/lib/po.js +1187 -0
- package/lib/public-catalogue.js +74 -0
- package/lib/recommend.js +527 -32
- package/lib/redo.js +95 -0
- package/lib/refusal-category.js +44 -0
- package/lib/registers.js +255 -11
- package/lib/repair-script.js +20 -13
- package/lib/scripts.js +6 -1
- package/lib/seal.mjs +4 -3
- package/lib/sealed-qualifier.mjs +1 -1
- package/lib/segment.js +2 -1
- package/lib/seo.js +19 -9
- package/lib/serve.js +43 -6
- package/lib/shared-output-seed.js +164 -0
- package/lib/source-contexts.js +39 -0
- package/lib/submit.mjs +57 -5
- package/lib/sync.js +2923 -474
- package/lib/terminology.js +13 -4
- package/lib/tm-evict.js +179 -0
- package/lib/tm-seed.js +5 -2
- package/lib/tm.js +818 -36
- package/lib/translate-pair.js +639 -34
- package/lib/translate.js +78 -5
- package/lib/types.js +22 -3
- package/lib/validate.js +880 -17
- package/lib/verify.js +1296 -104
- package/lib/watch.js +32 -13
- package/lib/xliff.js +44 -3
- package/package.json +1 -1
- package/shared/CORPORA-CARDS.md +2 -0
- package/shared/cards-fallback.json +1 -1
- package/shared/curated-orthography-conventions.json +26 -8
- package/shared/gettext-plural-forms.json +45 -0
- package/shared/method-registry.json +2 -0
- package/shared/metric-registry.json +96 -18
- package/shared/schemas/champollion-plugin.schema.json +4 -0
- package/shared/schemas/corpora-card.schema.json +8 -2
- package/shared/schemas/method-index-record.schema.json +67 -0
- package/shared/schemas/method-registry.schema.json +4 -0
- package/shared/schemas/metric-registry.schema.json +55 -1
- package/shared/docent/corpus.json +0 -11739
|
@@ -1,36 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command: recommend
|
|
3
3
|
*
|
|
4
|
-
* Method guidance for a language pair — availability + cited evidence
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Method guidance for a language pair — availability + cited evidence, and
|
|
5
|
+
* the open models whose own model card declares the target (runnable via
|
|
6
|
+
* local-model, no published evidence: a claim to benchmark — the same
|
|
7
|
+
* candidates the MCP language_overview suggests). CLI port of `mt-eval
|
|
8
|
+
* recommend` (arena/mt_eval_harness/recommend.py); the assembly/honesty
|
|
9
|
+
* logic lives in lib/recommend.js.
|
|
7
10
|
*
|
|
8
11
|
* Usage:
|
|
9
|
-
* champollion recommend eng yor # Human-readable guidance
|
|
10
|
-
* champollion recommend eng
|
|
11
|
-
* champollion recommend eng
|
|
12
|
+
* champollion network recommend eng yor # Human-readable guidance
|
|
13
|
+
* champollion network recommend eng-yor # the same pair, written as one
|
|
14
|
+
* champollion network recommend "eng>yor" # (or --pair "eng>yor")
|
|
15
|
+
* champollion network recommend eng yor --use commercial # STRICT commercial lane
|
|
16
|
+
* champollion network recommend eng yor --json # Machine-readable payload
|
|
12
17
|
*/
|
|
13
18
|
|
|
14
19
|
import { output } from '../output.js';
|
|
15
20
|
import { recommend, renderText } from '../recommend.js';
|
|
16
21
|
import { resolveCode } from '../registers.js';
|
|
22
|
+
import { parseLanguagePair } from '../language-pair.js';
|
|
17
23
|
|
|
18
24
|
const USE_CONTEXTS = ['non-commercial', 'commercial'];
|
|
19
25
|
|
|
26
|
+
function usageError(why) {
|
|
27
|
+
output.error(why);
|
|
28
|
+
output.error('Usage: champollion network recommend <src> <tgt> [--use commercial] [--json]');
|
|
29
|
+
output.error(' or: champollion network recommend eng-yor (or "eng>yor", or --pair "eng>yor")');
|
|
30
|
+
output.error('Example: champollion network recommend eng yor');
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The pair, from two codes (`recommend eng yor`) or one pair in any spelling
|
|
36
|
+
* lib/language-pair.js reads (`recommend eng-yor`, `recommend "eng>yor"`,
|
|
37
|
+
* `--pair eng-yor`) — Round 10: the other network commands took a pair as
|
|
38
|
+
* one value, and `recommend eng-crk` answered "requires a source and target".
|
|
39
|
+
*
|
|
40
|
+
* @returns {{ok: true, source: string, target: string} | {ok: false, error: string}}
|
|
41
|
+
*/
|
|
42
|
+
function readPairArgs(args) {
|
|
43
|
+
const words = args._.slice(1);
|
|
44
|
+
if (args.pair !== undefined && args.pair !== false) {
|
|
45
|
+
if (words.length > 0) return { ok: false, error: `Give the pair once: --pair ${args.pair === true ? '' : args.pair} or ${words.join(' ')}, not both.` };
|
|
46
|
+
return parseLanguagePair(args.pair, { label: '--pair' });
|
|
47
|
+
}
|
|
48
|
+
if (words.length >= 2) return { ok: true, source: words[0], target: words[1] };
|
|
49
|
+
if (words.length === 1) return parseLanguagePair(words[0], { label: 'recommend' });
|
|
50
|
+
return { ok: false, error: 'recommend requires a source and target language code.' };
|
|
51
|
+
}
|
|
52
|
+
|
|
20
53
|
/**
|
|
21
54
|
* @param {import('../types.js').CLIArgs} args - Parsed CLI arguments
|
|
22
55
|
* @param {string} cwd - Working directory
|
|
23
56
|
* @returns {Promise<number>} Exit code (0 = success, 1 = error)
|
|
24
57
|
*/
|
|
25
58
|
async function run(args, cwd) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
output.error('Usage: champollion recommend <src> <tgt> [--use commercial] [--json]');
|
|
31
|
-
output.error('Example: champollion recommend eng yor');
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
59
|
+
const pairIn = readPairArgs(args);
|
|
60
|
+
if (!pairIn.ok) return usageError(pairIn.error);
|
|
61
|
+
const srcInput = pairIn.source;
|
|
62
|
+
const tgtInput = pairIn.target;
|
|
34
63
|
|
|
35
64
|
// The evidence indexes are keyed by ISO 639-3; accept the 2-letter codes a
|
|
36
65
|
// champollion.config.json uses (en → eng, zh → cmn) via the language-card
|