PinyinTest | 对Pinyin4j、TinyPinyin及JPinyin三个汉字转拼音库通过简单的测试代码进行比较
kandi X-RAY | PinyinTest Summary
kandi X-RAY | PinyinTest Summary
PinyinTest is a Java library. PinyinTest has no bugs, it has no vulnerabilities, it has build file available and it has low support. You can download it from GitHub.
1、TinyPinyin——build.gradle: compile 'com.github.promeg:tinypinyin:2.0.3' compile 'com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3' Java代码: fun tinypinyin(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) for (c in content) { stringBuilder.append(Pinyin.toPinyin(c)) } val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "tinypinyin time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "tinypinyin content: " + stringBuilder.toString().toLowerCase()) } 方法Pinyin.toPinyin(c),如果是汉字,则返回对应的拼音;否则返回原字符。. 2、Pinyin4j——build.gradle: compile 'com.belerweb:pinyin4j:2.5.0' Java代码: fun pinyin4j(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) val hanyuPinyinOutputFormat = HanyuPinyinOutputFormat() hanyuPinyinOutputFormat.toneType = HanyuPinyinToneType.WITHOUT_TONE try { for (c in content) { val result = PinyinHelper.toHanyuPinyinStringArray(c, hanyuPinyinOutputFormat) if (result != null) { stringBuilder.append(result[0]) } else { stringBuilder.append(c) } } } catch (badHanyuPinyinOutputFormatCombination: BadHanyuPinyinOutputFormatCombination) { badHanyuPinyinOutputFormatCombination.printStackTrace() } val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "pinyin4j time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "pinyin4j content: " + stringBuilder.toString().toLowerCase()) } 方法PinyinHelper.toHanyuPinyinStringArray(c, hanyuPinyinOutputFormat),如果是汉字,result[0]就是转换的结果;否则result为null,取原字符c。. 3、JPinyin—— 以Pinyin4j作为基础做了一些改进。CCCCCCCCCCCCCCCCCCCCCCCCCC build.gradle: compile 'com.github.stuxuhai:jpinyin:1.1.8' Java代码: fun jpinyin(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) stringBuilder.append(PinyinHelper.convertToPinyinString(content, "", PinyinFormat.WITHOUT_TONE)) val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "jpinyin time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "jpinyin content: " + stringBuilder.toString().toLowerCase()) } 方法PinyinHelper.convertToPinyinString(content, "", PinyinFormat.WITHOUT_TONE),将整个字串一起转换成拼音,第二个参数为各个字符转换结果的分隔符,这里为空字串。.
1、TinyPinyin——build.gradle: compile 'com.github.promeg:tinypinyin:2.0.3' compile 'com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3' Java代码: fun tinypinyin(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) for (c in content) { stringBuilder.append(Pinyin.toPinyin(c)) } val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "tinypinyin time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "tinypinyin content: " + stringBuilder.toString().toLowerCase()) } 方法Pinyin.toPinyin(c),如果是汉字,则返回对应的拼音;否则返回原字符。. 2、Pinyin4j——build.gradle: compile 'com.belerweb:pinyin4j:2.5.0' Java代码: fun pinyin4j(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) val hanyuPinyinOutputFormat = HanyuPinyinOutputFormat() hanyuPinyinOutputFormat.toneType = HanyuPinyinToneType.WITHOUT_TONE try { for (c in content) { val result = PinyinHelper.toHanyuPinyinStringArray(c, hanyuPinyinOutputFormat) if (result != null) { stringBuilder.append(result[0]) } else { stringBuilder.append(c) } } } catch (badHanyuPinyinOutputFormatCombination: BadHanyuPinyinOutputFormatCombination) { badHanyuPinyinOutputFormatCombination.printStackTrace() } val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "pinyin4j time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "pinyin4j content: " + stringBuilder.toString().toLowerCase()) } 方法PinyinHelper.toHanyuPinyinStringArray(c, hanyuPinyinOutputFormat),如果是汉字,result[0]就是转换的结果;否则result为null,取原字符c。. 3、JPinyin—— 以Pinyin4j作为基础做了一些改进。CCCCCCCCCCCCCCCCCCCCCCCCCC build.gradle: compile 'com.github.stuxuhai:jpinyin:1.1.8' Java代码: fun jpinyin(content: String) { val start_time: Long = System.currentTimeMillis() val stringBuilder = StringBuilder() stringBuilder.setLength(0) stringBuilder.append(PinyinHelper.convertToPinyinString(content, "", PinyinFormat.WITHOUT_TONE)) val end_time: Long = System.currentTimeMillis() Log.i("pinyintest", "jpinyin time: " + + (end_time - start_time) + "ms") Log.i("pinyintest", "jpinyin content: " + stringBuilder.toString().toLowerCase()) } 方法PinyinHelper.convertToPinyinString(content, "", PinyinFormat.WITHOUT_TONE),将整个字串一起转换成拼音,第二个参数为各个字符转换结果的分隔符,这里为空字串。.
Support
Quality
Security
License
Reuse
Support
PinyinTest has a low active ecosystem.
It has 2 star(s) with 0 fork(s). There are 2 watchers for this library.
It had no major release in the last 6 months.
PinyinTest has no issues reported. There are no pull requests.
It has a neutral sentiment in the developer community.
The latest version of PinyinTest is current.
Quality
PinyinTest has no bugs reported.
Security
PinyinTest has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
License
PinyinTest does not have a standard license declared.
Check the repository for any license declaration and review the terms closely.
Without a license, all rights are reserved, and you cannot use the library in your applications.
Reuse
PinyinTest releases are not available. You will need to build from source code and install.
Build file is available. You can build the component from source.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PinyinTest
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PinyinTest
PinyinTest Key Features
No Key Features are available at this moment for PinyinTest.
PinyinTest Examples and Code Snippets
No Code Snippets are available at this moment for PinyinTest.
Community Discussions
No Community Discussions are available at this moment for PinyinTest.Refer to stack overflow page for discussions.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PinyinTest
You can download it from GitHub.
You can use PinyinTest like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PinyinTest component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
You can use PinyinTest like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PinyinTest component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
For any new features, suggestions and bugs create an issue on GitHub.
If you have any questions check and ask questions on community page Stack Overflow .
Find more information at:
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