fix: 语音识别拼音

This commit is contained in:
靳耀伟 2024-11-01 14:11:04 +08:00
parent 3d55fca864
commit c8aaa1e31a
13 changed files with 62 additions and 18 deletions

View File

@ -12,6 +12,9 @@
<script src="./js/voice.js"></script>
<script src="./js/crypto-js.min.js"></script>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
<!-- 文字转拼音 -->
<script src="./js/pinyin.js"></script>
<script src="js/w_md5.js"></script>
<!-- 构建界面 -->
@ -87,6 +90,8 @@
var Question = '';
var Subtitles = '';
let { pinyin } = pinyinPro;
function getURLParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -330,7 +335,6 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(new Date().getTime(), 1)
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
@ -758,6 +762,7 @@
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
return bloodLiquidData.some(element => query.includes(element))
@ -778,6 +783,11 @@
dataKey: key,
date: formattedDate
};
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
return {
dataKey: 'bloodOxygen',
date: formattedDate
};
}
}

1
hybrid/html/js/pinyin.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,9 @@
<script src="./js/voice.js"></script>
<script src="./js/crypto-js.min.js"></script>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
<!-- 文字转拼音 -->
<script src="./js/pinyin.js"></script>
<script src="js/w_md5.js"></script>
<!-- 构建界面 -->
@ -87,6 +90,8 @@
var Question = '';
var Subtitles = '';
let { pinyin } = pinyinPro;
function getURLParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -330,7 +335,6 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(new Date().getTime(), 1)
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
@ -758,6 +762,7 @@
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
return bloodLiquidData.some(element => query.includes(element))
@ -778,6 +783,11 @@
dataKey: key,
date: formattedDate
};
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
return {
dataKey: 'bloodOxygen',
date: formattedDate
};
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,9 @@
<script src="./js/voice.js"></script>
<script src="./js/crypto-js.min.js"></script>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
<!-- 文字转拼音 -->
<script src="./js/pinyin.js"></script>
<script src="js/w_md5.js"></script>
<!-- 构建界面 -->
@ -87,6 +90,8 @@
var Question = '';
var Subtitles = '';
let { pinyin } = pinyinPro;
function getURLParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -330,7 +335,6 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(new Date().getTime(), 1)
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
@ -758,6 +762,7 @@
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
return bloodLiquidData.some(element => query.includes(element))
@ -778,6 +783,11 @@
dataKey: key,
date: formattedDate
};
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
return {
dataKey: 'bloodOxygen',
date: formattedDate
};
}
}

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,9 @@
<script src="./js/voice.js"></script>
<script src="./js/crypto-js.min.js"></script>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
<!-- 文字转拼音 -->
<script src="./js/pinyin.js"></script>
<script src="js/w_md5.js"></script>
<!-- 构建界面 -->
@ -87,6 +90,8 @@
var Question = '';
var Subtitles = '';
let { pinyin } = pinyinPro;
function getURLParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -330,7 +335,6 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(new Date().getTime(), 1)
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
@ -758,6 +762,7 @@
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
return bloodLiquidData.some(element => query.includes(element))
@ -778,6 +783,11 @@
dataKey: key,
date: formattedDate
};
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
return {
dataKey: 'bloodOxygen',
date: formattedDate
};
}
}

File diff suppressed because one or more lines are too long