bookbaker


Namebookbaker JSON
Version 0.1.11 PyPI version JSON
download
home_pagehttps://github.com/VermiIIi0n/bookbaker
SummaryComponents for auto-translation of novel and manga.
upload_time2024-03-06 14:15:34
maintainer
docs_urlNone
authorVermiIIi0n
requires_python>=3.12,<4.0
licenseMIT
keywords utilities translation automation novel webnovel lightnovel
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 焙书

## Introduction

自动化 爬取/翻译/导出 网页生肉书籍

你是否还在为:

1. 生肉无人烤
2. 译者咕咕
3. 翻译质量感人(虽然用爱发电伟大但是...)
4. 译文充满吐槽私货

而发愁?

随着 `Gemini AI` 和 `GPT4 Turbo` 的推出,日文小说机器翻译的质量已经可以胜过某些人类了。

于是本库诞生来解救诸位。

本品特性:

1. 自带几个常见日轻爬虫,爬取网站文章
2. 支持 `DeepL`, `Gemini AI`, `ChatGPT`, `Sakura`(`GPT` 兼容) 等烤肉机
3. 支持导出至 `EPUB`, 自动发布至某些站点(未完工)
4. 自带小型 NoSQL 数据库,方便查看编辑
5. 模块化设计,方便自行定制爬虫,烤肉机,导出器
6. 自动在文章有更新时再爬取。

## NOTICE

**本品仍在 Beta 开发阶段,用量用法随时改变,效果随机出错,请自行斟酌。** 愿意测试者也许可以白嫖 `API Key` ? (数量有限不保证)

## Community

更多机翻内容和社区支持可移步[这里](https://books.fishhawk.top/)

## Installation

```bash
pip install -U bookbaker
```

或者想体验最新版可直接 clone 本库。

## Configuration

建议您切换至空目录下,然后运行 `bookbaker`, 这样将会在本目录下创建 `config.json` 。

以下为一个示例:

<details>
  <summary>点我</summary>

```JSON {collapsed}
{
  "version": "1.0.0",
  "tasks": [
    {
      "friendly_name": "TS-Tenshi",
      "url": "https://syosetu.org/novel/333942/",
      "crawler": null,
      "translator": ["gemini", "gpt"],
      "exporter": "epub",
      "sauce_lang": "JA",
      "target_lang": "ZH",
      "glossaries": [
        ["ザラキエル", "萨拉琪尔"],
        ["神専魔法", "神专魔法"],
        ["サーヴィトリ", "萨维特丽"],
        ["サラフィエル", "萨拉菲尔"],
        ["アルマロス", "阿尔马洛斯"],
        ["クロ", "小黑"]
      ]
    }
  ],
  "roles": [
    {
      "name": "syosetu-com",
      "description": "A crawler for syosetu.com",
      "classname": "SyosetuComCrawler",
      "modulename": "bookbaker.roles.syosetu_com"
    },
    {
      "name": "deepl",
      "description": "DeepL Translator",
      "skip_translated": true,
      "backend": {
        "api_key": "",
        "use_pro": false,
        "free_host": "api-free.deepl.com",
        "pro_host": "api.deepl.com",
        "proxy": null,
        "retries": 3,
        "timeout": 10.0
      },
      "classname": "DeepLTranslator",
      "modulename": "bookbaker.roles.deepl"
    },
    {
      "name": "gemini",
      "description": "A translator for gemini.com",
      "max_retries": 10,
      "max_tokens": null,
      "remind_interval": 3,
      "skip_translated": false,
      "convert_ruby": true,
      "max_reply_tokens": null,
      "backend": {
        "model": "models\/gemini-pro",
        "api_key": "",
        "api_host": "generativelanguage.googleapis.com",
        "comp_tokens": 4096.0,
        "stop": null,
        "temperature": 0.5,
        "top_p": null,
        "top_k": null,
        "tools": null,
        "tool_choice": "auto",
        "safety_settings": [
          {
            "category": "HARM_CATEGORY_HARASSMENT",
            "threshold": "BLOCK_NONE",
            "probability": null
          },
          {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "threshold": "BLOCK_NONE",
            "probability": null
          },
          {
            "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
            "threshold": "BLOCK_NONE",
            "probability": null
          },
          {
            "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
            "threshold": "BLOCK_NONE",
            "probability": null
          }
        ],
        "proxy": null,
        "timeout": null
      },
      "classname": "GeminiTranslator",
      "modulename": "bookbaker.roles.gemini"
    },
    {
      "name": "epub",
      "description": "EPUB Exporter",
      "use_translated": true,
      "classname": "EpubExporter",
      "modulename": "bookbaker.roles.epub"
    }
  ],
  "client": {
    "user_agent": "Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/121.0.0.0 Safari\/537.36",
    "timeout": 60.0,
    "proxy": null,
    "max_retries": 6,
    "trust_env": true
  },
  "db": {
    "path": "db.json",
    "write_buffer_size": 0
  },
  "logging": {
    "level": "DEBUG",
    "fmt": "%(asctime)s - %(levelname)s - %(message)s",
    "dirpath": "logs",
    "show_console": true
  }
}
```

</details>

### 配置各部分介绍

`tasks`

这部分定义了任务,一个任务就是要处理的书籍的相关信息。

- `friendly_name`: `str` 没啥用,助记的
- `url`: `str` 书籍的网址
- `crawler`: `str` 爬虫的名字,如果为 `null` 则会自动选择一个合适的爬虫
- `translator`: `str | list[str]` 翻译器的名字(们),`null` 为不翻译。无负载均衡,只是按顺序前仆后继的翻译
- `exporter`: `str | list[str]` 导出器的名字(们),`null` 为不导出,但年轻人导导更健康。多填时均会运行。
- `sauce_lang`: `str` 原文语言,`ISO 639` 格式
- `target_lang`: `str` 目标语言, `ISO 639` 格式
- `glossaries`: `list[tuple[str, str]]` 词汇表 例如 `[[Unacceptable, 可接受的], ...]`,可用于译名对照。

`roles`

这里定义了所有的 爬虫/烤肉机/导出器。他们的名字必须唯一。

`client`

共享的 `httpx.AsyncClient` 实例配置。

`db`

数据库配置。

- `path`: 数据库文件路径
- `write_buffer_size`: 写入缓冲区大小

`logging`

日志配置。

- `level`: 日志级别
- `fmt`: 日志格式
- `dirpath`: 日志文件夹路径
- `show_console`: 是否在控制台显示日志

### `roles` 再谈

以后也许会在这里补上自带模块的详细配置,现在因为开发阶段可能有诸多变化就先咕咕。

关于烤肉机的选择:

首先 `DeepL`/`Gemini AI`/`GPT` 都是基于变形金刚(~~完全胜利~~)的,所以他们共享一些特性。

`DeepL` 每个月免费用户有 500K 免费 `Tokens`,需要国外信用卡注册。但因为生成限制 `Tokens` 太短,一次性丢长句容易造成内容截断,所以是分句子发送的。这导致经常没有足够的语境提供信息,翻译的前后文会不搭调。~~但你就问快不快吧。~~ 另外对词汇表的语言组合有些限制。

`Gemini AI` 翻的最好,目前 `API` 免费,速率限制不成问题,速度也不错。但不知为何解除所有`prompt` 安全限制后仍会阻挡一部分内容,有些瑟瑟场面翻不了。另外比起 `GPT` 更容易偶尔摆烂直接吐原文,也不太尊重提供的词汇表。

`GPT` 家族翻译的还可以,风格有些过于严肃,流畅度和速度上不如 `Gemini`,`4.0` 的 `API` 收费,免费的速率限制基本也没法用,想交钱还得用美国本土信用卡,建议马家找中转。不愧是 `ClosedAI`。好在出错概率小,尊重词汇表,更能理解复杂的格式化(`HTML`/`JSON`/...),内容安全限制更低 (这里倒是 Open 了是吧??)。

后两者的输出 Tokens 限制都在 2048-4096 左右,输入 Tokens 上万了,语境理解相当棒,一次也能吐很多内容 ~~只要你钱够~~。基本上能看的也就后俩的。但他俩翻久了容易忘记词汇表,如果遇到这问题可以降低他们配置中的 `reminder_interval` 来更频繁的提醒词汇表,建议适量。

| Name        | Speed    | Quality | Restriction | Cost     | Respect Glossaries  |
| ----------- | -------- | ------- | ----------- | -------- | ------------------- |
| `DeepL`     | VeryFast | Meh     | None        | Free/Low | Yes (when possible) |
| `Gemini AI` | Fast     | Good    | Some        | Free     | Not really          |
| `GPT`       | Slow     | Good    | Few         | High     | Yes                 |

## Baking

`config.json` 在生成时已有样例,按模板为你的 `config.json` 填入合适的任务,`api_key`。

切换到带有 `config.json` 的目录下,运行 `bookbaker` 即可。

导出的文件默认放到 `exports` 文件夹下

## 数据结构

数据库内有以下大致结构

数据库

- `Table`
  - `Books...`
    - `title`
    - `series`
    - `author`
    - `Tags...`: `list[str]`
    - ...
    - `Chapters...`:
      - `title`
      - ...
      - `Episodes...`
        - `title`
        - `notes`
        - `Lines...`
          - `content` 原文
          - `translated` 译文

主要内容都在各条 `Line` 中 `line.content`, `line.translated` 为原文和翻译文本。你可以自行修改。如果想要重新翻译某句话,可以直接将 `line.translated` 改为 `null`。

## Diagnose

日志文件分类:

- `DEBUG`: 包含一些请求的参数,具体的运行阶段等信息。
- `INFO`: 一些稍重要的运行阶段信息,主要用于进度报告,(e.g. 正在爬取某书)
- `WARNING`: 有可能造成书籍内容缺失的错误,需要重视
- `CRITICAL`: 严重错误,某些组件无法运行,某些任务无法完成。
- `ERROR`: 记录每个 `Exception` 的详细信息 (`traceback` 等)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/VermiIIi0n/bookbaker",
    "name": "bookbaker",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.12,<4.0",
    "maintainer_email": "",
    "keywords": "utilities,translation,automation,novel,webnovel,lightnovel",
    "author": "VermiIIi0n",
    "author_email": "dungeon.behind0t@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/a0/cd/5d0aa0bc050a6134a08f33e19e65097463b4fe4296ea03a33753589d1b6d/bookbaker-0.1.11.tar.gz",
    "platform": null,
    "description": "# \u7119\u4e66\n\n## Introduction\n\n\u81ea\u52a8\u5316 \u722c\u53d6/\u7ffb\u8bd1/\u5bfc\u51fa \u7f51\u9875\u751f\u8089\u4e66\u7c4d\n\n\u4f60\u662f\u5426\u8fd8\u5728\u4e3a\uff1a\n\n1. \u751f\u8089\u65e0\u4eba\u70e4\n2. \u8bd1\u8005\u5495\u5495\n3. \u7ffb\u8bd1\u8d28\u91cf\u611f\u4eba\uff08\u867d\u7136\u7528\u7231\u53d1\u7535\u4f1f\u5927\u4f46\u662f...)\n4. \u8bd1\u6587\u5145\u6ee1\u5410\u69fd\u79c1\u8d27\n\n\u800c\u53d1\u6101\uff1f\n\n\u968f\u7740 `Gemini AI` \u548c `GPT4 Turbo` \u7684\u63a8\u51fa\uff0c\u65e5\u6587\u5c0f\u8bf4\u673a\u5668\u7ffb\u8bd1\u7684\u8d28\u91cf\u5df2\u7ecf\u53ef\u4ee5\u80dc\u8fc7\u67d0\u4e9b\u4eba\u7c7b\u4e86\u3002\n\n\u4e8e\u662f\u672c\u5e93\u8bde\u751f\u6765\u89e3\u6551\u8bf8\u4f4d\u3002\n\n\u672c\u54c1\u7279\u6027\uff1a\n\n1. \u81ea\u5e26\u51e0\u4e2a\u5e38\u89c1\u65e5\u8f7b\u722c\u866b\uff0c\u722c\u53d6\u7f51\u7ad9\u6587\u7ae0\n2. \u652f\u6301 `DeepL`, `Gemini AI`, `ChatGPT`, `Sakura`(`GPT` \u517c\u5bb9) \u7b49\u70e4\u8089\u673a\n3. \u652f\u6301\u5bfc\u51fa\u81f3 `EPUB`, \u81ea\u52a8\u53d1\u5e03\u81f3\u67d0\u4e9b\u7ad9\u70b9\uff08\u672a\u5b8c\u5de5\uff09\n4. \u81ea\u5e26\u5c0f\u578b NoSQL \u6570\u636e\u5e93\uff0c\u65b9\u4fbf\u67e5\u770b\u7f16\u8f91\n5. \u6a21\u5757\u5316\u8bbe\u8ba1\uff0c\u65b9\u4fbf\u81ea\u884c\u5b9a\u5236\u722c\u866b\uff0c\u70e4\u8089\u673a\uff0c\u5bfc\u51fa\u5668\n6. \u81ea\u52a8\u5728\u6587\u7ae0\u6709\u66f4\u65b0\u65f6\u518d\u722c\u53d6\u3002\n\n## NOTICE\n\n**\u672c\u54c1\u4ecd\u5728 Beta \u5f00\u53d1\u9636\u6bb5\uff0c\u7528\u91cf\u7528\u6cd5\u968f\u65f6\u6539\u53d8\uff0c\u6548\u679c\u968f\u673a\u51fa\u9519\uff0c\u8bf7\u81ea\u884c\u659f\u914c\u3002** \u613f\u610f\u6d4b\u8bd5\u8005\u4e5f\u8bb8\u53ef\u4ee5\u767d\u5ad6 `API Key` ? \uff08\u6570\u91cf\u6709\u9650\u4e0d\u4fdd\u8bc1\uff09\n\n## Community\n\n\u66f4\u591a\u673a\u7ffb\u5185\u5bb9\u548c\u793e\u533a\u652f\u6301\u53ef\u79fb\u6b65[\u8fd9\u91cc](https://books.fishhawk.top/)\n\n## Installation\n\n```bash\npip install -U bookbaker\n```\n\n\u6216\u8005\u60f3\u4f53\u9a8c\u6700\u65b0\u7248\u53ef\u76f4\u63a5 clone \u672c\u5e93\u3002\n\n## Configuration\n\n\u5efa\u8bae\u60a8\u5207\u6362\u81f3\u7a7a\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u8fd0\u884c `bookbaker`, \u8fd9\u6837\u5c06\u4f1a\u5728\u672c\u76ee\u5f55\u4e0b\u521b\u5efa `config.json` \u3002\n\n\u4ee5\u4e0b\u4e3a\u4e00\u4e2a\u793a\u4f8b\uff1a\n\n<details>\n  <summary>\u70b9\u6211</summary>\n\n```JSON {collapsed}\n{\n  \"version\": \"1.0.0\",\n  \"tasks\": [\n    {\n      \"friendly_name\": \"TS-Tenshi\",\n      \"url\": \"https://syosetu.org/novel/333942/\",\n      \"crawler\": null,\n      \"translator\": [\"gemini\", \"gpt\"],\n      \"exporter\": \"epub\",\n      \"sauce_lang\": \"JA\",\n      \"target_lang\": \"ZH\",\n      \"glossaries\": [\n        [\"\u30b6\u30e9\u30ad\u30a8\u30eb\", \"\u8428\u62c9\u742a\u5c14\"],\n        [\"\u795e\u5c02\u9b54\u6cd5\", \"\u795e\u4e13\u9b54\u6cd5\"],\n        [\"\u30b5\u30fc\u30f4\u30a3\u30c8\u30ea\", \"\u8428\u7ef4\u7279\u4e3d\"],\n        [\"\u30b5\u30e9\u30d5\u30a3\u30a8\u30eb\", \"\u8428\u62c9\u83f2\u5c14\"],\n        [\"\u30a2\u30eb\u30de\u30ed\u30b9\", \"\u963f\u5c14\u9a6c\u6d1b\u65af\"],\n        [\"\u30af\u30ed\", \"\u5c0f\u9ed1\"]\n      ]\n    }\n  ],\n  \"roles\": [\n    {\n      \"name\": \"syosetu-com\",\n      \"description\": \"A crawler for syosetu.com\",\n      \"classname\": \"SyosetuComCrawler\",\n      \"modulename\": \"bookbaker.roles.syosetu_com\"\n    },\n    {\n      \"name\": \"deepl\",\n      \"description\": \"DeepL Translator\",\n      \"skip_translated\": true,\n      \"backend\": {\n        \"api_key\": \"\",\n        \"use_pro\": false,\n        \"free_host\": \"api-free.deepl.com\",\n        \"pro_host\": \"api.deepl.com\",\n        \"proxy\": null,\n        \"retries\": 3,\n        \"timeout\": 10.0\n      },\n      \"classname\": \"DeepLTranslator\",\n      \"modulename\": \"bookbaker.roles.deepl\"\n    },\n    {\n      \"name\": \"gemini\",\n      \"description\": \"A translator for gemini.com\",\n      \"max_retries\": 10,\n      \"max_tokens\": null,\n      \"remind_interval\": 3,\n      \"skip_translated\": false,\n      \"convert_ruby\": true,\n      \"max_reply_tokens\": null,\n      \"backend\": {\n        \"model\": \"models\\/gemini-pro\",\n        \"api_key\": \"\",\n        \"api_host\": \"generativelanguage.googleapis.com\",\n        \"comp_tokens\": 4096.0,\n        \"stop\": null,\n        \"temperature\": 0.5,\n        \"top_p\": null,\n        \"top_k\": null,\n        \"tools\": null,\n        \"tool_choice\": \"auto\",\n        \"safety_settings\": [\n          {\n            \"category\": \"HARM_CATEGORY_HARASSMENT\",\n            \"threshold\": \"BLOCK_NONE\",\n            \"probability\": null\n          },\n          {\n            \"category\": \"HARM_CATEGORY_HATE_SPEECH\",\n            \"threshold\": \"BLOCK_NONE\",\n            \"probability\": null\n          },\n          {\n            \"category\": \"HARM_CATEGORY_SEXUALLY_EXPLICIT\",\n            \"threshold\": \"BLOCK_NONE\",\n            \"probability\": null\n          },\n          {\n            \"category\": \"HARM_CATEGORY_DANGEROUS_CONTENT\",\n            \"threshold\": \"BLOCK_NONE\",\n            \"probability\": null\n          }\n        ],\n        \"proxy\": null,\n        \"timeout\": null\n      },\n      \"classname\": \"GeminiTranslator\",\n      \"modulename\": \"bookbaker.roles.gemini\"\n    },\n    {\n      \"name\": \"epub\",\n      \"description\": \"EPUB Exporter\",\n      \"use_translated\": true,\n      \"classname\": \"EpubExporter\",\n      \"modulename\": \"bookbaker.roles.epub\"\n    }\n  ],\n  \"client\": {\n    \"user_agent\": \"Mozilla\\/5.0 (X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/121.0.0.0 Safari\\/537.36\",\n    \"timeout\": 60.0,\n    \"proxy\": null,\n    \"max_retries\": 6,\n    \"trust_env\": true\n  },\n  \"db\": {\n    \"path\": \"db.json\",\n    \"write_buffer_size\": 0\n  },\n  \"logging\": {\n    \"level\": \"DEBUG\",\n    \"fmt\": \"%(asctime)s - %(levelname)s - %(message)s\",\n    \"dirpath\": \"logs\",\n    \"show_console\": true\n  }\n}\n```\n\n</details>\n\n### \u914d\u7f6e\u5404\u90e8\u5206\u4ecb\u7ecd\n\n`tasks`\n\n\u8fd9\u90e8\u5206\u5b9a\u4e49\u4e86\u4efb\u52a1\uff0c\u4e00\u4e2a\u4efb\u52a1\u5c31\u662f\u8981\u5904\u7406\u7684\u4e66\u7c4d\u7684\u76f8\u5173\u4fe1\u606f\u3002\n\n- `friendly_name`: `str` \u6ca1\u5565\u7528\uff0c\u52a9\u8bb0\u7684\n- `url`: `str` \u4e66\u7c4d\u7684\u7f51\u5740\n- `crawler`: `str` \u722c\u866b\u7684\u540d\u5b57\uff0c\u5982\u679c\u4e3a `null` \u5219\u4f1a\u81ea\u52a8\u9009\u62e9\u4e00\u4e2a\u5408\u9002\u7684\u722c\u866b\n- `translator`: `str | list[str]` \u7ffb\u8bd1\u5668\u7684\u540d\u5b57(\u4eec)\uff0c`null` \u4e3a\u4e0d\u7ffb\u8bd1\u3002\u65e0\u8d1f\u8f7d\u5747\u8861\uff0c\u53ea\u662f\u6309\u987a\u5e8f\u524d\u4ec6\u540e\u7ee7\u7684\u7ffb\u8bd1\n- `exporter`: `str | list[str]` \u5bfc\u51fa\u5668\u7684\u540d\u5b57(\u4eec)\uff0c`null` \u4e3a\u4e0d\u5bfc\u51fa\uff0c\u4f46\u5e74\u8f7b\u4eba\u5bfc\u5bfc\u66f4\u5065\u5eb7\u3002\u591a\u586b\u65f6\u5747\u4f1a\u8fd0\u884c\u3002\n- `sauce_lang`: `str` \u539f\u6587\u8bed\u8a00\uff0c`ISO 639` \u683c\u5f0f\n- `target_lang`: `str` \u76ee\u6807\u8bed\u8a00, `ISO 639` \u683c\u5f0f\n- `glossaries`: `list[tuple[str, str]]` \u8bcd\u6c47\u8868 \u4f8b\u5982 `[[Unacceptable, \u53ef\u63a5\u53d7\u7684], ...]`\uff0c\u53ef\u7528\u4e8e\u8bd1\u540d\u5bf9\u7167\u3002\n\n`roles`\n\n\u8fd9\u91cc\u5b9a\u4e49\u4e86\u6240\u6709\u7684 \u722c\u866b/\u70e4\u8089\u673a/\u5bfc\u51fa\u5668\u3002\u4ed6\u4eec\u7684\u540d\u5b57\u5fc5\u987b\u552f\u4e00\u3002\n\n`client`\n\n\u5171\u4eab\u7684 `httpx.AsyncClient` \u5b9e\u4f8b\u914d\u7f6e\u3002\n\n`db`\n\n\u6570\u636e\u5e93\u914d\u7f6e\u3002\n\n- `path`: \u6570\u636e\u5e93\u6587\u4ef6\u8def\u5f84\n- `write_buffer_size`: \u5199\u5165\u7f13\u51b2\u533a\u5927\u5c0f\n\n`logging`\n\n\u65e5\u5fd7\u914d\u7f6e\u3002\n\n- `level`: \u65e5\u5fd7\u7ea7\u522b\n- `fmt`: \u65e5\u5fd7\u683c\u5f0f\n- `dirpath`: \u65e5\u5fd7\u6587\u4ef6\u5939\u8def\u5f84\n- `show_console`: \u662f\u5426\u5728\u63a7\u5236\u53f0\u663e\u793a\u65e5\u5fd7\n\n### `roles` \u518d\u8c08\n\n\u4ee5\u540e\u4e5f\u8bb8\u4f1a\u5728\u8fd9\u91cc\u8865\u4e0a\u81ea\u5e26\u6a21\u5757\u7684\u8be6\u7ec6\u914d\u7f6e\uff0c\u73b0\u5728\u56e0\u4e3a\u5f00\u53d1\u9636\u6bb5\u53ef\u80fd\u6709\u8bf8\u591a\u53d8\u5316\u5c31\u5148\u5495\u5495\u3002\n\n\u5173\u4e8e\u70e4\u8089\u673a\u7684\u9009\u62e9\uff1a\n\n\u9996\u5148 `DeepL`/`Gemini AI`/`GPT` \u90fd\u662f\u57fa\u4e8e\u53d8\u5f62\u91d1\u521a(~~\u5b8c\u5168\u80dc\u5229~~)\u7684\uff0c\u6240\u4ee5\u4ed6\u4eec\u5171\u4eab\u4e00\u4e9b\u7279\u6027\u3002\n\n`DeepL` \u6bcf\u4e2a\u6708\u514d\u8d39\u7528\u6237\u6709 500K \u514d\u8d39 `Tokens`\uff0c\u9700\u8981\u56fd\u5916\u4fe1\u7528\u5361\u6ce8\u518c\u3002\u4f46\u56e0\u4e3a\u751f\u6210\u9650\u5236 `Tokens` \u592a\u77ed\uff0c\u4e00\u6b21\u6027\u4e22\u957f\u53e5\u5bb9\u6613\u9020\u6210\u5185\u5bb9\u622a\u65ad\uff0c\u6240\u4ee5\u662f\u5206\u53e5\u5b50\u53d1\u9001\u7684\u3002\u8fd9\u5bfc\u81f4\u7ecf\u5e38\u6ca1\u6709\u8db3\u591f\u7684\u8bed\u5883\u63d0\u4f9b\u4fe1\u606f\uff0c\u7ffb\u8bd1\u7684\u524d\u540e\u6587\u4f1a\u4e0d\u642d\u8c03\u3002~~\u4f46\u4f60\u5c31\u95ee\u5feb\u4e0d\u5feb\u5427\u3002~~ \u53e6\u5916\u5bf9\u8bcd\u6c47\u8868\u7684\u8bed\u8a00\u7ec4\u5408\u6709\u4e9b\u9650\u5236\u3002\n\n`Gemini AI` \u7ffb\u7684\u6700\u597d\uff0c\u76ee\u524d `API` \u514d\u8d39\uff0c\u901f\u7387\u9650\u5236\u4e0d\u6210\u95ee\u9898\uff0c\u901f\u5ea6\u4e5f\u4e0d\u9519\u3002\u4f46\u4e0d\u77e5\u4e3a\u4f55\u89e3\u9664\u6240\u6709`prompt` \u5b89\u5168\u9650\u5236\u540e\u4ecd\u4f1a\u963b\u6321\u4e00\u90e8\u5206\u5185\u5bb9\uff0c\u6709\u4e9b\u745f\u745f\u573a\u9762\u7ffb\u4e0d\u4e86\u3002\u53e6\u5916\u6bd4\u8d77 `GPT` \u66f4\u5bb9\u6613\u5076\u5c14\u6446\u70c2\u76f4\u63a5\u5410\u539f\u6587\uff0c\u4e5f\u4e0d\u592a\u5c0a\u91cd\u63d0\u4f9b\u7684\u8bcd\u6c47\u8868\u3002\n\n`GPT` \u5bb6\u65cf\u7ffb\u8bd1\u7684\u8fd8\u53ef\u4ee5\uff0c\u98ce\u683c\u6709\u4e9b\u8fc7\u4e8e\u4e25\u8083\uff0c\u6d41\u7545\u5ea6\u548c\u901f\u5ea6\u4e0a\u4e0d\u5982 `Gemini`\uff0c`4.0` \u7684 `API` \u6536\u8d39\uff0c\u514d\u8d39\u7684\u901f\u7387\u9650\u5236\u57fa\u672c\u4e5f\u6ca1\u6cd5\u7528\uff0c\u60f3\u4ea4\u94b1\u8fd8\u5f97\u7528\u7f8e\u56fd\u672c\u571f\u4fe1\u7528\u5361\uff0c\u5efa\u8bae\u9a6c\u5bb6\u627e\u4e2d\u8f6c\u3002\u4e0d\u6127\u662f `ClosedAI`\u3002\u597d\u5728\u51fa\u9519\u6982\u7387\u5c0f\uff0c\u5c0a\u91cd\u8bcd\u6c47\u8868\uff0c\u66f4\u80fd\u7406\u89e3\u590d\u6742\u7684\u683c\u5f0f\u5316(`HTML`/`JSON`/...)\uff0c\u5185\u5bb9\u5b89\u5168\u9650\u5236\u66f4\u4f4e (\u8fd9\u91cc\u5012\u662f Open \u4e86\u662f\u5427??)\u3002\n\n\u540e\u4e24\u8005\u7684\u8f93\u51fa Tokens \u9650\u5236\u90fd\u5728 2048-4096 \u5de6\u53f3\uff0c\u8f93\u5165 Tokens \u4e0a\u4e07\u4e86\uff0c\u8bed\u5883\u7406\u89e3\u76f8\u5f53\u68d2\uff0c\u4e00\u6b21\u4e5f\u80fd\u5410\u5f88\u591a\u5185\u5bb9 ~~\u53ea\u8981\u4f60\u94b1\u591f~~\u3002\u57fa\u672c\u4e0a\u80fd\u770b\u7684\u4e5f\u5c31\u540e\u4fe9\u7684\u3002\u4f46\u4ed6\u4fe9\u7ffb\u4e45\u4e86\u5bb9\u6613\u5fd8\u8bb0\u8bcd\u6c47\u8868\uff0c\u5982\u679c\u9047\u5230\u8fd9\u95ee\u9898\u53ef\u4ee5\u964d\u4f4e\u4ed6\u4eec\u914d\u7f6e\u4e2d\u7684 `reminder_interval` \u6765\u66f4\u9891\u7e41\u7684\u63d0\u9192\u8bcd\u6c47\u8868\uff0c\u5efa\u8bae\u9002\u91cf\u3002\n\n| Name        | Speed    | Quality | Restriction | Cost     | Respect Glossaries  |\n| ----------- | -------- | ------- | ----------- | -------- | ------------------- |\n| `DeepL`     | VeryFast | Meh     | None        | Free/Low | Yes (when possible) |\n| `Gemini AI` | Fast     | Good    | Some        | Free     | Not really          |\n| `GPT`       | Slow     | Good    | Few         | High     | Yes                 |\n\n## Baking\n\n`config.json` \u5728\u751f\u6210\u65f6\u5df2\u6709\u6837\u4f8b\uff0c\u6309\u6a21\u677f\u4e3a\u4f60\u7684 `config.json` \u586b\u5165\u5408\u9002\u7684\u4efb\u52a1\uff0c`api_key`\u3002\n\n\u5207\u6362\u5230\u5e26\u6709 `config.json` \u7684\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c `bookbaker` \u5373\u53ef\u3002\n\n\u5bfc\u51fa\u7684\u6587\u4ef6\u9ed8\u8ba4\u653e\u5230 `exports` \u6587\u4ef6\u5939\u4e0b\n\n## \u6570\u636e\u7ed3\u6784\n\n\u6570\u636e\u5e93\u5185\u6709\u4ee5\u4e0b\u5927\u81f4\u7ed3\u6784\n\n\u6570\u636e\u5e93\n\n- `Table`\n  - `Books...`\n    - `title`\n    - `series`\n    - `author`\n    - `Tags...`\uff1a `list[str]`\n    - ...\n    - `Chapters...`:\n      - `title`\n      - ...\n      - `Episodes...`\n        - `title`\n        - `notes`\n        - `Lines...`\n          - `content` \u539f\u6587\n          - `translated` \u8bd1\u6587\n\n\u4e3b\u8981\u5185\u5bb9\u90fd\u5728\u5404\u6761 `Line` \u4e2d `line.content`, `line.translated` \u4e3a\u539f\u6587\u548c\u7ffb\u8bd1\u6587\u672c\u3002\u4f60\u53ef\u4ee5\u81ea\u884c\u4fee\u6539\u3002\u5982\u679c\u60f3\u8981\u91cd\u65b0\u7ffb\u8bd1\u67d0\u53e5\u8bdd\uff0c\u53ef\u4ee5\u76f4\u63a5\u5c06 `line.translated` \u6539\u4e3a `null`\u3002\n\n## Diagnose\n\n\u65e5\u5fd7\u6587\u4ef6\u5206\u7c7b\uff1a\n\n- `DEBUG`: \u5305\u542b\u4e00\u4e9b\u8bf7\u6c42\u7684\u53c2\u6570\uff0c\u5177\u4f53\u7684\u8fd0\u884c\u9636\u6bb5\u7b49\u4fe1\u606f\u3002\n- `INFO`: \u4e00\u4e9b\u7a0d\u91cd\u8981\u7684\u8fd0\u884c\u9636\u6bb5\u4fe1\u606f\uff0c\u4e3b\u8981\u7528\u4e8e\u8fdb\u5ea6\u62a5\u544a\uff0c\uff08e.g. \u6b63\u5728\u722c\u53d6\u67d0\u4e66\uff09\n- `WARNING`: \u6709\u53ef\u80fd\u9020\u6210\u4e66\u7c4d\u5185\u5bb9\u7f3a\u5931\u7684\u9519\u8bef\uff0c\u9700\u8981\u91cd\u89c6\n- `CRITICAL`: \u4e25\u91cd\u9519\u8bef\uff0c\u67d0\u4e9b\u7ec4\u4ef6\u65e0\u6cd5\u8fd0\u884c\uff0c\u67d0\u4e9b\u4efb\u52a1\u65e0\u6cd5\u5b8c\u6210\u3002\n- `ERROR`: \u8bb0\u5f55\u6bcf\u4e2a `Exception` \u7684\u8be6\u7ec6\u4fe1\u606f \uff08`traceback` \u7b49\uff09\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Components for auto-translation of novel and manga.",
    "version": "0.1.11",
    "project_urls": {
        "Homepage": "https://github.com/VermiIIi0n/bookbaker",
        "Issues": "https://github.com/VermiIIi0n/bookbaker/issues"
    },
    "split_keywords": [
        "utilities",
        "translation",
        "automation",
        "novel",
        "webnovel",
        "lightnovel"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3005df97ac8c8a0be2821c078c75846702cd4a56d8438ddd78cb7be153593a31",
                "md5": "b34316e8a593e92f24b7fea9f1f03d30",
                "sha256": "de73dd414b3c719af6e0d93dea9192c399adad6f0401d64e26e28b271034362e"
            },
            "downloads": -1,
            "filename": "bookbaker-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b34316e8a593e92f24b7fea9f1f03d30",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12,<4.0",
            "size": 37208,
            "upload_time": "2024-03-06T14:15:32",
            "upload_time_iso_8601": "2024-03-06T14:15:32.650859Z",
            "url": "https://files.pythonhosted.org/packages/30/05/df97ac8c8a0be2821c078c75846702cd4a56d8438ddd78cb7be153593a31/bookbaker-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0cd5d0aa0bc050a6134a08f33e19e65097463b4fe4296ea03a33753589d1b6d",
                "md5": "0ee65cb7d7a4d26334d33bf4d0273e21",
                "sha256": "1cfa9431f3fbc5be6eda17f4b9f7641d96f29e10314fcde9439834b9345a6a8b"
            },
            "downloads": -1,
            "filename": "bookbaker-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "0ee65cb7d7a4d26334d33bf4d0273e21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12,<4.0",
            "size": 29270,
            "upload_time": "2024-03-06T14:15:34",
            "upload_time_iso_8601": "2024-03-06T14:15:34.884079Z",
            "url": "https://files.pythonhosted.org/packages/a0/cd/5d0aa0bc050a6134a08f33e19e65097463b4fe4296ea03a33753589d1b6d/bookbaker-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 14:15:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VermiIIi0n",
    "github_project": "bookbaker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bookbaker"
}
        
Elapsed time: 0.19719s