mtranserver 4.0.29 → 4.0.31
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/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/index.js +60 -8
- package/dist/main.js +67 -12
- package/dist/services/detector.d.ts.map +1 -1
- package/dist/services/engine.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAkFD,wBAAgB,SAAS,IAAI,MAAM,CA4ClC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,QAGhD;AAED,wBAAgB,WAAW,SAG1B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,QAOrD;AAED,wBAAgB,eAAe,SAU9B"}
|
package/dist/index.js
CHANGED
|
@@ -149,6 +149,7 @@ function getConfig() {
|
|
|
149
149
|
workerIdleTimeout: getInt("--worker-idle-timeout", "MT_WORKER_IDLE_TIMEOUT", fileConfig.workerIdleTimeout ?? 60),
|
|
150
150
|
workersPerLanguage: getInt("--workers-per-language", "MT_WORKERS_PER_LANGUAGE", fileConfig.workersPerLanguage ?? 1),
|
|
151
151
|
maxSentenceLength: getInt("--max-sentence-length", "MT_MAX_SENTENCE_LENGTH", fileConfig.maxSentenceLength ?? 512),
|
|
152
|
+
fullwidthZhPunctuation: getBool("--fullwidth-zh-punctuation", "MT_FULLWIDTH_ZH_PUNCTUATION", fileConfig.fullwidthZhPunctuation ?? true),
|
|
152
153
|
apiToken: getString("--api-token", "MT_API_TOKEN", fileConfig.apiToken || ""),
|
|
153
154
|
logToFile: getBool("--log-to-file", "MT_LOG_TO_FILE", fileConfig.logToFile ?? false),
|
|
154
155
|
logConsole: getBool("--log-console", "MT_LOG_CONSOLE", fileConfig.logConsole ?? true),
|
|
@@ -5348,6 +5349,23 @@ function getScriptType(text) {
|
|
|
5348
5349
|
return "Latin";
|
|
5349
5350
|
return "Other";
|
|
5350
5351
|
}
|
|
5352
|
+
function getDominantScript(text) {
|
|
5353
|
+
let cjkCount = 0;
|
|
5354
|
+
let latinCount = 0;
|
|
5355
|
+
for (const char of text) {
|
|
5356
|
+
const code = char.charCodeAt(0);
|
|
5357
|
+
if (code >= 19968 && code <= 40959 || code >= 12352 && code <= 12447 || code >= 12448 && code <= 12543 || code >= 44032 && code <= 55215) {
|
|
5358
|
+
cjkCount++;
|
|
5359
|
+
} else if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
5360
|
+
latinCount++;
|
|
5361
|
+
}
|
|
5362
|
+
}
|
|
5363
|
+
if (cjkCount > latinCount)
|
|
5364
|
+
return "CJK";
|
|
5365
|
+
if (latinCount > cjkCount)
|
|
5366
|
+
return "Latin";
|
|
5367
|
+
return "Other";
|
|
5368
|
+
}
|
|
5351
5369
|
async function detectMultipleLanguages(text) {
|
|
5352
5370
|
return detectMultipleLanguagesWithThreshold(text, DEFAULT_CONFIDENCE_THRESHOLD);
|
|
5353
5371
|
}
|
|
@@ -5398,6 +5416,25 @@ async function detectMultipleLanguagesWithThreshold(text, threshold) {
|
|
|
5398
5416
|
finalLang = detectedLang;
|
|
5399
5417
|
usedLogic = "script-override-cjk";
|
|
5400
5418
|
}
|
|
5419
|
+
} else if (scriptType === "Mixed") {
|
|
5420
|
+
const dominant = getDominantScript(segment);
|
|
5421
|
+
if (dominant === "CJK") {
|
|
5422
|
+
if (detectedLang && isCJKCode(detectedLang)) {
|
|
5423
|
+
finalLang = detectedLang;
|
|
5424
|
+
usedLogic = "mixed-dominant-cjk-detected";
|
|
5425
|
+
} else {
|
|
5426
|
+
finalLang = "zh-Hans";
|
|
5427
|
+
usedLogic = "mixed-dominant-cjk-default";
|
|
5428
|
+
}
|
|
5429
|
+
} else if (dominant === "Latin") {
|
|
5430
|
+
if (detectedLang && detectedLang !== "un" && !isCJKCode(detectedLang)) {
|
|
5431
|
+
finalLang = detectedLang;
|
|
5432
|
+
usedLogic = "mixed-dominant-latin-detected";
|
|
5433
|
+
} else {
|
|
5434
|
+
finalLang = "en";
|
|
5435
|
+
usedLogic = "mixed-dominant-latin-default";
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5401
5438
|
}
|
|
5402
5439
|
}
|
|
5403
5440
|
debug(`Segment[${segments.length}]: "${segment.replace(/\n/g, "\\n")}" -> lang=${detectedLang}, conf=${confidence.toFixed(2)}, script=${scriptType}, final=${finalLang} (${usedLogic})`);
|
|
@@ -5516,6 +5553,15 @@ var init_cache = __esm(() => {
|
|
|
5516
5553
|
import path6 from "path";
|
|
5517
5554
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5518
5555
|
import { readFile as readFile2 } from "fs/promises";
|
|
5556
|
+
function formatChinesePunctuation(text, toLang, isHTML, enabled) {
|
|
5557
|
+
if (!enabled || isHTML || !toLang.startsWith("zh")) {
|
|
5558
|
+
return text;
|
|
5559
|
+
}
|
|
5560
|
+
if (!zhPunctTest.test(text)) {
|
|
5561
|
+
return text;
|
|
5562
|
+
}
|
|
5563
|
+
return text.replace(zhPunctGlobal, (ch) => String.fromCharCode(ch.charCodeAt(0) + 65248));
|
|
5564
|
+
}
|
|
5519
5565
|
function needsPivotTranslation(fromLang, toLang) {
|
|
5520
5566
|
if (fromLang === "en" || toLang === "en") {
|
|
5521
5567
|
return false;
|
|
@@ -5650,13 +5696,15 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
|
|
|
5650
5696
|
}
|
|
5651
5697
|
async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
5652
5698
|
debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
|
|
5699
|
+
const config2 = getConfig();
|
|
5700
|
+
const shouldFullwidth = config2.fullwidthZhPunctuation ?? true;
|
|
5653
5701
|
if (fromLang !== "auto" && fromLang === toLang) {
|
|
5654
|
-
return text;
|
|
5702
|
+
return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
|
|
5655
5703
|
}
|
|
5656
5704
|
if (fromLang !== "auto" && text.length <= 512) {
|
|
5657
|
-
|
|
5705
|
+
const translated = await translateSegment(fromLang, toLang, text, isHTML);
|
|
5706
|
+
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5658
5707
|
}
|
|
5659
|
-
const config2 = getConfig();
|
|
5660
5708
|
const segments = await detectMultipleLanguages(text);
|
|
5661
5709
|
if (segments.length <= 1) {
|
|
5662
5710
|
let effectiveFromLang;
|
|
@@ -5672,12 +5720,14 @@ async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
|
5672
5720
|
effectiveFromLang = fromLang;
|
|
5673
5721
|
}
|
|
5674
5722
|
if (effectiveFromLang === toLang) {
|
|
5675
|
-
return text;
|
|
5723
|
+
return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
|
|
5676
5724
|
}
|
|
5677
5725
|
if (text.length > config2.maxSentenceLength && !isHTML) {
|
|
5678
|
-
|
|
5726
|
+
const translated2 = await translateLongText(effectiveFromLang, toLang, text);
|
|
5727
|
+
return formatChinesePunctuation(translated2, toLang, isHTML, shouldFullwidth);
|
|
5679
5728
|
}
|
|
5680
|
-
|
|
5729
|
+
const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5730
|
+
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5681
5731
|
}
|
|
5682
5732
|
debug(`Detected ${segments.length} language segments`);
|
|
5683
5733
|
let result = "";
|
|
@@ -5702,7 +5752,7 @@ async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
|
5702
5752
|
if (lastEnd < text.length) {
|
|
5703
5753
|
result += text.substring(lastEnd);
|
|
5704
5754
|
}
|
|
5705
|
-
return result;
|
|
5755
|
+
return formatChinesePunctuation(result, toLang, isHTML, shouldFullwidth);
|
|
5706
5756
|
}
|
|
5707
5757
|
async function translateLongText(fromLang, toLang, text) {
|
|
5708
5758
|
debug(`Splitting long text (${text.length} chars) into sentences`);
|
|
@@ -5737,7 +5787,7 @@ function cleanupAllEngines() {
|
|
|
5737
5787
|
engines.clear();
|
|
5738
5788
|
info("All engines cleaned up successfully");
|
|
5739
5789
|
}
|
|
5740
|
-
var import_bergamot_translator, engines, loadingPromises;
|
|
5790
|
+
var import_bergamot_translator, engines, loadingPromises, zhPunctTest, zhPunctGlobal;
|
|
5741
5791
|
var init_engine2 = __esm(() => {
|
|
5742
5792
|
init_engine();
|
|
5743
5793
|
init_factory();
|
|
@@ -5750,6 +5800,8 @@ var init_engine2 = __esm(() => {
|
|
|
5750
5800
|
import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
|
|
5751
5801
|
engines = new Map;
|
|
5752
5802
|
loadingPromises = new Map;
|
|
5803
|
+
zhPunctTest = /[!-/:-@[-`{-~]/;
|
|
5804
|
+
zhPunctGlobal = /[!-/:-@[-`{-~]/g;
|
|
5753
5805
|
});
|
|
5754
5806
|
|
|
5755
5807
|
// src/services/index.ts
|
package/dist/main.js
CHANGED
|
@@ -150,6 +150,7 @@ function getConfig() {
|
|
|
150
150
|
workerIdleTimeout: getInt("--worker-idle-timeout", "MT_WORKER_IDLE_TIMEOUT", fileConfig.workerIdleTimeout ?? 60),
|
|
151
151
|
workersPerLanguage: getInt("--workers-per-language", "MT_WORKERS_PER_LANGUAGE", fileConfig.workersPerLanguage ?? 1),
|
|
152
152
|
maxSentenceLength: getInt("--max-sentence-length", "MT_MAX_SENTENCE_LENGTH", fileConfig.maxSentenceLength ?? 512),
|
|
153
|
+
fullwidthZhPunctuation: getBool("--fullwidth-zh-punctuation", "MT_FULLWIDTH_ZH_PUNCTUATION", fileConfig.fullwidthZhPunctuation ?? true),
|
|
153
154
|
apiToken: getString("--api-token", "MT_API_TOKEN", fileConfig.apiToken || ""),
|
|
154
155
|
logToFile: getBool("--log-to-file", "MT_LOG_TO_FILE", fileConfig.logToFile ?? false),
|
|
155
156
|
logConsole: getBool("--log-console", "MT_LOG_CONSOLE", fileConfig.logConsole ?? true),
|
|
@@ -5349,6 +5350,23 @@ function getScriptType(text) {
|
|
|
5349
5350
|
return "Latin";
|
|
5350
5351
|
return "Other";
|
|
5351
5352
|
}
|
|
5353
|
+
function getDominantScript(text) {
|
|
5354
|
+
let cjkCount = 0;
|
|
5355
|
+
let latinCount = 0;
|
|
5356
|
+
for (const char of text) {
|
|
5357
|
+
const code = char.charCodeAt(0);
|
|
5358
|
+
if (code >= 19968 && code <= 40959 || code >= 12352 && code <= 12447 || code >= 12448 && code <= 12543 || code >= 44032 && code <= 55215) {
|
|
5359
|
+
cjkCount++;
|
|
5360
|
+
} else if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
5361
|
+
latinCount++;
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
if (cjkCount > latinCount)
|
|
5365
|
+
return "CJK";
|
|
5366
|
+
if (latinCount > cjkCount)
|
|
5367
|
+
return "Latin";
|
|
5368
|
+
return "Other";
|
|
5369
|
+
}
|
|
5352
5370
|
async function detectMultipleLanguages(text) {
|
|
5353
5371
|
return detectMultipleLanguagesWithThreshold(text, DEFAULT_CONFIDENCE_THRESHOLD);
|
|
5354
5372
|
}
|
|
@@ -5399,6 +5417,25 @@ async function detectMultipleLanguagesWithThreshold(text, threshold) {
|
|
|
5399
5417
|
finalLang = detectedLang;
|
|
5400
5418
|
usedLogic = "script-override-cjk";
|
|
5401
5419
|
}
|
|
5420
|
+
} else if (scriptType === "Mixed") {
|
|
5421
|
+
const dominant = getDominantScript(segment);
|
|
5422
|
+
if (dominant === "CJK") {
|
|
5423
|
+
if (detectedLang && isCJKCode(detectedLang)) {
|
|
5424
|
+
finalLang = detectedLang;
|
|
5425
|
+
usedLogic = "mixed-dominant-cjk-detected";
|
|
5426
|
+
} else {
|
|
5427
|
+
finalLang = "zh-Hans";
|
|
5428
|
+
usedLogic = "mixed-dominant-cjk-default";
|
|
5429
|
+
}
|
|
5430
|
+
} else if (dominant === "Latin") {
|
|
5431
|
+
if (detectedLang && detectedLang !== "un" && !isCJKCode(detectedLang)) {
|
|
5432
|
+
finalLang = detectedLang;
|
|
5433
|
+
usedLogic = "mixed-dominant-latin-detected";
|
|
5434
|
+
} else {
|
|
5435
|
+
finalLang = "en";
|
|
5436
|
+
usedLogic = "mixed-dominant-latin-default";
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5402
5439
|
}
|
|
5403
5440
|
}
|
|
5404
5441
|
debug(`Segment[${segments.length}]: "${segment.replace(/\n/g, "\\n")}" -> lang=${detectedLang}, conf=${confidence.toFixed(2)}, script=${scriptType}, final=${finalLang} (${usedLogic})`);
|
|
@@ -5517,6 +5554,15 @@ var init_cache = __esm(() => {
|
|
|
5517
5554
|
import path6 from "path";
|
|
5518
5555
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5519
5556
|
import { readFile as readFile2 } from "fs/promises";
|
|
5557
|
+
function formatChinesePunctuation(text, toLang, isHTML, enabled) {
|
|
5558
|
+
if (!enabled || isHTML || !toLang.startsWith("zh")) {
|
|
5559
|
+
return text;
|
|
5560
|
+
}
|
|
5561
|
+
if (!zhPunctTest.test(text)) {
|
|
5562
|
+
return text;
|
|
5563
|
+
}
|
|
5564
|
+
return text.replace(zhPunctGlobal, (ch) => String.fromCharCode(ch.charCodeAt(0) + 65248));
|
|
5565
|
+
}
|
|
5520
5566
|
function needsPivotTranslation(fromLang, toLang) {
|
|
5521
5567
|
if (fromLang === "en" || toLang === "en") {
|
|
5522
5568
|
return false;
|
|
@@ -5651,13 +5697,15 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
|
|
|
5651
5697
|
}
|
|
5652
5698
|
async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
5653
5699
|
debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
|
|
5700
|
+
const config2 = getConfig();
|
|
5701
|
+
const shouldFullwidth = config2.fullwidthZhPunctuation ?? true;
|
|
5654
5702
|
if (fromLang !== "auto" && fromLang === toLang) {
|
|
5655
|
-
return text;
|
|
5703
|
+
return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
|
|
5656
5704
|
}
|
|
5657
5705
|
if (fromLang !== "auto" && text.length <= 512) {
|
|
5658
|
-
|
|
5706
|
+
const translated = await translateSegment(fromLang, toLang, text, isHTML);
|
|
5707
|
+
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5659
5708
|
}
|
|
5660
|
-
const config2 = getConfig();
|
|
5661
5709
|
const segments = await detectMultipleLanguages(text);
|
|
5662
5710
|
if (segments.length <= 1) {
|
|
5663
5711
|
let effectiveFromLang;
|
|
@@ -5673,12 +5721,14 @@ async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
|
5673
5721
|
effectiveFromLang = fromLang;
|
|
5674
5722
|
}
|
|
5675
5723
|
if (effectiveFromLang === toLang) {
|
|
5676
|
-
return text;
|
|
5724
|
+
return formatChinesePunctuation(text, toLang, isHTML, shouldFullwidth);
|
|
5677
5725
|
}
|
|
5678
5726
|
if (text.length > config2.maxSentenceLength && !isHTML) {
|
|
5679
|
-
|
|
5727
|
+
const translated2 = await translateLongText(effectiveFromLang, toLang, text);
|
|
5728
|
+
return formatChinesePunctuation(translated2, toLang, isHTML, shouldFullwidth);
|
|
5680
5729
|
}
|
|
5681
|
-
|
|
5730
|
+
const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5731
|
+
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5682
5732
|
}
|
|
5683
5733
|
debug(`Detected ${segments.length} language segments`);
|
|
5684
5734
|
let result = "";
|
|
@@ -5703,7 +5753,7 @@ async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
|
5703
5753
|
if (lastEnd < text.length) {
|
|
5704
5754
|
result += text.substring(lastEnd);
|
|
5705
5755
|
}
|
|
5706
|
-
return result;
|
|
5756
|
+
return formatChinesePunctuation(result, toLang, isHTML, shouldFullwidth);
|
|
5707
5757
|
}
|
|
5708
5758
|
async function translateLongText(fromLang, toLang, text) {
|
|
5709
5759
|
debug(`Splitting long text (${text.length} chars) into sentences`);
|
|
@@ -5738,7 +5788,7 @@ function cleanupAllEngines() {
|
|
|
5738
5788
|
engines.clear();
|
|
5739
5789
|
info("All engines cleaned up successfully");
|
|
5740
5790
|
}
|
|
5741
|
-
var import_bergamot_translator, engines, loadingPromises;
|
|
5791
|
+
var import_bergamot_translator, engines, loadingPromises, zhPunctTest, zhPunctGlobal;
|
|
5742
5792
|
var init_engine2 = __esm(() => {
|
|
5743
5793
|
init_engine();
|
|
5744
5794
|
init_factory();
|
|
@@ -5751,6 +5801,8 @@ var init_engine2 = __esm(() => {
|
|
|
5751
5801
|
import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
|
|
5752
5802
|
engines = new Map;
|
|
5753
5803
|
loadingPromises = new Map;
|
|
5804
|
+
zhPunctTest = /[!-/:-@[-`{-~]/;
|
|
5805
|
+
zhPunctGlobal = /[!-/:-@[-`{-~]/g;
|
|
5754
5806
|
});
|
|
5755
5807
|
|
|
5756
5808
|
// src/services/index.ts
|
|
@@ -213878,7 +213930,7 @@ __export(exports_version, {
|
|
|
213878
213930
|
function getVersion() {
|
|
213879
213931
|
return VERSION;
|
|
213880
213932
|
}
|
|
213881
|
-
var VERSION = "4.0.
|
|
213933
|
+
var VERSION = "4.0.31";
|
|
213882
213934
|
|
|
213883
213935
|
// src/server/index.ts
|
|
213884
213936
|
init_config();
|
|
@@ -214196,7 +214248,7 @@ class ImmeController extends import_tsoa5.Controller {
|
|
|
214196
214248
|
this.setStatus(401);
|
|
214197
214249
|
throw new Error("Unauthorized");
|
|
214198
214250
|
}
|
|
214199
|
-
const sourceLang =
|
|
214251
|
+
const sourceLang = "auto";
|
|
214200
214252
|
const targetLang = NormalizeLanguageCode2(body.target_lang);
|
|
214201
214253
|
const translations = [];
|
|
214202
214254
|
for (let i = 0;i < body.text_list.length; i++) {
|
|
@@ -215680,7 +215732,7 @@ var swagger_default = {
|
|
|
215680
215732
|
},
|
|
215681
215733
|
info: {
|
|
215682
215734
|
title: "MTranServer API",
|
|
215683
|
-
version: "4.0.
|
|
215735
|
+
version: "4.0.31",
|
|
215684
215736
|
description: "Translation server API",
|
|
215685
215737
|
license: {
|
|
215686
215738
|
name: "Apache-2.0"
|
|
@@ -216411,6 +216463,7 @@ async function startServer({ handleSignals = true } = {}) {
|
|
|
216411
216463
|
logConsole: current.logConsole,
|
|
216412
216464
|
logRequests: current.logRequests,
|
|
216413
216465
|
maxSentenceLength: current.maxSentenceLength,
|
|
216466
|
+
fullwidthZhPunctuation: current.fullwidthZhPunctuation,
|
|
216414
216467
|
checkUpdate: current.checkUpdate,
|
|
216415
216468
|
cacheSize: current.cacheSize,
|
|
216416
216469
|
modelDir: current.modelDir,
|
|
@@ -216453,6 +216506,7 @@ async function startServer({ handleSignals = true } = {}) {
|
|
|
216453
216506
|
logConsole: toBool(input.logConsole, current.logConsole),
|
|
216454
216507
|
logRequests: toBool(input.logRequests, current.logRequests),
|
|
216455
216508
|
maxSentenceLength: toNumber(input.maxSentenceLength, current.maxSentenceLength),
|
|
216509
|
+
fullwidthZhPunctuation: toBool(input.fullwidthZhPunctuation, current.fullwidthZhPunctuation),
|
|
216456
216510
|
checkUpdate: toBool(input.checkUpdate, current.checkUpdate),
|
|
216457
216511
|
cacheSize: toNumber(input.cacheSize, current.cacheSize),
|
|
216458
216512
|
modelDir: toString2(input.modelDir, current.modelDir),
|
|
@@ -216650,6 +216704,7 @@ Options:
|
|
|
216650
216704
|
--offline Enable offline mode (default: false)
|
|
216651
216705
|
--worker-idle-timeout Worker idle timeout in seconds (default: 60)
|
|
216652
216706
|
--workers-per-language Number of workers per language pair (default: 1)
|
|
216707
|
+
--fullwidth-zh-punctuation Fullwidth punctuation for Chinese output (default: true)
|
|
216653
216708
|
--api-token <token> API access token
|
|
216654
216709
|
--log-to-file Enable logging to file (default: false)
|
|
216655
216710
|
--log-console Enable logging to console (default: true)
|
|
@@ -216664,7 +216719,7 @@ Environment Variables:
|
|
|
216664
216719
|
MT_HOST, MT_PORT, MT_LOG_LEVEL, MT_CONFIG_DIR, MT_MODEL_DIR,
|
|
216665
216720
|
MT_LOG_DIR, MT_ENABLE_UI, MT_OFFLINE, MT_WORKER_IDLE_TIMEOUT,
|
|
216666
216721
|
MT_WORKERS_PER_LANGUAGE, MT_API_TOKEN, MT_LOG_TO_FILE, MT_LOG_CONSOLE,
|
|
216667
|
-
MT_CHECK_UPDATE
|
|
216722
|
+
MT_CHECK_UPDATE, MT_FULLWIDTH_ZH_PUNCTUATION
|
|
216668
216723
|
`);
|
|
216669
216724
|
process.exit(0);
|
|
216670
216725
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/services/detector.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB;AAgND,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyB1G;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,MAAqC,EACpD,QAAQ,GAAE,MAA4B,GACrC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCnD;
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/services/detector.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB;AAgND,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyB1G;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,MAAqC,EACpD,QAAQ,GAAE,MAA4B,GACrC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCnD;AA8ED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAElF;AAED,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,EAAE,CAAC,CA0GxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"AAkOA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CA0EjB;AAkCD,wBAAgB,iBAAiB,SAahC"}
|