Comments (2)
@bcaller Thanks for using zhon!
This is actually the intended behavior of the syllable constants. The syllables returned above are all valid Pinyin syllables (fo
, o
, ba
, and r
). You can see all of these syllables in a dictionary such as mdbg.net.
If you are trying to find Pinyin text amidst English, you should use the word constants (i.e. zhon.pinyin.accented_word
, zhon.pinyin.numbered_word
, and zhon.pinyin.word
). They respect word boundaries and should be able to work within English text (as long as the English words aren't also valid Pinyin words)
from zhon.
My problem was that many English words such as 'are' are valid. Never mind, I found a better way using a slightly less precise regex. Nice library by the way. I realise now that your original use case was probably more for text that you know is definitely pinyin but you want to type it with numbers and get accents.
from zhon.
Related Issues (20)
- Add logging to build_string
- README.rst zhon.pinyin.RE_NUMBER typo
- Make zhon not import zhon.* modules in __init__.py
- pinyin pattern objects should not match non-pinyin character (e.g. numbers/punctuation)
- README typo
- Pinyin words should not include numbers
- Pinyin regular expressions don't support Latin alpha for a HOT 1
- Ideographic number zero HOT 1
- 'r' suffix bug
- 《 · 〈 〉﹑ ﹔ not in punctuation list of hanzi HOT 2
- why I run re.findall('[%s]' % zhon.hanzi.characters, 'I broke a plate: 我打破了一个盘子.'), I got an empty [] HOT 4
- Wrong zhuyin to pinyin for syllables ending with ㄨ HOT 2
- Pinyin.syllable truncates 'beì' (accented_syllable, and word) HOT 4
- zhon being used in practice HOT 1
- AttributeError: module 'zhon' has no attribute 'hanzi' HOT 1
- zhon.pinyin.syl assumes non-combining diacritics
- Why missing \uFF0E?
- AttributeError: module 'zhon' has no attribute 'hanzi' HOT 4
- `DeprecationWarning: invalid escape sequence` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zhon.