Speech Module
Speech Module
1 FIRST_TEN = ["one", "two", "three", "four", "five", "six", "seven",
2 "eight", "nine"]
3 SECOND_TEN = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
4 "sixteen", "seventeen", "eighteen", "nineteen"]
5 OTHER_TENS = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy",
6 "eighty", "ninety"]
7 HUNDRED = "hundred"
8
9
10 def checkio(number):
11 spoken = []
12
13 hundred_bit = number / 100
14
15 if hundred_bit > 0:
16 spoken.append(FIRST_TEN[hundred_bit - 1])
17 spoken.append(HUNDRED)
18
19 remain = number % 100
20
21 if remain >= 10 and remain <= 19:
22 spoken.append(SECOND_TEN[remain % 10])
23 else:
24 decade = remain / 10
25 if decade > 0:
26 spoken.append(OTHER_TENS[decade - 2])
27
28 unit = remain % 10
29 if unit > 0:
30 spoken.append(FIRST_TEN[unit - 1])
31
32 return ' '.join(spoken)
python有个divmod函数, 即可返回商又可返回余数h, number
=
divmod
(number,
100
)
可以如此构造字符串
final_string
=
"%s%s%s"
%
(hundred_s, decade_s, unit_s)
使用strip去除字符,lstrip, rstrip; rstrip()去除右边空格
Speech Module的更多相关文章
- Check iO:初学Python
The end of other For language training our Robots want to learn about suffixes. In this task, you ar ...
- [官网]Windows modules
Windows modules https://docs.ansible.com/ansible/latest/modules/list_of_windows_modules.html win_acl ...
- 百度语音+react+loopback实现语音合成返回播放
1.在百度语音中创建自己的项目,需要拿到APP_ID.API_KEY.SECRET_KEY. 2.loopback端提供接口服务,在./boot目录下新建root.js文件,编写不依赖模型的自定义接口 ...
- 【Python CheckiO 题解】SP
题目描述 [Speech Module]:输入一个数字,将其转换成英文表达形式,字符串中的所有单词必须以一个空格字符分隔. [输入]:一个数字(int) [输出]:代表数字的英文字符串(str) [前 ...
- Understanding C++ Modules In C++20 (1)
Compiling evironment: linux (ubuntu 16.04)+ gcc-10.2. The Post will clarify and discuss what modules ...
- 自然语言15_Part of Speech Tagging with NLTK
https://www.pythonprogramming.net/part-of-speech-tagging-nltk-tutorial/?completed=/stemming-nltk-tut ...
- Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System :: Major Project ::: Introduction
转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2010/12/text-prompted-remote-speaker.html Biometrics ...
- 论文翻译:2020_A Recursive Network with Dynamic Attention for Monaural Speech Enhancement
论文地址:基于动态注意的递归网络单耳语音增强 论文代码:https://github.com/Andong-Li-speech/DARCN 引用格式:Li, A., Zheng, C., Fan, C ...
- 论文翻译:2022_PACDNN: A phase-aware composite deep neural network for speech enhancement
论文地址:PACDNN:一种用于语音增强的相位感知复合深度神经网络 引用格式:Hasannezhad M,Yu H,Zhu W P,et al. PACDNN: A phase-aware compo ...
随机推荐
- jquery点击按钮显示和隐藏DIv
function changeDisplay() { if ($("#btnShow").attr("value")== "添加附件") { ...
- vue-cli 脚手架总结
> vue-cli 的脚手架项目模板有browserify 和 webpack , 现在自己在用的是webpack , 官网给出了两个模板: webpack-simple 和 webpack 两 ...
- kendo ui中grid页面参数问题
kendo ui 中grid 算是最长用的控件之一,当使用分页效果时,我们要传递分页参数与自己定义的参数如: var dataSource = new kendo.data.DataSource({ ...
- VB.NET中DataGridView控件
VB.NET中对于表格数据的显示经常使用到DataGridView控件,其以丰富多样的数据表呈现形式被程序猿喜爱. 本人在做一个小系统中运用DataGridView控件的部分属性,这些功能的使用在使用 ...
- nagios和zabbix自定义监控脚本
一. 自定义nagios监控脚本1. 在客户端上创建脚本/usr/local/nagios/libexec/check_disk.shvim /usr/local/nagios/libexec/ch ...
- 远程连接到Fedora
首先执行以下3点(主要是前两点) 第一: 开启ssh #service sshd restart 第二:关闭防火墙 #service iptables stop 第三:selinux(重启电脑后失效) ...
- document.write 向文档中写内容,包括文本、脚本、元素之类的,但是它在什么时候执行不会覆盖当前页面内容尼?
当你打开一个页面,浏览器会 调用 document.open() 打开文档 document.write(...) 将下载到的网页内容写入文档 所有内容写完了,就调用 document.close() ...
- oracle数据库连接
///宁采花 8:37:39 /// <summary> /// 获取数据链接 /// </summary> /// <returns></returns&g ...
- String new赋值、直接赋值
String类是final的.String str = new String("Hello"); //创建了两个对象系统会先创建一个匿名对象"Hello"存入堆 ...
- linux删除ORACLE【weber出品必属精品】
关闭数据库 sqlplus / as sysdba shutdown abort 清除oracle软件 su - oracle cd $ORACLE_BASE rm -rf * rm -rf /etc ...