【修改语音识别字符匹配结束位置索引】
This commit is contained in:
parent
83c5d6e644
commit
f38c3bd1ba
@ -122,16 +122,16 @@ public class VoiceDiscriminateResult {
|
||||
String pinYin = null;
|
||||
for (int i = 0, len = contentPinYinArr.length; i < len; i ++) {
|
||||
pinYin = contentPinYinArr[i];
|
||||
if (Objects.equals(group.substring(readIndex, readIndex + pinYin.length()), pinYin)) {
|
||||
if (readIndex == 0) {
|
||||
if (Objects.equals(group.substring(readIndex, readIndex + pinYin.length()), pinYin)) { // 字符一致
|
||||
if (readIndex == 0) { // 如果是0代表刚开始匹配,记录开始索引
|
||||
indexArr[0] = i;
|
||||
}
|
||||
readIndex = readIndex + pinYin.length();
|
||||
} else {
|
||||
} else { // 字符不一致,重新匹配位置
|
||||
readIndex = 0;
|
||||
}
|
||||
if (readIndex == group.length()) { // 结束位置
|
||||
indexArr[1] = i + 1;
|
||||
indexArr[1] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user