【发布时间】:2022-01-03 04:00:30
【问题描述】:
我想将用 Markdown 扩展 Fountain 编写的剧本转换为 LaTeX(更具体地说是我自己的剧本 LaTeX 模板)。为此,我需要转换以下格式的文本
Some stage directions.
CHARACTER A:
Text the character is saying.
CHARACTER B:
Text the other character is saying.
Some other stage direction.
CHARACTER B:
Some more text the other character is saying.
到
\textit{Some stage directions.}
\dialog{Character A}{Text the character is saying.}
\dialog{Character B}{Text the other character is saying.}
\textit{Some other stage direction.}
\dialog{Character B}{Some more text the other character is saying.}
我想避免从头开始编写这样的程序。是否有允许执行此相当基本的重新格式化的工具或包(例如 Python)?有问题的可能是舞台方向在文本中分布不均匀,即在一个角色说完之后,可能有也可能没有舞台方向。
【问题讨论】:
标签: python text nlp formatting text-processing