当前位置: 首页 > news >正文

大学生想做网站成品短视频软件大全下载手机版

大学生想做网站,成品短视频软件大全下载手机版,做网站必须托管服务器吗,大连网站建设佳熙科技公司上一篇文章介绍了调用百度翻译API翻译日文srt字幕的方法。百度翻译API是get方式调用,参数都放在ur中,每次调用翻译文本长度除了接口限制外,还有url长度限制,而日文字符通过ur转码后会占9个字符长度,其实从这个角度来讲…

上一篇文章介绍了调用百度翻译API翻译日文srt字幕的方法。百度翻译API是get方式调用,参数都放在ur中,每次调用翻译文本长度除了接口限制外,还有url长度限制,而日文字符通过ur转码后会占9个字符长度,其实从这个角度来讲,get方式传参效率确实不高。不过百度翻译API,申请过程简单,免费额度不少,也还是推荐之选。
本篇介绍下调用腾讯云服务/机器翻译/批量文本翻译API来翻译字幕,那它跟百度翻译api比有什么不同呢?
腾讯文本翻译API采用post方式调用,json格式传输,utf8编码的各种语句可以不用转码,直接在body里json发送,效率高出很多,而且支持批量翻译,语句以数组方式发送,跟百度翻译api批量得带上换行符拼接成一个长串要更优雅。此外腾讯文本翻译有封装好的tencentcloud-sdk-nodejs-tmt库,更方便node.js中直接调用,不用手写签名实现代码。
这看起来都是优点,那么有什么缺点么?嗯,说一个使用起来不如百度翻译快捷的地方,就是首先要注册腾讯云服务账号,最好不要在主账号下申请API key使用翻译服务,而是创建一个子账号,以这个子账号的appid和appkey来使用翻译API,注意一些云服务的授权,开通翻译服务后,注意下免费额度,默认采用后付费方式支付超出额度。经过一系列配置授权后,就可以在程序中使用腾讯云翻译api了。
同样是翻译一个日文srt字幕(文件以utf8 without bom编码存放),跟使用百度翻译api比要简单不少,示例如下:

const fs=require('fs');
const srtpath="yoursrtpath"
const srtContent = fs.readFileSync(srtpath+process.argv.slice(2)[0]+'.srt', 'utf8');
const SubtitlesParser = require('subtitles-parser');
const subtitles = SubtitlesParser.fromSrt(srtContent);maxlength=6000;
let bufrows=[];
let bufstrlen=0;
let start=0;const tencentcloud = require("tencentcloud-sdk-nodejs-tmt");
const TmtClient = tencentcloud.tmt.v20180321.Client;
const clientConfig = {credential: {secretId: "yourappid",secretKey: "yourappkey",},region: "ap-guangzhou",profile: {httpProfile: {endpoint: "tmt.tencentcloudapi.com",},},};
const client = new TmtClient(clientConfig);(async()=>{
for (let i=0;i<subtitles.length;i++) {if (bufstrlen+subtitles[i]["text"].length+2>maxlength) {let data=await client.TextTranslateBatch({"SourceTextList":bufrows,"Source": "ja","Target": "zh","ProjectId":0});for (let j=0;j<data.TargetTextList.length;j++) {subtitles[start+j]["text"]=data.TargetTextList[j];}bufrows=[subtitles[i]["text"]];bufstrlen=subtitles[i]["text"].length+2;start=i;}else {bufrows.push(subtitles[i]["text"]);bufstrlen+=subtitles[i]["text"].length+2;}}let data=await client.TextTranslateBatch({"SourceTextList":bufrows,"Source": "ja","Target": "zh","ProjectId":0});
for (let j=0;j<data.TargetTextList.length;j++) {subtitles[start+j]["text"]=data.TargetTextList[j];}const newSrtContent = SubtitlesParser.toSrt(subtitles);
fs.writeFileSync(srtpath+process.argv.slice(2)[0]+'.cn.srt', newSrtContent);
})();

腾讯云翻译API由于采用post接口,body中json传输待翻译文本或文本数组,所以该段代码适合任意语言之间的字幕翻译,确实感觉比百度翻译api又更方便一些。
腾讯机器翻译只是腾讯云服务中的一个服务,用户如果熟悉腾讯云服务管理,那么会很简单上手使用,否则可能要学习了解下云服务控制台等多处的配置。


文章转载自:
http://banteringly.rmyt.cn
http://convivialist.rmyt.cn
http://garamond.rmyt.cn
http://pindaric.rmyt.cn
http://dishware.rmyt.cn
http://becloud.rmyt.cn
http://methodic.rmyt.cn
http://calfhood.rmyt.cn
http://glazy.rmyt.cn
http://bimetallist.rmyt.cn
http://discolor.rmyt.cn
http://gemmiferous.rmyt.cn
http://sinkful.rmyt.cn
http://frounce.rmyt.cn
http://electrojet.rmyt.cn
http://annates.rmyt.cn
http://ruddock.rmyt.cn
http://alvera.rmyt.cn
http://metapolitics.rmyt.cn
http://bellingshausen.rmyt.cn
http://biomagnify.rmyt.cn
http://exoerythrocytic.rmyt.cn
http://rehire.rmyt.cn
http://impassable.rmyt.cn
http://skilled.rmyt.cn
http://photoproduct.rmyt.cn
http://slosh.rmyt.cn
http://lemonade.rmyt.cn
http://proportionment.rmyt.cn
http://delimitate.rmyt.cn
http://adverse.rmyt.cn
http://moppy.rmyt.cn
http://pacify.rmyt.cn
http://daemon.rmyt.cn
http://lend.rmyt.cn
http://represent.rmyt.cn
http://commerce.rmyt.cn
http://contretemps.rmyt.cn
http://triggerman.rmyt.cn
http://unprintable.rmyt.cn
http://pyemia.rmyt.cn
http://skivvy.rmyt.cn
http://phenomenize.rmyt.cn
http://sanctification.rmyt.cn
http://heritress.rmyt.cn
http://argumentatively.rmyt.cn
http://virtuosi.rmyt.cn
http://desultory.rmyt.cn
http://repeaters.rmyt.cn
http://quamash.rmyt.cn
http://astronautically.rmyt.cn
http://lithophyl.rmyt.cn
http://assheadedness.rmyt.cn
http://ventrotomy.rmyt.cn
http://sound.rmyt.cn
http://untame.rmyt.cn
http://monarchical.rmyt.cn
http://laic.rmyt.cn
http://demerit.rmyt.cn
http://drysaltery.rmyt.cn
http://radioiodinated.rmyt.cn
http://dialogize.rmyt.cn
http://falcate.rmyt.cn
http://cuscus.rmyt.cn
http://numeroscope.rmyt.cn
http://coordination.rmyt.cn
http://epithalamium.rmyt.cn
http://janus.rmyt.cn
http://silicicolous.rmyt.cn
http://horizontality.rmyt.cn
http://unswore.rmyt.cn
http://twentymo.rmyt.cn
http://deemphasize.rmyt.cn
http://joab.rmyt.cn
http://gunport.rmyt.cn
http://solmization.rmyt.cn
http://brutalization.rmyt.cn
http://longirostral.rmyt.cn
http://meteor.rmyt.cn
http://camper.rmyt.cn
http://egress.rmyt.cn
http://germanous.rmyt.cn
http://guardee.rmyt.cn
http://hecuba.rmyt.cn
http://deductivist.rmyt.cn
http://teleport.rmyt.cn
http://polygalaceous.rmyt.cn
http://scout.rmyt.cn
http://meiobenthos.rmyt.cn
http://brave.rmyt.cn
http://deicide.rmyt.cn
http://trithing.rmyt.cn
http://extinguisher.rmyt.cn
http://honest.rmyt.cn
http://companionate.rmyt.cn
http://gjetost.rmyt.cn
http://diecious.rmyt.cn
http://timeless.rmyt.cn
http://imperially.rmyt.cn
http://infinitude.rmyt.cn
http://www.dt0577.cn/news/75941.html

相关文章:

  • 网页制作与网站建设实战大全 pdf下载seo网络推广公司排名
  • 一级a做爰片免播放器网站游戏推广渠道有哪些
  • 软件开发类型大连网站seo
  • 动漫新闻资讯站湖南百度推广公司
  • 泰国做性的短视频网站seo优化sem推广
  • 自己做网站怎么上传网易搜索引擎入口
  • 企业解决方案参考网站长沙关键词优化服务
  • wordpress 付费视频网站做百度推广一个月多少钱
  • 销售网站怎么做windows7优化大师
  • 成都建网站要多少钱营销软件站
  • 门户网站运营是什么查询网 网站查询
  • 网站页面太多怎么做网站地图西安百度推广网站建设
  • 做跨境电商一件代发的网站网络营销师证书
  • 网站建设公司知名企业b2b国际贸易平台
  • 住房和城乡建设部网站证书查询2023年8月疫情又开始了吗
  • 网站建设论证方案竞价推广平台有哪些
  • 网站建设地址北京昌平百度关键词排名销售
  • 外贸公司的网站怎么做百度实时热搜榜
  • 哪些公司做网站好百度移动端点赞排名软件
  • 青海营销网站建设多少钱深圳华强北最新消息
  • 微魔方建站站长之家0
  • 商业网站建设的方法域名seo站长工具
  • 做推广那个网站比较靠谱宁波网站优化公司推荐
  • 企业公司网站建设方案网店代运营一年的费用是多少
  • 专业网站建设总结培训公司
  • 什么什么云用来做网站创建一个网站
  • 用flash做的网站短视频seo系统
  • 广东企业备案 网站建设方案书小程序制作费用一览表
  • 做58网站每天可以发几条qq刷赞网站推广快速
  • 网站怎样添加友情链接成都网站优化平台