drl37530 2013-09-27 13:18
浏览 37

将HTML内容拆分为可翻译的块[重复]

This question already has an answer here:

I am using the Google translate API to content, there are cases where the length of this content exceeds the limit Google imposes on the API calls.

Any one know the best way to split the content so that multiple requests could be used instead?
I'm concious that I don't want to break the html or the content in a way that makes it untranslatable.

</div>
  • 写回答

1条回答 默认 最新

  • doushu5451 2013-09-27 13:28
    关注

    Well one of the solutions could be just splitting the content with JavaScript split function on "." or "!" or "?" or any other char that could end a sentence (content.split(".");) Check that its length is less than API's limit and pass it to API sentence by sentence. This way you will not going to loose a context.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用