Talk

Design LLM-based algorithm to organize subtitles into paragraphs and chapters

From Wikiprompt, the free prompt encyclopedia

宝玉
Contributed by宝玉XSource

Dec 19, 2024

Design LLM-based algorithm to organize subtitles into paragraphs and chapters A detailed prompt asking to design an algorithm using LLM to organize subtitle segments into paragraphs and chapters, with specific constraints on context window, pagination, cost, and output format.

Prompt ContentSave

🌐
现在我有一个字幕json文件,格式为 ```TypeScript type SubtitleSegment = { start: number; end: number; text: string; words: { word: string; start: number; end: number }[]; }; type Subtitle = { segments: SubtitleSegment[]; }; ``` Segment可以理解为一个句子或者句子的一部分,现在请帮我设计一个算法,根据字幕文件内容中句子之间的关系,整理成段落(Paragraph)和章节(Chapter)。 返回的格式为 ```TypeScript type Paragraph = { start: number; end: number; text: string; segments: SubtitleSegment[]; }; type Chapter = { title: string; paragraphs: Paragraph[]; }; type Transcription = { chapters: Chapter[]; }; ``` 使用大语言模型技术,但是要考虑: 1. 上下文窗口长度,字幕内容可能很长很长,所以需要事先分页 2. 如果分页,注意不要让段落和章节之间出现断层,也就是不要让一个章节的内容被分到两页中导致上下文不连贯 3. 大语言模型不擅长数数,所以不能要求它输出字符位置,只能返回拆分后的结果做分析 4. 大语言模型可以返回结构化数据,但是要注意返回的内容不一定精准,可能会有删减文字、标点 5. 最好能考虑大模型调用的成本,不要让大模型调用次数太多或者传输的数据太多,比如是否可以一次返回章节和段落的关系 请设计算法,可以辅助代码说明

Sign in to see the full prompt

Continue with:

By logging in, you agree to our Terms of Use and Privacy Policy

Usage

This prompt is designed for use with coding. Copy the prompt content above and paste it into your preferred AI tool.

For best results, you may customize the placeholders (indicated by square brackets or capital letters) with your specific requirements.

References

Categories:coding| twitter| llm-algorithm| subtitle-processing

Talk