content

语音识别和文字转语音(基于百度AI)

帅比萌擦擦* 提交于 2019-12-02 03:39:58
花了一天时间,直接上代码 语音识别 #Author:Alex.Zhang import os import requests import json import base64 #首先配置必要的信息 baidu_server = 'https://aip.baidubce.com/oauth/2.0/token?' grant_type = 'client_credentials' client_id = 'umuduD7RyyO7OIsAGWHyuZeG' #API KEY client_secret = 'ay0ih0NhwAInGCgIdpmbvSG9nbl0KEw3' #Secret KEY #合成请求token的url url = baidu_server+'grant_type='+grant_type+'&client_id='+client_id+'&client_secret='+client_secret #获取token res = requests.get(url).text data = json.loads(res) token = data['access_token'] #设置音频的属性,采样率,格式等 VOICE_RATE = 16000 FILE_NAME = '666.wav' USER_ID = 'Xu.zh' #这里的id随便填填就好啦

将xml文件转为txt文件

不打扰是莪最后的温柔 提交于 2019-12-02 02:52:55
import os import re import sys import glob import xml.etree.ElementTree as ET def xml_to_txt(indir,outdir): os.chdir(indir) annotations = os.listdir('.') annotations = glob.glob(str(annotations)+'*.xml') pat = re.compile('(?<=\>).*?(?=\<)') for i, file in enumerate(annotations): file_save = file.split('.')[0]+'.txt' file_txt=os.path.join(outdir,file_save) f_w = open(file_txt,'w',encoding="utf-8") tree=ET.parse(file) root = tree.getroot() for obj in root.iter('PostItem'): current = list() for ele in obj.iter(): if "content" in ele.tag: content = obj.find('content').text if content: content = re

【学习】CSS中width:100% 、 width:auto、width:80%、width:100rpx的区别

穿精又带淫゛_ 提交于 2019-12-01 23:39:51
学习参考: https://blog.csdn.net/Mr_Tony/article/details/97790079 https://blog.csdn.net/m0_38102188/article/details/80611615 https://blog.csdn.net/Great_Eagle/article/details/81130222 (结论来源,最全面的图解) 1.W3C盒模型(标准盒模型)和IE盒模型(怪异盒模型): W3C标准盒模型: 用户设置的 width和height仅仅指content area的宽高 IE怪异盒模型: 用户设置的 with和height包含了content area + padding area + border area三部分 注意:这两种设置with 和 height时候 都不包括margin!!!! 在CSS3中可以分别通过box-sizing:content-box设置成W3C标准和模型,通过 box-sizing:border-box 设置成IE怪异盒模型 所以,两种不同模式下的宽高计算规则如下: W3C标准盒模型的元素宽高计算: W3C element witdth = with + padding + border + margin W3C element height = height + padding +

spring cloud 集成rabbitMQ实现延时队列

佐手、 提交于 2019-12-01 23:00:27
假如环境已经配置好,现在我们有这么个需求,我们把消息发给消息队列后,并不希望马上消费这个消息,而是想等一段时间再让他消费,直接上代码吧: mq配置文件:定义一些队列名称配置 @Configuration public class QueueConfiguration { //信道配置 @Bean public DirectExchange defaultExchange() { return new DirectExchange(MQConstant.DEFAULT_EXCHANGE, true, false); } @Bean public Queue repeatTradeQueue() { Queue queue = new Queue(MQConstant.DEFAULT_REPEAT_TRADE_QUEUE_NAME,true,false,false); return queue; } @Bean public Binding drepeatTradeBinding() { return BindingBuilder.bind(repeatTradeQueue()).to(defaultExchange()).with(MQConstant.DEFAULT_REPEAT_TRADE_QUEUE_NAME); } @Bean public Queue

EncryptHelper加密对象-工具类

匆匆过客 提交于 2019-12-01 22:21:47
using System; using System.IO; using System.Security.Cryptography; using System.Text; using System.Web.Security; namespace Common.Utility { /// <summary> /// Author:Kt /// Date Created:2011-04-01 /// Description:加密对象-工具类 /// </summary> public class EncryptHelper { /// <summary> /// AES 解密 /// </summary> /// <param name="content">内容</param> /// <param name="secretKey">私钥(长度: 16、24、32字节)</param> /// <returns></returns> public static string AESDecrypt(string content, string secretKey) { if (string.IsNullOrEmpty(content)) return null; Byte[] toEncryptArray = Convert.FromBase64String(content);

开源中国maven库镜像

耗尽温柔 提交于 2019-12-01 22:14:33
最近时间段在弄maven的项目,发现在下载插件或依赖包时总是超时,经检查发现为连接国外网站时网速特慢,于是想找一个国内的镜像。经过谷歌之后发现了开源中国的镜像,速度还不错,于是记录下来,作为备忘。参考配置示例如下: Xml代码 <mirrors> <mirror> <id>nexus-osc</id> <mirrorOf>central</mirrorOf> <name>Nexus osc</name> <url>http://maven.oschina.net/content/groups/public/</url> </mirror> <mirror> <id>nexus-osc-thirdparty</id> <mirrorOf>thirdparty</mirrorOf> <name>Nexus osc thirdparty</name> <url>http://maven.oschina.net/content/repositories/thirdparty/</url> </mirror> </mirrors> Xml代码 <profiles> <profile> <id>jdk-1.4</id> <activation> <jdk>1.4</jdk> </activation> <repositories> <repository> <id>nexus</id>

SVM官方教程:SVR 简易教程

谁说胖子不能爱 提交于 2019-12-01 20:29:19
SVR: 简易使用教程 */ /*--> */ */ /*--> */ */ /*--> */ */ /*--> */ SVR 简易教程 ¶ In [1]: import numpy as np from sklearn.svm import SVR import matplotlib.pyplot as plt 构造数据 ¶ In [2]: # Generate sample data X = np.sort(5 * np.random.rand(40, 1), axis=0) y = np.sin(X).ravel() In [3]: # Add noise to targets y[::5] += 3 * (0.5 - np.random.rand(8)) 选择核函数 ¶ In [4]: svr_rbf = SVR(kernel='rbf', C=100, gamma=0.1, epsilon=.1) svr_lin = SVR(kernel='linear', C=100, gamma='auto') svr_poly = SVR(kernel='poly', C=100, gamma='auto', degree=3, epsilon=.1, coef0=1) 技巧:绘图 $linewidths$ 的简易写法 $lw $,这我以前还不知道。 In [11]: lw = 2

vue+ele爬坑之路(三)—vue-amap

家住魔仙堡 提交于 2019-12-01 20:11:56
地图几乎是很多项目中不可或缺的一部分,这里介绍下在vue+element中vue-map的使用。 1、安装 npm install vue-amap --save 2、配置 全局配置,在 main.js 中配置,代码如下: import VueAMap from 'vue-amap'; Vue.use(VueAMap); //初始化 VueAMap.initAMapApiLoader({ key: 'your key', plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],//依赖配置,根据自己的需求引入 // 默认高德 sdk 版本为 1.4.4 v: '1.4.4' }); 3、使用 3-1、只显示地图及中心点定位 <template> <div class="content"> <div class="amap-wrapper"> <el-amap class="amap-box" :zoom="zoom" :center="center" :mapStyle="mapStyle"></el-amap> </div> <

JavaScript-获取元素宽高

两盒软妹~` 提交于 2019-12-01 16:42:12
获取元素宽高 getComputedStyle 注意: 读取的范围是 content 的值 既能读取行内,也可以读取 css 设置的样式 只可以读取,不可以设置 只支持 IE9 及以上的高级浏览器 geyComputedStyle(oDiv).width getComputedStyle(oDiv).height currentStyle 读取的范围是 content 的值 既能读取行内,也可以读取 css 设置的样式 只可以读取,不可以设置 只支持 IE9 以下的低级浏览器 oDiv.currentStyle.width oDiv.currentStyle.height style 读取的范围是 content 的值 只能读取行内,不能读取 css 设置的样式 即可以读取,也可以设置 高级低级浏览器都支持 oDiv.style.width oDiv.style.height offsetWidth / offsetHeight 读取的范围是 content + padding + border 的值 既可以读取行内,也可以读取 css 设置的样式 只可以读取,不可以设置 高级低级浏览器都支持 oDiv.offsetWidth oDiv.offsetHeight client clientWidth / clientHeight 获取到的宽高是 content + padding

java实现富文本过滤标签

只谈情不闲聊 提交于 2019-12-01 11:47:09
1、pom.xml引入相关jar <dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.12.1</version></dependency> 2、java代码使用 // 标签过滤String content = "待处理富文本内容"; Document document = Jsoup.parse(content); content = document.text();// 截取前100位 Integer contentLength = content.length(); content = content.substring(0, contentLength >= 100 ? 100 : contentLength); 来源: https://www.cnblogs.com/gaoqiao/p/11683876.html