i18n-ai-translate开源程序,可以使用DeepSeek等模型将您的 i18nJSON翻译成任何语言
一、软件介绍
文末提供程序和源码下载
i18n-ai-translate开源程序使用 DeepSeek等模型可以将您的 i18n JSON 翻译成任何语言。 无缝翻译本地化文件。支持嵌套翻译文件的目录。需要i18next样式的JSON 文件(文末一并提供下载)。
二、模式
CSV 模式
三个提示链接在一起,以确保每个翻译格式正确。
- 翻译提示尝试翻译
- 翻译验证提示使用单独的上下文来验证翻译
- 样式验证提示使用另一个上下文来验证翻译的格式是否与源一致
JSON 模式
翻译和验证分两个单独的步骤完成。
- 翻译提示尝试翻译整个文件
- 翻译验证提示会验证/修复并再次验证每一行。
- 在两次调用之间保留历史记录,以确保翻译整个文件时的一致性。
三、Usage 用法
Quick-start 快速启动
GitHub Actions GitHub 作
使用 GitHub Action 将其合并到您的 CI 中,以将每个拉取请求的密钥自动转换为新提交。所有可配置选项均以 action.yml 形式提供。
下面翻译了 i18n/en.json
被修改的每个 PR:
name: i18n-ai-translateon:pull_request:# Only trigger when en.json has been modifiedpaths:- "i18n/en.json"jobs:build:runs-on: ubuntu-lateststeps:- name: i18n-ai-translateuses: taahamahdi/i18n-ai-translate@masterwith:json-file-path: i18n/en.jsonapi-key: ${{ secrets.OPENAI_API_KEY }}
四、Running directly 直接运行
git clone git@github.com:taahamahdi/i18n-ai-translate.git cd i18n-ai-translate yarn cp /home/en.json jsons/# Generate French translations npm run i18n-ai-translate -- translate -i en.json -o fr.json --engine chatgpt --model gpt-4o --api-key <openai_key>
Running as a script in your own project在您自己的项目中作为脚本运行
yarn add i18n-ai-translate# Generate French translations npx i18n-ai-translate translate -i en.json -o fr.json --engine gemini --model gemini-2.0-flash-exp --api-key <gemini_key># Or, assuming you already have other translations in the current directory npx i18n-ai-translate diff --before en-before.json --after en.json --input-language English --engine claude --model claude-3-5-sonnet-latest --api-key <anthropic_key>
Running as a library 作为库运行
import { translate } from "i18n-ai-translate"; ... const englishJSON = {"welcomeMessage": "Welcome, {{name}}!","messages": {"notifications_one": "You have one notification","notifications_other": "You have {{count}} notifications","delete": "Would you like to delete the \"{{name}}\" category?"} };const frenchTranslation = await translate({inputJSON: englishJSON,inputLanguage: "English",outputLanguage: "French",... });console.log(frenchTranslation);
{"welcomeMessage": "Bienvenue, {{name}} !","messages": {"notifications_one": "Vous avez une notification","notifications_other": "Vous avez {{count}} notifications","delete": "Voulez-vous supprimer la catégorie « {{name}} » ?"} }
Script 脚本
Use i18n-ai-translate translate
to convert a local i18n JSON file to any language. Relative paths begin from the jsons/
directory.
使用 i18n-ai-translate translate 将
本地 i18n JSON 文件转换为任何语言。相对路径从 jsons/
目录开始。
Use i18n-ai-translate diff
to find the differences between two versions of a source language file, and apply them to all language files in the same directory.
使用 i18n-ai-translate diff
查找源语言文件的两个版本之间的差异,并将它们应用于同一目录中的所有语言文件。
Create a .env
file with an entry for your API key, or pass the --api-key
flag.
创建一个包含 API 密钥条目的 .env
文件,或传递 --api-key
标志。
GEMINI_API_KEY=<your Gemini API key>
OPENAI_API_KEY=<your OpenAI API key>
ANTHROPIC_API_KEY=<your Anthropic API key>
For Ollama, create an entry for your host, use the --host
flag to set a custom host and path (Defaults to localhost:11434
).
对于 Ollama,为您的主机创建一个条目,使用 --host
标志设置自定义主机和路径(默认为 localhost:11434
)。
OLLAMA_HOSTNAME=<the server and port number running Ollama>
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Usage: i18n-ai-translate [options] [command]Use ChatGPT or Gemini to translate your i18n JSON to any languageOptions:-V, --version output the version number-h, --help display help for commandCommands:translate [options]diff [options]help [command] display help for command
</code></span></span></span></span>
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Usage: i18n-ai-translate translate [options]Options:-i, --input <input> Source i18n file or path of source language, in the jsons/ directory if a relative path is given-o, --output-languages [language codes...] A list of languages to translate to-e, --engine <engine> Engine to use (chatgpt, gemini, ollama, or claude)-m, --model <model> Model to use (e.g. gpt-4o, gemini-2.0-flash-exp, llama3.3, claude-3-5-sonnet-latest)-r, --rate-limit-ms <rateLimitMs> How many milliseconds between requests (defaults to 1s for Gemini, 120ms (at 500RPM) for ChatGPT, 1200msfor Claude)-f, --force-language-name <language name> Force output language name-A, --all-languages Translate to all supported languages-p, --templated-string-prefix <prefix> Prefix for templated strings (default: "{{")-s, --templated-string-suffix <suffix> Suffix for templated strings (default: "}}")-k, --api-key <API key> API key-h, --host <hostIP:port> The host and port number serving Ollama. 11434 is the default port number.--ensure-changed-translation Each generated translation key must differ from the input (for keys longer than 4) (default: false)-n, --batch-size <batchSize> How many keys to process at a time (default: "32")--skip-translation-verification Skip validating the resulting translation through another query (default: false)--skip-styling-verification Skip validating the resulting translation's formatting through another query (default: false)--override-prompt <path to JSON file> Use the prompts from the given JSON file, containing keys for at least one of generationPrompt,translationVerificationPrompt, stylingVerificationPrompt--prompt-mode <prompt-mode> Chose between 'csv' mode for better performance and 'json' mode for better compatibility,--batch-max-tokens <batch-max-tokens> For json mode only, maximum size of a single request in tokens--verbose Print logs about progress (default: false)--help display help for command
</code></span></span></span></span>
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Usage: i18n-ai-translate diff [options]Options:-b, --before <fileOrDirectoryBefore> Source i18n file or directory before changes, in the jsons/ directory if a relative path is given-a, --after <fileOrDirectoryAfter> Source i18n file or directory after changes, in the jsons/ directory if a relative path is given-l, --input-language <inputLanguageCode> The input language's code, in ISO6391 (e.g. en, fr)-e, --engine <engine> Engine to use (chatgpt, gemini, ollama, or claude)-m, --model <model> Model to use (e.g. gpt-4o, gemini-2.0-flash-exp, llama3.3, claude-3-5-sonnet-latest)-r, --rate-limit-ms <rateLimitMs> How many milliseconds between requests (defaults to 1s for Gemini, 120ms (at 500RPM) for ChatGPT, 1200ms forClaude)-k, --api-key <API key> API key-h, --host <hostIP:port> The host and port number serving Ollama. 11434 is the default port number.--ensure-changed-translation Each generated translation key must differ from the input (for keys longer than 4) (default: false)-p, --templated-string-prefix <prefix> Prefix for templated strings (default: "{{")-s, --templated-string-suffix <suffix> Suffix for templated strings (default: "}}")-n, --batch-size <batchSize> How many keys to process at a time (default: "32")--skip-translation-verification Skip validating the resulting translation through another query (default: false)--skip-styling-verification Skip validating the resulting translation's formatting through another query (default: false)--override-prompt <path to JSON file> Use the prompts from the given JSON file, containing keys for at least one of generationPrompt,translationVerificationPrompt, stylingVerificationPrompt--prompt-mode <prompt-mode> Chose between 'csv' mode for better performance and 'json' mode for better compatibility,--batch-max-tokens <batch-max-tokens> For json mode only, maximum size of a single request in tokens--verbose Print logs about progress (default: false)--help display help for command
</code></span></span></span></span>
Example usage 用法示例
npx i18n-ai-translate translate -i en.json -o fr
- Translate the
en.json
file injsons/
to French, and save the output infr.json
将jsons/
中的en.json
文件翻译成法语,并将输出保存在fr.json
中
npx i18n-ai-translate translate -i en.json -o es de nl --engine gemini
- Translate the
en.json
file injsons/
to Spanish, German, and Dutch, and save each file injsons/
, using Google Gemini
使用 Google Gemini 将jsons/
中的en.json
文件翻译成西班牙语、德语和荷兰语,并将每个文件保存在jsons/
中
npx i18n-ai-translate diff -b en.json -a en-after.json -l English --verbose --engine ollama --host my-olllama-server.com:12345
- Translate the keys that have changed between
en.json
anden-after.json
for all files in theen.json
directory, with logging enabled using Ollama running onmy-ollama-server.com:12345
转换en.json
目录中所有文件的en.json
和en-after.json
之间更改的键,并使用在my-ollama-server.com:12345
上运行的 Ollama 启用日志记录
npx i18n-ai-translate translate -i en.json -A --engine chatgpt --model gpt-4-turbo --api-key <my_key> --rate-limit-ms 150 -n 64
- Translate the
en.json
file injsons/
to 200+ languages, save each file injsons/
, using the GPT-4 Turbo model of ChatGPT, with the given key, a rate limit of 150ms between requests, and 64 keys sent in each batch
将jsons/
的en.json
文件翻译成 200+ 种语言,使用 ChatGPT 的 GPT-4 Turbo 模型,使用给定的 key,请求之间的限速为 150ms,每批发送 64 个 key
npx i18n-ai-translate diff -b en -a en-after --engine claude
- Translate the keys that have changed between
en/
anden-after/
for all JSON files in both directories using Claude
使用 Claude 翻译两个目录中所有 JSON 文件的en/
和en-after/
之间更改的键
五、As a library 作为库
或者,导入此项目并使用它通过 translate() 即时转换 JSON,或者在源 i18n 文件发生更改时使用 translateDiff() 获取已修改键的更新。
import { translate, translateDiff } from "i18n-ai-translate";...const translation = await translate({apiKey, // OpenAI/Gemini/Anthropic API keybatchMaxTokens, // Maximum amount of tokens for one requestbatchSize, // How many keys to process at a timechatParams, // Additional configuration to pass to the modelengine, // ChatGPT, Gemini, Ollama, or ClaudeensureChangedTranslation, // Every key longer than 4 characters must be different than the inputhost, // The host and port number running OllamainputJSON, // JSON to translateinputLanguage, // Language of inputJSONmodel, // Model to use (e.g. gpt-4o, gemini-2.0-flash-exp, llama3.3, claude-3-5-sonnet-latest)outputLanguage, // Targeted language (e.g. French, Spanish, etc.)overridePrompt, // Set custom prompts for generation or verificationpromptMode, // Chose between 'csv' mode and 'json' moderateLimitMs, // How many milliseconds between requestsskipStylingVerification, // Whether to skip an additional query to see whether the text formatting remained consistentskipTranslationVerification, // Whether to skip an additional query to see whether the resultant translation makes sensetemplatedStringPrefix, // The start of inline variables; defaults to "{{"templatedStringSuffix, // The end of inline variables; defaults to "}}"verbose, // Print status of conversion to stdout/stderr});const translations = await translateDiff({apiKey, // OpenAI/Gemini/Anthropic API keybatchMaxTokens, // Maximum amount of tokens for one requestbatchSize, // How many keys to process at a timechatParams, // Additional configuration to pass to the modelengine, // ChatGPT, Gemini, Ollama, or ClaudeensureChangedTranslation, // Every key longer than 4 characters must be different than the inputhost, // The host and port number running OllamainputJSONAfter, // The source translation after a changeinputJSONBefore, // The source translation before a changeinputLanguage, // Language of inputJSONBefore/Aftermodel, // Model to use (e.g. gpt-4o, gemini-2.0-flash-exp, llama3.3, claude-3-5-sonnet-latest)overridePrompt, // Set custom prompts for generation or verificationpromptMode, // Chose between 'csv' mode and 'json' moderateLimitMs, // How many milliseconds between requestsskipStylingVerification, // Whether to skip an additional query to see whether the text formatting remained consistentskipTranslationVerification, // Whether to skip an additional query to see whether the resultant translation makes sensetemplatedStringPrefix, // The start of inline variables; defaults to "{{"templatedStringSuffix, // The end of inline variables; defaults to "}}"toUpdateJSONs, // An object of language codes to their translationsverbose, // Print status of conversion to stdout/stderr });
六、CSV Mode CSV 模式
Translation prompt 翻译提示
Batches of the i18n input are passed in. Each call is checked to ensure no keys are lost, all templated strings are retained, and no translations were skipped.
传入 i18n 输入的批次。检查每个调用以确保没有键丢失,所有模板化字符串都被保留,并且没有跳过任何翻译。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>You are a professional translator.Translate each line from ${inputLanguage} to ${outputLanguage}.Return translations in the same text formatting.Maintain case sensitivity and whitespacing.Output only the translations.All lines should start and end with an ASCII quotation mark (").${input}
</code></span></span></span></span>
Translation verification prompt
翻译验证提示
The output of the translation is sent back to ensure the model is okay with the translation. If this fails, the translation is re-generated.
将翻译的输出发回以确保模型对翻译没有问题。如果失败,则会重新生成转换。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Given a translation from ${inputLanguage} to ${outputLanguage} in CSV form, reply with NAK if _any_ of the translations are poorly translated.Otherwise, reply with ACK.Only reply with ACK/NAK.
</code></span></span></span></span>
Styling verification prompt
样式验证提示
Formatting from the input should be retained where possible. If punctuation, capitalization, or whitespaces differ between the source and the translation, the translation is re-generated.
应尽可能保留输入中的格式。如果源和翻译之间的标点符号、大小写或空格不同,则会重新生成翻译。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Given text from ${inputLanguage} to ${outputLanguage} in CSV form, reply with NAK if _any_ of the translations do not match the formatting of the original.Check for differing capitalization, punctuation, or whitespaces.Otherwise, reply with ACK.Only reply with ACK/NAK.
</code></span></span></span></span>
JSON Mode JSON 模式
Translation prompt json 翻译提示 json
Batches of the i18n input are passed in. Each call is checked to ensure no keys are lost, all templated strings are retained, and no translations are skipped.
传入 i18n 输入的批次。检查每个调用以确保没有键丢失,保留所有模板化字符串,并且不会跳过任何翻译。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>You are a professional translator.Translate from ${inputLanguage} to ${outputLanguage}.- Translate each object in the array.
- 'original' is the text to be translated.
- 'translated' must not be empty.
- 'context' is additional info if needed.
- 'failure' explains why the previous translation failed.
- Preserve text formatting, case sensitivity, and whitespace.Special Instructions:
- Treat anything in the format {{variableName}} as a placeholder. Never translate or modify its content.
- Do not add your own variables
- The number of variables like {{timeLeft}} must be the same in the translated text.
- Do not convert {{NEWLINE}} to \\n.Return the translation as JSON.
\`\`\`json
${input}
\`\`\`
</code></span></span></span></span>
Translation verification prompt json
翻译验证提示 json
The output of the translation is sent back to ensure the model is okay with the translation/formatting. If this fails, the translation is re-generated.
将翻译的输出发回,以确保模型对翻译/格式设置没有问题。如果失败,则会重新生成转换。
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:#1f2328"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>You are a professional translator.Check translations from ${inputLanguage} to ${outputLanguage}.- Verify each object in the array.
- 'original' is the text to be translated.
- 'translated' is the translated text.
- 'context' is additional info if needed.
- 'failure' explains why the previous translation failed.
- check for Accuracy (meaning, tone, grammar), Formatting (case, whitespace, punctuation).If correct, return 'valid' as 'true' and leave 'fixedTranslation' and 'issue' empty.
If incorrect, return 'valid' as 'false' and put the fixed translation in 'fixedTranslation' and explain what is 'issue'.Special Instructions:
- Treat anything in the format {{variableName}} as a placeholder. Never translate or modify its content.
- Do not add your own variables
- The number of variables like {{timeLeft}} must be the same in the translated text.
- Do not convert {{NEWLINE}} to \\n.Allow minor grammar, phrasing, and formatting differences if meaning is clear.
Flag only significant issues affecting accuracy or readability.Return the verified as JSON.
\`\`\`json
${input}
\`\`\`
</code></span></span></span></span>
Prompt overriding 提示覆盖
Replace the aforementioned prompts with your own by creating a JSON file containing keys of at least one of generationPrompt
, translationVerificationPrompt
, or stylingVerificationPrompt
. Then, pass it as an argument with --override-prompt <path to file>
. Be sure to include templated arguments like ${inputLanguage}
as part of the prompt.
通过创建一个 JSON 文件,将上述提示替换为您自己的提示,该文件至少包含 generationPrompt
、translationVerificationPrompt
或 stylingVerificationPrompt
中的至少一个键。然后,将其作为参数传递。 --override-prompt <path to file>
请务必在提示符中包含模板化参数,例如 ${inputLanguage}
。
软件下载
夸克网盘分享
本文信息来源于GitHub作者地址:https://github.com/taahamahdi/i18n-ai-translate
相关文章:
i18n-ai-translate开源程序,可以使用DeepSeek等模型将您的 i18nJSON翻译成任何语言
一、软件介绍 文末提供程序和源码下载 i18n-ai-translate开源程序使用 DeepSeek等模型可以将您的 i18n JSON 翻译成任何语言。 无缝翻译本地化文件。支持嵌套翻译文件的目录。需要i18next样式的JSON 文件(文末一并提供下载)。 二、模式 CSV 模式 三个…...
关于Android Studio的Gradle各项配置
Gradle 构建概览 Android 应用通常使用 Gradle 构建系统构建。在深入了解如何配置 build 之前,我们先来探索 build 背后的概念,以便您全面了解系统。 什么是 build? 构建系统会将源代码转换为可执行应用。构建通常涉及多个工具,用…...
数据安全和合规性市场分析
一、什么是数据安全和合规性 在数据安全和合规性方面,存在着一系列重要的法律、法规和行业标准,这些规定了组织如何收集、存储、处理和保护个人数据及其他敏感信息。企业之所以要遵守这些规定,是出于多方面的考量,既有法律责任&a…...
venv环境基础指令以及常见问题汇总(持续更新)
常见指令 在 Python 原生虚拟环境(venv) 中,没有直接列出所有虚拟环境的命令(因为 venv 不像 Conda 那样有集中管理机制),但可以通过 文件操作 或 脚本 实现类似功能。以下是常用命令和技巧: &…...
思科路由器重分发(RIP动态路由+静态路由)
路由器重分发(RIP动态路由静态路由) 静态路由不能作翻译官 RIP需要宣告自己的ip;还需要帮静态路由也宣告一下开启端口并配置IP地址 RIP路由 Router>en Router#conf t Router(config)#int g0/0 Router(config-if)#no shutdown Router(c…...
产销协同的作用是什么?又如何对各部门发挥作用?
目录 一、产销协同的对象有哪些? 1. 客户需求 2. 市场趋势 3. 供应链伙伴 4. 企业战略目标 二、产销协同的作用是什么? 1. 提高客户满意度 2. 降低企业成本 3. 增强市场竞争力 4. 优化资源配置 三、产销协同对各部门怎么发挥作用?…...
19.【.NET 8 实战--孢子记账--从单体到微服务--转向微服务】--单体转微服务--当前项目拆分规划
随着业务规模的不断扩大和系统复杂度的提升,孢子记账系统需要进行微服务架构的转型。本文将详细规划从单体应用向微服务架构迁移的具体方案,包括功能模块分析、服务拆分、技术选型以及实施步骤等内容。通过合理的服务拆分和架构设计,未来我们…...
JFLAP SOFTWARE 编译原理用(自动机绘图)
csdn全是蛆虫,2mb的软件,都在那里搞收费,我就看不惯,我就放出来,那咋了!!! https://pan.baidu.com/s/1IuEfHScynjCCUF5ScF26KA 通过网盘分享的文件:JFLAP7.1.jar 链接: h…...
从 Vue 到 React:React 合成事件
目录 一、什么是 React 合成事件?二、处理流程React 事件系统的大致流程和 Vue 3 的区别 三、用法示例四、SyntheticEvent 的特点五、为什么 React 要统一事件到根节点?1.减少事件监听器数量2. 简化事件解绑逻辑3. 保证一致的行为 六、React 18 后事件系…...
react的fiber 用法
在 React 里,Fiber 是 React 16.x 及后续版本采用的协调算法,它把渲染工作分割成多个小任务,让 React 可以在渲染过程中暂停、恢复和复用任务,以此提升渲染性能与响应能力。在实际开发中,你无需直接操作 Fiber 节点&am…...
深度学习-学习笔记
文章目录 1、概述2、学习笔记2.1、pytorch 的环境配置 1、概述 本篇博客用来记录我学习深度学习的学习笔记 参考视频:PyTorch深度学习快速入门教程 PyTorch 是一个开源的机器学习框架,主要用于构建和训练深度学习模型。 2、学习笔记 2.1、pytorch 的环…...
[创业之路-390]:人力资源 - 社会性生命系统的解构与重构:人的角色嬗变与组织进化论
前言: 人、财、物、信息、机制、流程、制度、方法共同组合了一个持续的消耗资源、持续的价值创造、持续面临生存与发展、遗传与变异的社会性生命系统。 "人"是所有社会性生命系统最最基础性的要素,它弥漫在系统中多维立体空间的不同节点上&am…...
Redis常见面试题——List对象
当然可以!这里我帮你整理了一份【Redis中 List 结构】相关的高频面试题,并附上简明回答: 📚 Redis List 结构面试题(高频总结版) 1. Redis 中的 List 是什么?底层是什么实现的? 答&…...
案例速成GO操作redis,个人笔记
更多个人笔记:(仅供参考,非盈利) gitee: https://gitee.com/harryhack/it_note github: https://github.com/ZHLOVEYY/IT_note 安装redis客户端:go get github.com/redis/go-redis/v9 注意go …...
什么是WebSocket?NGINX如何支持WebSocket协议?
大家好,我是锋哥。今天分享关于【什么是WebSocket?NGINX如何支持WebSocket协议?】面试题。希望对大家有帮助; 什么是WebSocket?NGINX如何支持WebSocket协议? 1000道 互联网大厂Java工程师 精选面试题-Java…...
ssm驾校预约管理系统的设计与实现(源码+lw+部署文档+讲解),源码可白嫖!
摘要 伴随着我国社会的发展,人民生活质量日益提高。在人们出行方式上的体现就是,价格较为昂贵的代步工具——汽车,它的拥有率在我国越来越高了。而汽车的行驶速度很快,并且随着汽车拥有率的增加,城市中行驶和停靠的车…...
babel核心知识点
Babel 是一个 JavaScript 编译器,主要用于将 ECMAScript 2015 版本的代码转换为向后兼容的 JavaScript 代码,以便在旧版本的浏览器或环境中运行。以下是 Babel 的核心知识点: 1. 基本概念 编译器:Babel 本质上是一个编译器&…...
学习笔记(算法学习+Maven)
单调队列优化多重背包 #include <bits/stdc.h> using namespace std; const int M 2010; const int N 20010; int q[N]; int hh 0, tt -1; int f[N]; int g[N]; int v[M], w[M], s[M]; int n, m; int main() { cin >> n >> m; for (int i 1; …...
买币永续合约成全球交易热点,XBIT去中心化交易所平台显著提升市场流动性
在全球加密货币市场日益扩大的背景下,买币永续合约正展现出惊人的增长势头。虽然比特币自2021年黄金时期以来整体兴趣有所减弱,但永续合约市场表现亮眼,专业和机构交易者正从传统日历期货转向这一领域,使得永续合约占据了约66%的未…...
详解 `from datasets import load_dataset`:数据格式、公开数据集与自定义数据集实战指南
在自然语言处理(NLP)和机器学习领域,Hugging Face 的 datasets 库凭借其高效的数据加载和预处理能力成为开发者必备工具。本文通过代码示例详解 load_dataset 的核心用法,涵盖数据格式解析、公开数据集调用和自定义数据集构建。 一、数据格式解析与加载示例 datasets 库支…...
Eclipse 插件开发 1
Eclipse 插件开发 1 1 创建 Eclipse 插件2 特点对比表3 总结对比表 Eclipse 是一个功能强大的集成开发环境(IDE),最初为 Java 开发设计,但现在已经支持多种语言和平台。它的核心优势在于高度可扩展的插件架构,使开发者能够定制开发环境以满足…...
单链表专题(1)
1.什么是链表? 链表是结构体变量与结构体变量连接在一起 2.动态创建一个链表 动态内存申请模块化设计 1.创建链表(创建一个表头表示整个链表) 2.创建结点 3.插入结点 4.删除结点 5.打印遍历链表(测试) 3.创建链…...
[贪心_8] 跳跃游戏 | 单调递增的数字 | 坏了的计算器
目录 1.跳跃游戏 题解 2.单调递增的数字 证明 3.坏了的计算器 题解 解法一:正向推导 解法二:正难则反 1.跳跃游戏 链接: 55. 跳跃游戏 给你一个非负整数数组 nums ,你最初位于数组的 第一个下标 。数组中的每个元素代表你…...
Python基于Django的全国二手房可视化分析系统【附源码】
博主介绍:✌Java老徐、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 🍅文末获取源码联系🍅 👇🏻 精彩专栏推荐订阅👇&…...
Spring Boot 升级指南(2.x → 3.x)
🚀 Spring Boot 升级指南(2.x → 3.x) 🔢 1️⃣ 必读文档 📘 当您需要从 Spring Boot 2.x 升级时: • 官方迁移指南 → https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-…...
基于亚马逊云科技构建音频转文本无服务器应用程序
Amazon Transcribe是一项基于机器学习模型自动将语音转换为文本的服务。它提供了多种可以提高文本转录准确性的功能,例如语言自定义、内容过滤、多通道音频分析和说话人语音分割。Amazon Transcribe 可用作独立的转录服务,也可以集成到应用程序中提供语音…...
io_uring概述:现代 Linux 异步 IO 的新范式
一、引言 在 Linux 系统中,I/O 性能一直是高性能服务器、数据库、存储系统的关键瓶颈。传统的 I/O 接口(如 read、write、poll、epoll)已经难以满足现代高吞吐低延迟场景的需求。io_uring 的诞生,正是为了解决这些传统 I/O 模型中…...
定制一款国密浏览器(12):分析SM2签名算法的实现
SM2 是一种非对称加密算法,除了用来进行加密解密外,主要作用还用作数字签名。数字签名是私钥签名,公钥用来验签。由于私钥是不公开的,所以私钥签名还可以防抵赖。 一般的签名流程如下: 发送者对消息计算摘要值。发送者用私钥对摘要值进行签名得到签名值。发送者将原始消息…...
SSE协议
目录 SSE协议协议实现传输格式data 字段id 字段event 字段retry 字段 前后端实现使用案例FastAPI SSE-STARLETTE 模拟大模型推理流🖥 代码:FastAPI SSE-STARLETTE 模拟大模型推理流 SSE协议 SSE,全称是 Server-Sent Events,是一…...
精益数据分析(25/126):关键指标驱动业务发展
精益数据分析(25/126):关键指标驱动业务发展 在创业和数据分析的道路上,我们都在不断探索如何利用数据实现业务的增长与优化。今天,让我们一起深入学习《精益数据分析》中的关键知识点,通过实际案例来理解…...
基于Spring AI Alibaba + Spring Boot + Ollama搭建本地AI对话机器人API
前言 Spring AI Alibaba 开源项目基于 Spring AI 构建,是阿里云通义系列模型及服务在 Java AI 应用开发领域的最佳实践,提供高层次的 AI API 抽象与云原生基础设施集成方案,帮助开发者快速构建 AI 应用。 项目地址 gitcode平台:ht…...
git 工具
Git教程 Git Bash详细教程 Git教程 Git Bash详细教程-CSDN博客 Download – TortoiseGit – Windows Shell Interface to Git...
利用【指针引用】对【非空单循环链表】进行删除操作
【非空单循环链表】是链式存储结构的其中一种,下面是各个词汇的意思: 先说【单】的意思: 这里指的是【单循环】的,另外在别的地方你会碰到一些不一样的循环链表,比如说是【多重链】的。 单循环 【单循环链表】常在表的…...
2025.4.26_STM32_SPI
1.SPI简介 2.硬件电路 所有SPI设备的SCK(时钟)、MOSI(主机输出从机输入)、MISO(主机输入从机输出)分别连在一起。SCK线只能被主机控制,和I2C相同。 主机另外引出多条SS控制线,分别接到各从机的SS引脚 (SS不用的时候为高电平,当主机需要选中某…...
基于OpenMV+STM32+OLED与YOLOv11+PaddleOCR的嵌入式车牌识别系统开发笔记
基于OpenMV、STM32与OLED的嵌入式车牌识别系统开发笔记 基于OpenMV、STM32与OLED的嵌入式车牌识别系统开发笔记系统架构全景 一、实物演示二、OpenMV端设计要点1. 硬件配置优化2. 智能帧率控制算法3. 数据传输协议设计 三、PyTorch后端核心实现:YOLOv11与PaddleOCR的…...
当JIT遇见K8s
目录 一、技术融合背景:从静态架构到动态生态的范式重构 1.1 动态编译技术的三次进化浪潮 1.2 容器编排系统的动态特性解剖 弹性伸缩的数学建模 服务质量(QoS)的编译场景适配 硬件拓扑感知的编译优化 二、关键技术挑战与突破性解决方案…...
单片机-89C51部分:4、固件烧录
飞书文档https://x509p6c8to.feishu.cn/wiki/M00gwFX3WilLe0kiAmBcPBUsnLc 接线 通过USB线把开发板和电脑连接起来,如果电脑没有安装过USB转串口驱动,在设备管理器中就找不到COM口,而且会有驱动提示叹号,我们可以下载下方驱动安…...
7.13 GitHub Sentinel全链路测试实战:自动化框架+零误差传输,QPS提升6倍!
GitHub Sentinel全链路测试实战:自动化框架+零误差传输,QPS提升6倍 GitHub Sentinel Agent 用户界面设计与实现 关键词:前后端联调测试、数据传输验证、接口稳定性测试、命令行工具测试、自动化测试框架 测试前后端功能与数据传输稳定性 1. 全链路测试策略设计 采用分层…...
stm32之EXIT外部中断详解
目录 1.引入: STM32F1031.1 中断路径上的3个部件1.2 STM32F103的GPIO中断1.1.1 GPIO控制器 -- AFIO1.1.2 EXTI1.1.3 NVIC1.1.4 CPU1. PRIMASK2. FAULTMASK3. BASEPRI 1.3 中断执行流程 2.旋转编码器介绍3.实验3.1 EXIT3.1.1 结构体3.1.2 函数 3.2 NVIC3.2.1 结构体3.2.2 函数 3…...
STM32 开发 - stm32f10x.h 头文件(内存映射、寄存器结构体与宏、寄存器位定义、实现点灯案例)
概述 STM32F10x.h 是 STM32F1 系列微控制器的核心头文件,提供了所有外设寄存器的定义和内存映射 一、内存映射 #define PERIPH_BASE ((uint32_t)0x40000000)#define APB1PERIPH_BASE PERIPH_BASE #define APB2PERIPH_BASE (PERIPH_BASE 0x…...
UniApp 的现状与 WASM 支持的迫切性
一、UniApp 的跨平台优势与性能瓶颈 UniApp 凭借“一次开发,多端发布”的核心理念,已成为跨平台开发的主流框架之一。然而,随着移动应用场景的复杂化(如 3D 渲染、音视频处理、AI 推理),传统的 JavaScript…...
Prometheus、Zabbix和Nagios针对100个节点的部署设计架构图
一、Prometheus 架构图(联邦集群+分布式存储) graph TD;subgraph 全局监控层GlobalProm[Prometheus Server] -->|联邦查询| RegionalProm1[区域Prometheus]GlobalProm -->|联邦查询| RegionalProm2[区域Prometheus]GlobalProm -->|联邦查询| RegionalProm3[区域Pro…...
坚果派已适配的鸿蒙版flutter库【持续更新】
坚果派已适配的鸿蒙版flutter库 序号原仓版本适配仓文章解读是否完成1https://pub.dev/packages/fluttertoast8.2.12https://gitcode.com/nutpi/FlutterToasthttps://www.nutpi.net/thread?topicId1575是2https://pub.dev/packages/flutter_udid4.0.0https://gitcode.com/nut…...
代码随想录打卡|Day28 动态规划(理论基础、斐波那契数列、爬楼梯、使用最小花费爬楼梯)
动态规划 Part01 理论基础 代码随想录讲解链接 视频讲解链接 斐波那契数 力扣题目链接 代码随想录链接 视频讲解链接 题目描述: 斐波那契数 (通常用 F(n) 表示)形成的序列称为 斐波那契数列 。该数列由 0 和 1 开始,后面的每一…...
《USB技术应用与开发》第四讲:实现USB鼠标
一、标准鼠标分析 1.1简介 1.2页面显示 其中页面显示的“”不用管它,因为鼠标作为物理抓包,里面有时候会抓到一些错误,不一定是真正的通讯错误,很可能是本身线路接触质量不好等原因才打印出来的“”。 1.3按下鼠标左键 &#x…...
elk中kibana一直处于可用和降级之间且es群集状态并没有问题的解决方法
前言 在公司部elk的时候发现kibana的web界面一直很卡,数据量为0也会很卡,es群集状态正常,资源足够。 报错信息 [2025-03-17T09:54:50.19400:00][INFO ][status] Kibana is now available (was degraded) [2025-03-17T09:55:03.28000:00][I…...
2025.4.26总结
今天把马良老师的《职场十二法则》看完后,感触极大,这们课程就是一场职场启蒙课。 虽然看过不少关于职场的书籍,但大多数是关于职场进阶,方法方面的。并没有解答“面对未来二三十年的职场生涯,我该怎么去看待自己的工…...
一、UI自动化测试01--认识和元素定位方法
目录 一、自动化测试1. 自动化应用场景2. ⾃动化测试的优缺点3. ⾃动化测试的分类 二、UI ⾃动测试1. 适合使用的项目2. 实现时机3. 常⻅的UI⾃动化测试⼯具4. Selenium 框架5. Web ⾃动化环境部署6. Web ⾃动化基本代码 二、元素定位1. 浏览器开发者⼯具⽅法1: 直接获取信息⽅…...
目标检测原理简介
目标检测是一类计算机视觉任务,简单来说,目标检测可被定义为在计算机中输入一张图像,计算机需要找出图像中所有感兴趣的目标(物体),确定它们的类别和位置,如图一所示。目标检测是计算机视觉领域的核心问题之一,相较于最原始的将整张图片分类为某一类别,目标检测不光可…...
软件设计原则
开闭原则 对扩展开放,对修改关闭。在程序需要进行拓展的时候,不能去修改原有的代码,实现一个热插拔的效果。简言之,是为了使程序的扩展性好,易于维护和升级。 想要达到这样的效果,需要使用接口和抽象类。 因…...