open-speech / cn-text-normalizer Goto Github PK
View Code? Open in Web Editor NEWA python module that convert chinese written string to read string. 一个python包:将中文书面字符串转换为口语字符串。
License: MIT License
A python module that convert chinese written string to read string. 一个python包:将中文书面字符串转换为口语字符串。
License: MIT License
cn2num()
函数的compute_value()
中last_power的设计有些问题,导致只能实现一次当前单位大于之前单位,比如试验 一亿零二百三十二万零五百三十五 .
应该改为:
"""
Compute the value.
When current unit is larger than previous unit, current unit * all previous units will be used as all previous units.
e.g. '两千万' = 2000 * 10000 not 2000 + 10000
"""
value = [0]
last_power = 0
for s in integer_symbols:
if isinstance(s, CND):
value[-1] = s.value
elif isinstance(s, CNU):
value[-1] *= pow(10, s.power)
print(value)
if s.power > last_power:
for i in range(len(value)-2,-1,-1):
if value[i]<pow(10, s.power):
value[i]*=pow(10, s.power)
else:
break
last_power = s.power
value.append(0)
return sum(value)
感谢分享此项目。在windows 7平台下安装pip install cntn
遇到如下问题,请问应该如何解决呢?期待您的回复,谢谢。
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "E:\temp\pip-build-n859kqw7\cntn\setup.py", line 15, in <module>
long_description=read_readme(),
File "E:\temp\pip-build-n859kqw7\cntn\setup.py", line 7, in read_readme
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 85: illeg
al multibyte sequence
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.