### GET /service-info Source: https://docs.zhconvert.org/api/service-info 獲取繁化姬的服務設定與可用轉換器、模組資訊。 ```APIDOC ## GET /service-info ### Description 此端點用於獲取繁化姬的服務設定,可以用於動態建立基於繁化姬的轉換程式。 ### Method GET ### Endpoint /service-info ### Response #### Success Response (200) - **converters** (object) - 目前可以使用的轉換器以及其相關資訊。 - **modules** (object) - 目前可以使用的轉換模組以及其相關資訊。 - **modules.*.isManual** (bool) - 該模組是否必須手動啟用才能生效。 - **converterCategories** (object) - 目前存在的轉換器分類以及其相關資訊。 - **moduleCategories** (object) - 目前存在的轉換模組分類以及其相關資訊。 - **textFormats** (object) - 目前存在的轉換模組分類以及其相關資訊。 - **diffTemplates** (object) - 目前存在的差異比較模板以及其相關資訊。 - **allowEmptyApiKey** (bool) - 是否允許使用空的 API 金鑰。 - **maxPostBodyBytes** (int) - 最大允許的轉換文字長度。 #### Response Example { "data": { "converters": { "Simplified": { "name": "簡體化", "desc": "將文字轉換為簡體。", "cat": "sctc" } }, "modules": { "Pocketmon": { "name": "精靈寶可夢", "desc": "日本動畫", "cat": "anime", "isManual": false } }, "converterCategories": { "sctc": "繁簡" }, "moduleCategories": { "anime": "動畫" }, "textFormats": { "PlainText": "純文字" }, "diffTemplates": { "Json": "Json" }, "allowEmptyApiKey": true, "maxPostBodyBytes": 2000000 } } ``` -------------------------------- ### GET/POST /convert Source: https://docs.zhconvert.org/api/convert 將輸入的文字轉換為指定的語言格式,並可選配模組與文本整理功能。 ```APIDOC ## [GET, POST] /convert ### Description 此端點用於將文字做轉換。支援多種轉換器如簡體化、繁體化、中國化、香港化、台灣化、拼音化、注音化、火星化等。 ### Method GET, POST ### Endpoint /convert ### Parameters #### 必填 - **text** (string) - Required - 將要被轉換的文字。 - **converter** (string) - Required - 所要使用的轉換器。有 Simplified, Traditional, China, Hongkong, Taiwan, Pinyin, Bopomofo, Mars, WikiSimplified, WikiTraditional。 #### 字幕樣式 - **ignoreTextStyles** (string) - Optional - 由那些不希望被繁化姬處理的 "樣式" 以逗號分隔所組成的字串。 - **jpTextStyles** (string) - Optional - 告訴繁化姬哪些樣式要當作日文處理。 #### 日文的處理策略 - **jpStyleConversionStrategy** (string) - Optional - 對於日文樣式該如何處理 (none, protect, protectOnlySameOrigin, fix)。 - **jpTextConversionStrategy** (string) - Optional - 對於繁化姬自己發現的日文區域該如何處理 (none, protect, protectOnlySameOrigin, fix)。 #### 自訂取代 - **modules** (JSON string) - Optional - 強制設定模組啟用/停用。 - **userPostReplace** (string) - Optional - 轉換後再進行的額外取代。 - **userPreReplace** (string) - Optional - 轉換前先進行的額外取代。 - **userProtectReplace** (string) - Optional - 保護字詞不被繁化姬修改。 #### 差異比較 - **diffCharLevel** (bool) - Optional - 是否使用字元級別的差異比較。 - **diffContextLines** (int) - Optional - 所輸出的結果要包含多少行上下文。 - **diffEnable** (bool) - Optional - 是否要啟用差異比較。 - **diffIgnoreCase** (bool) - Optional - 是否要忽略英文大小寫的差異。 - **diffIgnoreWhiteSpaces** (bool) - Optional - 是否要忽略空格的差異。 - **diffTemplate** (string) - Optional - 所要使用的輸出模板。 #### 文本整理 - **cleanUpText** (bool) - Optional - 根據所偵測到的文本格式做出對應的文本清理。 - **ensureNewlineAtEof** (bool) - Optional - 確保輸出的文本結尾處有一個且只有一個換行符。 - **translateTabsToSpaces** (int) - Optional - 轉換每行開頭的 Tab 為數個空格。 - **trimTrailingWhiteSpaces** (bool) - Optional - 移除每行結尾的多餘空格。 - **unifyLeadingHyphen** (bool) - Optional - 將區分說話人用的連字號統一為半形減號。 ### Response #### Success Response (200) - **converter** (string) - 此次轉換所使用的轉換器。 - **text** (string) - 經過轉換後的文本。 - **diff** (string) - 轉換前後的文本差異比較。 - **usedModules** (string[]) - 此次轉換使用了哪些模組。 - **jpTextStyles** (string[]) - 此次轉換將哪些樣式視為日文樣式。 - **textFormat** (string) - 輸入的文本被繁化姬判定為何種格式。 ### Response Example { "data": { "converter": "Taiwan", "text": "記憶體不足!沒辦法在視訊聊天時播放影片。", "diff": null, "jpTextStyles": [], "usedModules": ["Unit", "Typo", "Smooth", "GanToZuo", "Repeat", "ProperNoun", "Punctuation"], "textFormat": "PlainText" } } ``` -------------------------------- ### WebVTT 字幕推廣內容範例 Source: https://docs.zhconvert.org/license 展示如何在 WebVTT 字幕檔案中加入繁化姬的推廣資訊。 ```text NOTE Processed by 繁化姬 dict-b4f982a8-r588 @ 2018/04/08 11:05:18 | https://zhconvert.org ``` -------------------------------- ### 獲取服務資訊回應範例 Source: https://docs.zhconvert.org/api/service-info 此 JSON 結構展示了轉換器、模組、分類及系統限制的詳細配置。 ```json { // ... "data": { "converters": { "Simplified": { "name": "簡體化", "desc": "將文字轉換為簡體。", "cat": "sctc" }, "Traditional": { "name": "繁體化", "desc": "將文字轉換為繁體。", "cat": "sctc" } }, "modules": { "Pocketmon": { "name": "精靈寶可夢", "desc": "日本動畫", "cat": "anime", "isManual": false }, "Punctuation": { "name": "標點符號", "desc": "轉換 中國/非中國 間的標點符號", "cat": "misc", "isManual": true } }, "converterCategories": { "sctc": "繁簡", "localization": "本地化", "misc": "其他" }, "moduleCategories": { "anime": "動畫", "tv": "電視劇", "misc": "其他" }, "textFormats": { "Ass": "ASS\/SSA 字幕", "Srt": "SRT 字幕", "PlainText": "純文字" }, "diffTemplates": { "Inline": "Inline", "SideBySide": "Side by side", "Context": "Context", "Json": "Json", "Unified": "Unified" }, "allowEmptyApiKey": true, "maxPostBodyBytes": 2000000 }, // ... } ``` -------------------------------- ### ASS/SSA 字幕推廣內容範例 Source: https://docs.zhconvert.org/license 展示如何在 ASS/SSA 字幕檔案中加入繁化姬的推廣資訊。 ```text Comment: Processed by 繁化姬 dict-b4f982a8-r588 @ 2018/04/08 11:05:18 | https://zhconvert.org ``` -------------------------------- ### 文字轉換 API 回應範例 Source: https://docs.zhconvert.org/api/convert 此範例展示了將簡體中文轉換為台灣繁體中文後的 JSON 回應結構。 ```json { // ... "data": { "converter": "Taiwan", "text": "記憶體不足!沒辦法在視訊聊天時播放影片。", "diff": null, "jpTextStyles": [], "usedModules": [ "Unit", "Typo", "Smooth", "GanToZuo", "Repeat", "ProperNoun", "Punctuation" ], "textFormat": "PlainText" }, // ... } ``` -------------------------------- ### 日文樣式識別與修正範例 Source: https://docs.zhconvert.org/usage 展示繁化姬識別日文樣式並進行修正的轉換過程。 ```text ``` Dialogue: 0,0:00:42.32,0:00:48.84,OPJP,NTP,0000,0000,0000,,禮{\fs5\rXXXX\fn微软雅黑}禮{\fs6\rOPJP\fn微软雅黑}禮 Dialogue: 0,0:00:42.32,0:00:48.84,XXXX,NTP,0000,0000,0000,,禮{\fs5\rOPJP\fn微软雅黑}禮{\fs6\rXXXX\fn微软雅黑}禮 ``` 若進行 `繁化` 並 `修正日文樣式` ,將會轉換為 ``` Dialogue: 0,0:00:42.32,0:00:48.84,OPJP,NTP,0000,0000,0000,,礼{\fs5\rXXXX\fn微软雅黑}禮{\fs6\rOPJP\fn微软雅黑}礼 Dialogue: 0,0:00:42.32,0:00:48.84,XXXX,NTP,0000,0000,0000,,禮{\fs5\rOPJP\fn微软雅黑}礼{\fs6\rXXXX\fn微软雅黑}禮 ``` ``` -------------------------------- ### API 回應標準結構範例 Source: https://docs.zhconvert.org/api/0-getting-started 展示了 API 回應的標準 JSON 格式,包含狀態碼、資料內容、版本資訊及執行時間。 ```json { "code": 0, "data": { /* ... */ }, "msg": "", "revisions": { "build": "dict-fc73e287-r505", "msg": "例行性修正字詞 20180127", "time": 1517001761 }, "execTime": 0.012016 } ``` -------------------------------- ### SRT 字幕推廣內容範例 Source: https://docs.zhconvert.org/license 展示如何在 SRT 字幕檔案中加入繁化姬的推廣資訊。 ```text 0 00:00:00,000 --> 00:00:00,000 Processed by 繁化姬 dict-b4f982a8-r588 @ 2018/04/08 11:05:18 | https://zhconvert.org ``` -------------------------------- ### 字幕字體與樣式保護範例 Source: https://docs.zhconvert.org/usage 展示繁化姬如何自動保護字幕中的字體名稱與樣式名稱,確保轉換時不影響格式設定。 ```text ``` Style: 简体样式,方正细圆体_GBK,21,&H00FFFFFF,&HF0000000,&H006C3300,&H00000000,-1,0,0,0,100,100,0,0.00,1,2,1,2,5,5,5,134 Dialogue: 0,1:50:30.01,1:50:32.66,简体样式,NTP,0000,0000,0000,,{\fn方正细圆体_GBK}让伊莉莎接电话 ``` 若進行 `繁化` ,將會轉換為 ``` Style: 简体样式,方正细圆体_GBK,21,&H00FFFFFF,&HF0000000,&H006C3300,&H00000000,-1,0,0,0,100,100,0,0.00,1,2,1,2,5,5,5,134 Dialogue: 0,1:50:30.01,1:50:32.66,简体样式,NTP,0000,0000,0000,,{\fn方正细圆体_GBK}讓伊莉莎接電話 ``` ``` -------------------------------- ### 統一說話人連字號範例 Source: https://docs.zhconvert.org/usage 展示將字幕中的連字號統一為半形減號的轉換前後對比,適用於 SRT 與 ASS 格式。 ```text 轉換前 ``` 1223 01:50:30,010 --> 01:50:32,660 ﹣是的 ﹣讓伊莉莎接電話 ``` 轉換後 ``` 1223 01:50:30,010 --> 01:50:32,660 - 是的 - 讓伊莉莎接電話 ``` 轉換前 ``` Dialogue: 0,1:50:30.01,1:50:32.66,*Default,NTP,0000,0000,0000,,﹣是的\N﹣讓伊莉莎接電話 ``` 轉換後 ``` Dialogue: 0,1:50:30.01,1:50:32.66,*Default,NTP,0000,0000,0000,,- 是的\N- 讓伊莉莎接電話 ``` ``` -------------------------------- ### LRC 歌詞推廣內容範例 Source: https://docs.zhconvert.org/license 展示如何在 LRC 歌詞檔案中加入繁化姬的推廣資訊。 ```text [re:繁化姬 dict-b4f982a8-r588 @ 2018/04/08 11:05:18 | https://zhconvert.org] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.