鱼C论坛

 找回密码
 立即注册
查看: 758|回复: 20

[已解决]英文前引号的断句问题。为什么大模型的结果才对。编程搞不定呢?

[复制链接]
发表于 2025-6-11 20:20:05 | 显示全部楼层
需求是前引号前面断吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2025-6-11 20:21:38 | 显示全部楼层    本楼为最佳答案   
遍历中直接给引号计数,发现奇数个引号就在前一个字符处加个换行
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2025-6-11 20:51:26 | 显示全部楼层
有很大优化空间,你自己优化吧
  1. text = """But then Wei poured a shower of gold coins into her lap."Never mind where I got them", he whispered. "I am rich."Now I am happy.
  2. But then Wei poured a shower of gold coins into her lap. "Never mind where I got them",he whispered. "I am rich."Now I am happy.
  3. """
  4. text = list(text)
  5. num=0
  6. xxx=0
  7. l=[]
  8. for i in range(len(text)):
  9.     s = text[i]
  10.     if s == '"':
  11.         num+=1
  12.         if num % 2==1:
  13.             l.append(i)
  14. for e in l:
  15.    
  16.     text.insert(e+xxx,'\n')
  17.     xxx+=1
  18.    
  19.    
  20. text=''.join(text)
  21. print(text)
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2025-6-11 20:52:09 | 显示全部楼层
解决了给个最佳
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2025-6-11 22:24:02 | 显示全部楼层
blackantt 发表于 2025-6-11 21:38
英文断句光凭python应该搞不定。
谢谢 引号思路。我试试

无标点断句的话很难,要结合语境等等,
但你这个本来就有标点符号完全可以用Python解决
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-21 02:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表