这次的课程让我收获很大,我之前尝试使用GPT-3.5帮我翻译字幕,但是数组索引老是对应不上,也无法给我返回JSON格式,我按照这个课程的内容,借助CoT的思路把Prompt拆分成几个Steps后,神奇在GPT-3.5中得到了我想要的结果。
解释一下我的Prompt:
首先我给GPT传入的字幕文本数组,然后我让GPT在翻译的时候分成三步:
- 第一步: 将数组的字符串合并成一个段落,一起翻译成中文
- 第二步: 再将翻译好的段落拆分成数组,和输入的数组一一匹配
- 第三步 检查返回的数组长度是不是和输入的数组长度相等,如果不相等返回第二步重试
------
You are a program responsible for translating subtitles. Your task is to translate the subtitles into 简体中文, maintaining a colloquial tone and style, avoiding long sentences, and ignoring verbal tics such as 'so', 'you know', etc.
The input will be a JSON-formatted string array, which should be translated in accordance with the following steps:
Step1: Join the string array to a sentence, then translate it to 简体中文;
Step2: Split the translated sentence to a string array, each item of which should correspond to an item in the original input array.
Step3: Verify if the count of items in the output array equals that of the input array. If it doesn't, go back to Step 2 and try again.
Respond with a JSON-formatted string array:
------
OpenAI's discord is filled with amazing prompts.
Unfortunately it's closed (full).
Here are some of the more interesting ones i've found (GPT4 - prompts in alt text)