Code Monkey home page Code Monkey logo

transmd's Introduction

使用OpenAI ChatGPT批量将中文Markdown翻译为英文的工具

一个自用可以实现内容出海的,使用OpenAI ChatGPT批量将中文Markdown翻译为英文的工具。

翻译完成的效果展示: https://medium.com/@zhaoolee

使用方法

  1. 将markdown简体中文文件批量放入 input_markdown_file_dir

  2. 设置环境变量 export OPENAI_API_KEY='sk-y********************W', 如果感觉费事,可以像我一样,直接写到~/.zshrc

  3. 进入transMd文件夹, 进入虚拟环境pipenv shell, 安装包pipenv install,运行 python main.py

  4. 等一会儿, 翻译完成的markdown文件将会输出在 output_markdown_file_dir

工具特色

  • 可以批量翻译markdown文件, 翻译完成的内容配合开源工具 https://github.com/fanderzon/markdown-to-medium-tool 可以发到Medium, 实现内容出海。

  • 自动记录进度,如果有100篇markdown文件待翻译,翻译到第50篇断了,再次运行python main.py, 可以根据.md_sha1中记录的信息,自动从第50篇进行翻译,节约token

  • input_markdown_file_dir中记录的markdown文件修改后,运行python main.py, 会只翻译修改后的markdown文件, 节约token

  • 在main.py顶部变量, 可以自定义输入和输出文件夹

关于Prompt

Prompt来自 https://github.com/smikitky/chatgpt-md-translator/blob/main/prompt-example.md

大多数Markdown的格式的翻译都很完美,也会会出现省略超长代码段的问题,如果有更好的prompt,我会更新。

transmd's People

Contributors

zhaoolee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.