/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sina.CreAmazing.voice;
import android.text.TextUtils;
import android.util.Log;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Locale;
/**
* An object to convert Chinese character to its corresponding pinyin string.
* For characters with multiple possible pinyin string, only one is selected
* according to collator. Polyphone is not supported in this implementation.
* This class is implemented to achieve the best runtime performance and minimum
* runtime resources with tolerable sacrifice of accuracy. This implementation
* highly depends on zh_CN ICU collation data and must be always synchronized
* with ICU.
*
* Currently this file is aligned to zh.txt in ICU 4.6 来自android4.2源码
*/
public class HanziToPinyin {
private static final String TAG = "HanziToPinyin";
// Turn on this flag when we want to check internal data structure.
private static final boolean DEBUG = false;
/**
* Unihans array.
*
* Each unihans is the first one within same pinyin when collator is zh_CN.
*/
public static final char[] UNIHANS = { '\u963f', '\u54ce', '\u5b89',
'\u80ae', '\u51f9', '\u516b', '\u6300', '\u6273', '\u90a6',
'\u52f9', '\u9642', '\u5954', '\u4f3b', '\u5c44', '\u8fb9',
'\u706c', '\u618b', '\u6c43', '\u51ab', '\u7676', '\u5cec',
'\u5693', '\u5072', '\u53c2', '\u4ed3', '\u64a1', '\u518a',
'\u5d7e', '\u66fd', '\u66fe', '\u5c64', '\u53c9', '\u8286',
'\u8fbf', '\u4f25', '\u6284', '\u8f66', '\u62bb', '\u6c88',
'\u6c89', '\u9637', '\u5403', '\u5145', '\u62bd', '\u51fa',
'\u6b3b', '\u63e3', '\u5ddb', '\u5205', '\u5439', '\u65fe',
'\u9034', '\u5472', '\u5306', '\u51d1', '\u7c97', '\u6c46',
'\u5d14', '\u90a8', '\u6413', '\u5491', '\u5446', '\u4e39',
'\u5f53', '\u5200', '\u561a', '\u6265', '\u706f', '\u6c10',
'\u55f2', '\u7538', '\u5201', '\u7239', '\u4e01', '\u4e1f',
'\u4e1c', '\u543a', '\u53be', '\u8011', '\u8968', '\u5428',
'\u591a', '\u59b8', '\u8bf6', '\u5940', '\u97a5', '\u513f',
'\u53d1', '\u5e06', '\u531a', '\u98de', '\u5206', '\u4e30',
'\u8985', '\u4ecf', '\u7d11', '\u4f15', '\u65ee', '\u4f85',
'\u7518', '\u5188', '\u768b', '\u6208', '\u7ed9', '\u6839',
'\u522f', '\u5de5', '\u52fe', '\u4f30', '\u74dc', '\u4e56',
'\u5173', '\u5149', '\u5f52', '\u4e28', '\u5459', '\u54c8',
'\u548d', '\u4f44', '\u592f', '\u8320', '\u8bc3', '\u9ed2',
'\u62eb', '\u4ea8', '\u5677', '\u53ff', '\u9f41', '\u4e6f',
'\u82b1', '\u6000', '\u72bf', '\u5ddf', '\u7070', '\u660f',
'\u5419', '\u4e0c', '\u52a0', '\u620b', '\u6c5f', '\u827d',
'\u9636', '\u5dfe', '\u5755', '\u5182', '\u4e29', '\u51e5',
'\u59e2', '\u5658', '\u519b', '\u5494', '\u5f00', '\u520a',
'\u5ffc', '\u5c3b', '\u533c', '\u808e', '\u52a5', '\u7a7a',
'\u62a0', '\u625d', '\u5938', '\u84af', '\u5bbd', '\u5321',
'\u4e8f', '\u5764', '\u6269', '\u5783', '\u6765', '\u5170',
'\u5577', '\u635e', '\u808b', '\u52d2', '\u5d1a', '\u5215',
'\u4fe9', '\u5941', '\u826f', '\u64a9', '\u5217', '\u62ce',
'\u5222', '\u6e9c', '\u56d6', '\u9f99', '\u779c', '\u565c',
'\u5a08', '\u7567', '\u62a1', '\u7f57', '\u5463', '\u5988',
'\u57cb', '\u5ada', '\u7264', '\u732b', '\u4e48', '\u5445',
'\u95e8', '\u753f', '\u54aa', '\u5b80', '\u55b5', '\u4e5c',
'\u6c11', '\u540d', '\u8c2c', '\u6478', '\u54de', '\u6bea',
'\u55ef', '\u62cf', '\u8149', '\u56e1', '\u56d4', '\u5b6c',
'\u7592', '\u5a1e', '\u6041', '\u80fd', '\u59ae', '\u62c8',
'\u5b22', '\u9e1f', '\u634f', '\u56dc', '\u5b81', '\u599e',
'\u519c', '\u7fba', '\u5974', '\u597b', '\u759f', '\u9ec1',
'\u90cd', '\u5594', '\u8bb4', '\u5991', '\u62cd', '\u7705',
'\u4e53', '\u629b', '\u5478', '\u55b7', '\u5309', '\u4e15',
'\u56e8', '\u527d', '\u6c15', '\u59d8', '\u4e52', '\u948b',
'\u5256', '\u4ec6', '\u4e03', '\u6390', '\u5343', '\u545b',
'\u6084', '\u767f', '\u4eb2', '\u72c5', '\u828e', '\u4e18',
'\u533a', '\u5cd1', '\u7f3a', '\u590b', '\u5465', '\u7a63',
'\u5a06', '\u60f9', '\u4eba', '\u6254', '\u65e5', '\u8338',
'\u53b9', '\u909a', '\u633c', '\u5827', '\u5a51', '\u77a4',
'\u637c', '\u4ee8', '\u6be2', '\u4e09', '\u6852', '\u63bb',
'\u95aa', '\u68ee', '\u50e7', '\u6740', '\u7b5b', '\u5c71',
'\u4f24', '\u5f30', '\u5962', '\u7533', '\u8398', '\u6552',
'\u5347', '\u5c38', '\u53ce', '\u4e66', '\u5237', '\u8870',
'\u95e9', '\u53cc', '\u8c01', '\u542e', '\u8bf4', '\u53b6',
'\u5fea', '\u635c', '\u82cf', '\u72fb', '\u590a', '\u5b59',
'\u5506', '\u4ed6', '\u56fc', '\u574d', '\u6c64', '\u5932',
'\u5fd1', '\u71a5', '\u5254', '\u5929', '\u65eb', '\u5e16',
'\u5385', '\u56f2', '\u5077', '\u51f8', '\u6e4d', '\u63a8',
'\u541e', '\u4e47', '\u7a75', '\u6b6a', '\u5f2f', '\u5c23',
'\u5371', '\u6637', '\u7fc1', '\u631d', '\u4e4c', '\u5915',
'\u8672', '\u4eda', '\u4e61', '\u7071', '\u4e9b', '\u5fc3',
'\u661f', '\u51f6', '\u4f11', '\u5401', '\u5405', '\u524a',
'\u5743', '\u4e2b', '\u6079', '\u592e', '\u5e7a', '\u503b',
'\u4e00', '\u56d9', '\u5e94', '\u54df', '\u4f63', '\u4f18',
'\u625c', '\u56e6', '\u66f0', '\u6655', '\u7b60', '\u7b7c',
'\u5e00', '\u707d', '\u5142', '\u5328', '\u50ae', '\u5219',
'\u8d3c', '\u600e', '\u5897', '\u624e', '\u635a', '\u6cbe',
'\u5f20', '\u957f', '\u9577', '\u4f4b', '\u8707', '\u8d1e',
'\u4e89', '\u4e4b', '\u5cd9', '\u5ea2', '\u4e2d', '\u5dde',
'\u6731', '\u6293', '\u62fd', '\u4e13', '\u5986', '\u96b9',
'\u5b92', '\u5353', '\u4e72', '\u5b97', '\u90b9', '\u79df',
'\u94bb', '\u539c', '\u5c0a', '\u6628', '\u5159', '\u9fc3',
'\u9fc4', };
/**
* Pinyin array.
*
* Each pinyin is corresponding to unihans of same offset in the unihans
* array.
*/
public static final byte[][] PINYINS = { { 65, 0, 0, 0, 0, 0 },
{ 65, 73, 0, 0, 0, 0 }, { 65, 78, 0, 0, 0, 0 },
{ 65, 78, 71, 0, 0, 0 }, { 65, 79, 0, 0, 0, 0 },
{ 66, 65, 0, 0, 0, 0 }, { 66, 65, 73, 0, 0, 0 },
{ 66, 65, 78, 0, 0, 0 }, { 66, 65, 78, 71, 0, 0 },
{ 66, 65, 79, 0, 0, 0 }, { 66, 69, 73, 0, 0, 0 },
{ 66, 69, 78, 0, 0, 0 }, { 66, 69, 78, 71, 0, 0 },
{ 66, 73, 0, 0, 0, 0 }, { 66, 73, 65, 78, 0, 0 },
{ 66, 73, 65, 79, 0, 0 }, { 66, 73, 69, 0, 0, 0 },
{ 66, 73, 78, 0, 0, 0 }, { 66, 73, 78, 71, 0, 0 },
{ 66, 79, 0, 0, 0, 0 }, { 66, 85, 0, 0, 0, 0 },
{ 67, 65, 0, 0, 0, 0 }, { 67, 65, 73, 0, 0, 0 },
{ 67, 65, 78, 0, 0, 0 }, { 67, 65, 78, 71, 0, 0 },
{ 67, 65, 79, 0, 0, 0 }, { 67, 69, 0, 0, 0, 0 },
{ 67, 69, 78,
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一个语音识别模糊匹配的demo,主要工作流程如下: 1,将目标字符集转换为拼音; 2,获取科大讯飞语音识别的结果; 3,将识别结果转换为拼音; 4,在目标拼音集中进行拼音的匹配查找; 5,对于查找不到的,进行易混拼音的替换,再次与目标集合匹配查找; 6,对于还没有查找到的,去掉音调,再次与目标集合匹配查找; 7,将模糊匹配后的结果展现出来;
资源推荐
资源详情
资源评论
收起资源包目录
VoiceContral-ok.rar (58个子文件)
VoiceContral
.project 848B
project.properties 361B
proguard.cfg 1KB
src
sina
CreAmazing
voice
PinyinSimilarity.java 15KB
HanziToPinyin.java 28KB
ClassesAdapter.java 2KB
ClassesInfo.java 615B
LogUtil.java 2KB
Voice1Activity.java 10KB
AndroidManifest.xml 1KB
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.jpg 13KB
ic_launcher3.png 73KB
add.png 4KB
Thumbs.db 24KB
ic_launcher1.png 4KB
drawable-mdpi
ic_launcher.png 3KB
layout
classlistitems.xml 2KB
main.xml 4KB
drawable-xhdpi
values
strings.xml 203B
.settings
org.eclipse.jdt.core.prefs 177B
org.eclipse.core.resources.prefs 51B
assets
gen
sina
CreAmazing
voice
BuildConfig.java 163B
R.java 1KB
libs
armeabi-v7a
libmsc.so 579KB
Msc.jar 430KB
pinyin4j-2.5.0.jar 184KB
x86
libmsc.so 651KB
armeabi
libmsc.so 598KB
.classpath 526B
bin
resources.ap_ 101KB
classes
sina
CreAmazing
voice
R$layout.class 441B
BuildConfig.class 351B
R$drawable.class 515B
R$attr.class 349B
HanziToPinyin.class 20KB
ClassesAdapter.class 3KB
Voice1Activity$2.class 2KB
Voice1Activity$1.class 2KB
R$id.class 734B
LogUtil.class 3KB
ClassesAdapter$ViewHolder.class 602B
R.class 552B
R$string.class 436B
PinyinSimilarity.class 10KB
ClassesInfo.class 786B
Voice1Activity.class 7KB
HanziToPinyin$Token.class 814B
AndroidManifest.xml 1KB
dexedLibs
Msc-32898bbafd822e6c650260755e461393.jar 348KB
pinyin4j-2.5.0-5c7d5c3987c2a369ebfce1f0bae8b70c.jar 141KB
res
crunch
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher3.png 73KB
add.png 1KB
ic_launcher1.png 4KB
drawable-mdpi
ic_launcher.png 2KB
VoiceContral.apk 1.46MB
classes.dex 377KB
共 58 条
- 1
lintax
- 粉丝: 295
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Vue+NodeJS的学生社团管理系统(前后端代码)
- 基于SSM+JSP的快递管理系统(前后端代码)
- 全球火点数据-modis-2015-2023年
- YOLOv8完整网络结构图详细visio
- LCD1602电子时钟程序
- 西北太平洋热带气旋【灾害风险统计】及【登陆我国次数评估】数据集-1980-2023
- 全球干旱数据集【自校准帕尔默干旱程度指数scPDSI】-190101-202312-0.5x0.5
- 基于Python实现的VAE(变分自编码器)训练算法源代码+使用说明
- 全球干旱数据集【标准化降水蒸发指数SPEI-12】-190101-202312-0.5x0.5
- C语言小游戏-五子棋-详细代码可运行
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页