cedict | Golang package for the community | Dictionary library
kandi X-RAY | cedict Summary
kandi X-RAY | cedict Summary
Golang library for the community maintained Chinese-English dictionary (CC-CEDICT), published by MDBG.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Parse parses a config file .
- PinyinTones converts a string to a text .
- Save writes the dict to file .
- levenshtein returns the distance between src and dst .
- Load loads a dictionary from file .
- Search for a dictionary
- Download downloads and returns gzipped content .
- PinyinToneNums converts a text into a text .
- FixSymbolSpaces replaces spaces with spaces
- ConvertSymbols converts a string to a string
cedict Key Features
cedict Examples and Code Snippets
Community Discussions
Trending Discussions on cedict
QUESTION
Is there a programmatic way to identify the tones in Chinese text?
For an input string like 苹果
I need to extract the tones as 2
and 3
as it would be indicated in the pinyin transliteration píng guǒ
or ping2 guo3
.
I guess a possible workaround would be converting Chinese hanzi text to pinyin (e.g. with pinyin4j) and then extract the tones from pinyin, but I assume there must be a better and direct way to do it.
ContextThe question is about if there is some algorithmic way to identify the tones or if the only way is a map lookup against an authoritative source e.g. the publicly available CEDICT database.
...ANSWER
Answered 2020-Sep-19 at 13:18I'm a native speaker, and I doubt that it's possible. Chinese character can have multiple tones depending on the context. The only reliable way to do this is to call some APIs with the full context.
Since you can't be sure what tone the character is just by judging it individually, there's no such "algorithm" to map them to their tones.
For instance, "一" can be tone 1, 2, 4, or neutral depending on the context.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cedict
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page