Qt软键盘

发布于:2025-07-22 ⋅ 阅读:(17) ⋅ 点赞:(0)

Qt软键盘

完整代码

KeyBoard.qml

import QtQuick 2.0
import '../utils/PinYinToChinese.js' as PinYinToChinese
Rectangle {
    id:keyBoard
    width: parent.width
    //    height: 350
    //    height: PinYinToChinese.isEnglistAndChooseData(isEnglish,textBuffer)===true?400:350
    height: isEnglish ? 300 : (textBuffer === null ? 300 : 400)
    radius: 5
    property int leftRightMarign: 20
    property var top11EveryWidth: (keyBoard.width-50 - leftRightMarign) /11
    property var top10EveryWidth: (keyBoard.width-45 - leftRightMarign) /10
    property var top9EveryWidth: (keyBoard.width-40 - leftRightMarign) /9
    property var top8EveryWidth: (keyBoard.width-35 - leftRightMarign) /8
    property var top7EveryWidth: (keyBoard.width-30 - leftRightMarign) /7
    property var top5EveryWidth: (keyBoard.width-20 - leftRightMarign) /5

    property var isSmall: true
    property var isEnglish: true

    property Item targetInput // 外部传入的 TextInput 实例
    property color borderColor: '#DDDDDD'
    property color bgColor: '#FFFFFF'
    property color pressColor: "#EEEEEE"

    property color txtColor: '#333333'
    property var textSize: 20
    property var buttonHeight: 50
    property var borderRadius: 30

    property string textBuffer: ""  // 选中字母
    function insertTextToTarget(txt) {
        if(isEnglish){
            if (keyBoard.targetInput) {
                if (typeof keyBoard.targetInput.insert === "function") {
                    keyBoard.targetInput.insert(keyBoard.targetInput.cursorPosition, txt)
                } else if (keyBoard.targetInput.text !== undefined) {
                    keyBoard.targetInput.text += txt
                }
            }
        }else{
            if (!txt || txt.trim() === "") {
                if (keyBoard.targetInput) {
                    if (typeof keyBoard.targetInput.insert === "function") {
                        keyBoard.targetInput.insert(keyBoard.targetInput.cursorPosition, txt)
                    } else if (keyBoard.targetInput.text !== undefined) {
                        keyBoard.targetInput.text += txt
                    }
                }
                textBuffer=""
                candidateModel.clear()
                return
            }
            // ✅ 新增:数字  大写字母直接插入
            if (/^\d+$/.test(txt) || /^[A-Z]+$/.test(txt)) {
                if (keyBoard.targetInput) {
                    if (typeof keyBoard.targetInput.insert === "function") {
                        keyBoard.targetInput.insert(keyBoard.targetInput.cursorPosition, txt)
                    } else if (keyBoard.targetInput.text !== undefined) {
                        keyBoard.targetInput.text += txt
                    }
                }
                return
            }
            textBuffer+=txt
            var result = PinYinToChinese.pinyinOrLetterTurnChinese(textBuffer)
            console.log("拼音转中文结果", result)
            candidateModel.clear()
            if (Array.isArray(result)) {
                result.forEach(function(word) {
                    console.log("拼音转中文结果 word ", word)
                    candidateModel.append({text: word})
                    console.log("拼音转中文结果 candidateModel ", candidateModel)
                })
            }
        }
    }
    function insertChinese(txt){
        if (keyBoard.targetInput) {
            if (typeof keyBoard.targetInput.insert === "function") {
                keyBoard.targetInput.insert(keyBoard.targetInput.cursorPosition, txt)
            } else if (keyBoard.targetInput.text !== undefined) {
                keyBoard.targetInput.text += txt
            }
            textBuffer = ""
            candidateModel.clear()
        }
    }
    function deleteLastCharFromTarget() {
        //        if(isEnglish){
        //            if (keyBoard.targetInput && keyBoard.targetInput.activeFocus) {
        //                let input = keyBoard.targetInput
        //                if (input.text.length > 0) {
        //                    input.text = input.text.slice(0, input.text.length - 1)
        //                }
        //            }
        //        }
        deleteCache()
    }
    //从中文状态切换到英文 需要处理下 缓冲区 及查询到的文字展示
    function chineseSwitchEnglish(){
        isSmall = true
        if(isEnglish){
            textBuffer=""
            candidateModel.clear()
        }
    }
    function deleteCache(){
        var input = keyBoard.targetInput
        if(isEnglish){
            if (keyBoard.targetInput && keyBoard.targetInput.activeFocus) {

                if (input.text.length > 0) {
                    input.text = input.text.slice(0, input.text.length - 1)
                }
            }
        }else{
            if (textBuffer.length > 0) {
                // 删除缓冲区最后一个字符
                textBuffer = textBuffer.slice(0, textBuffer.length - 1)

                candidateModel.clear()

                if (!textBuffer || textBuffer.trim() === "") {
                    textBuffer = ""
                } else {
                    // ⚠️ 重新走拼音转汉字逻辑,但不要写入输入框
                    var result = PinYinToChinese.pinyinOrLetterTurnChinese(textBuffer)
                    if (Array.isArray(result)) {
                        result.forEach(function(word) {
                            console.log("拼音转中文结果 word ", word)
                            candidateModel.append({text: word})
                            console.log("拼音转中文结果 candidateModel ", candidateModel)
                        })
                    }
                }
            }else{
                if (keyBoard.targetInput && keyBoard.targetInput.activeFocus) {
                    if (input.text.length > 0) {
                        input.text = input.text.slice(0, input.text.length - 1)
                    }
                }
            }
        }
    }
    //切换到符合
    function switchKeyBoard(isSymbol){
        if(isSymbol){
            isEnglish = true
            textBuffer = ""
            candidateModel.clear()
            cl_english.visible = false
            cl_symbol.visible = true
        }else{
            isEnglish = true
            textBuffer = ""
            candidateModel.clear()
            cl_english.visible = true
            cl_symbol.visible = false
        }

    }
    //中英文键盘样式
    Column{
        id:cl_english
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.margins: leftRightMarign/2   // 左右边距 10dp
        anchors.verticalCenter: parent.verticalCenter
        CommonText{
            id:tv_cache_txt
            height: 30
            width: cl_english.width - leftRightMarign
            text:textBuffer
            //            visible: PinYinToChinese.isEnglistAndChooseData(isEnglish,textBuffer)
            //            visible: isEnglish ? false : (textBuffer === null ? false : true)
            visible:isEnglish?false:true
        }
        // 候选词列表
        Row{
            //            visible: PinYinToChinese.isEnglistAndChooseData(isEnglish,textBuffer)
            //            visible: isEnglish ? false : (textBuffer === null ? false : true)
            visible:isEnglish?false:true
            height: buttonHeight
            width: cl_english.width - leftRightMarign
            //            spacing: 5
            ListView {
                id: candidateListView
                height: buttonHeight
                width: cl_english.width - leftRightMarign
                spacing: 5
                visible: true
                orientation: ListView.Horizontal
                model: ListModel { id: candidateModel }
                delegate: CommonPressButton {
                    id: candidateButton
                    text: model.text
                    //                    width: 40

                    height: 40
                    clip: true
                    testSize:15
                    buttonRadius:5

                    // 隐藏的 Text 组件用于测量文字宽度(核心)
                    Text {
                        id: textMeasurer
                        text: candidateButton.text || ""  // 绑定按钮文字
                        font.pixelSize: candidateButton.textSize !== undefined ? candidateButton.textSize : 15   // 绑定文字大小
                        visible: false  // 仅测量,不显示
                    }
                    // 关键:通过 Math.max 强制最小宽度,无需 minimumWidth 属性
                    width: {
                        if (!candidateButton.text || candidateButton.text.trim() === "") {
                            return 40;  // 无文字时使用最小宽度
                        }
                        const margin = 16;  // 边距总和
                        const contentWidth = textMeasurer.implicitWidth + margin;
                        return Math.max(40, contentWidth);  // 最小宽度 40px
                    }
                    onClicked: {
                        // 将选中的字符添加到缓冲区
                        //                        textBuffer += text
                        //                        bufferText.text = textBuffer
                        insertChinese(model.text)
                    }
                }
            }
            //            CommonButton{
            //                id:tv_action
            //                width: visible ? 60 : 0  // ❗关键:隐藏时不占空间
            //                text: "删除"
            //                visible: false
            //                onClicked: {
            //                    deleteCache()
            //                }
            //            }
        }
        DriverView{
            width: parent.width
            height: 1
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:num_1
                text:"1"
                height: buttonHeight
                width: top11EveryWidth
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                radius: borderRadius
                onClicked: {
                    insertTextToTarget(num_1.text)
                }
            }
            CommonPressButton{
                id:num_2
                text:"2"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_2.text)
                }
            }
            CommonPressButton{
                id:num_3
                text:"3"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_3.text)
                }
            }
            CommonPressButton{
                id:num_4
                text:"4"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_4.text)
                }
            }
            CommonPressButton{
                id:num_5
                text:"5"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_5.text)
                }
            }
            CommonPressButton{
                id:num_6
                text:"6"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_6.text)
                }
            }
            CommonPressButton{
                id:num_7
                text:"7"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_7.text)
                }
            }
            CommonPressButton{
                id:num_8
                text:"8"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_8.text)
                }
            }
            CommonPressButton{
                id:num_9
                text:"9"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_9.text)
                }
            }
            CommonPressButton{
                id:num_0
                text:"0"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_0.text)
                }
            }
            CommonPressButton{
                id:icon_del
                text:"del"
                height: buttonHeight
                width: top11EveryWidth
                radius:5
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: "red"
                borderColor: borderColor
                textColor: 'white'
                onClicked: {
                    deleteLastCharFromTarget()
                }
            }
        }
        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:icon_q
                text:isSmall?"q":"Q"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_q.text)
                }
            }
            CommonPressButton{
                id:icon_w
                text:isSmall?"w":"W"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_w.text)
                }
            }
            CommonPressButton{
                id:icon_e
                text:isSmall?"e":"E"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_e.text)
                }
            }
            CommonPressButton{
                id:icon_r
                text:isSmall?"r":"R"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_r.text)
                }
            }
            CommonPressButton{
                id:icon_t
                text:isSmall?"t":"T"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_t.text)
                }
            }
            CommonPressButton{
                id:icon_y
                text:isSmall?"y":"Y"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_y.text)
                }
            }
            CommonPressButton{
                id:icon_u
                text:isSmall?"u":"U"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_u.text)
                }
            }
            CommonPressButton{
                id:icon_i
                text:isSmall?"i":"I"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_i.text)
                }
            }
            CommonPressButton{
                id:icon_o
                text:isSmall?"o":"O"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_o.text)
                }
            }
            CommonPressButton{
                id:icon_p
                text:isSmall?"p":"P"
                height: buttonHeight
                width: top10EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_p.text)
                }
            }

        }
        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:icon_a
                text:isSmall?"a":"A"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_a.text)
                }
            }
            CommonPressButton{
                id:icon_s
                text:isSmall?"s":"S"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_s.text)
                }
            }
            CommonPressButton{
                id:icon_d
                text:isSmall?"d":"D"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_d.text)
                }
            }
            CommonPressButton{
                id:icon_f
                text:isSmall?"f":"F"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_f.text)
                }
            }
            CommonPressButton{
                id:icon_g
                text:isSmall?"g":"G"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_g.text)
                }
            }
            CommonPressButton{
                id:icon_h
                text:isSmall?"h":"H"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_h.text)
                }
            }
            CommonPressButton{
                id:icon_j
                text:isSmall?"j":"J"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_j.text)
                }
            }
            CommonPressButton{
                id:icon_k
                text:isSmall?"k":"K"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_k.text)
                }
            }
            CommonPressButton{
                id:icon_l
                text:isSmall?"l":"L"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_l.text)
                }
            }

        }

        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:icon_switch_big_small
                text:isSmall?"小写":"大写"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    isSmall = !isSmall
                }
            }
            CommonPressButton{
                id:icon_z
                text:isSmall?"z":"Z"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_z.text)
                }
            }
            CommonPressButton{
                id:icon_x
                text:isSmall?"x":"X"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_x.text)
                }
            }
            CommonPressButton{
                id:icon_c
                text:isSmall?"c":"C"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_c.text)
                }
            }
            CommonPressButton{
                id:icon_v
                text:isSmall?"v":"V"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_v.text)
                }
            }
            CommonPressButton{
                id:icon_b
                text:isSmall?"b":"B"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_b.text)
                }
            }
            CommonPressButton{
                id:icon_n
                text:isSmall?"n":"N"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_n.text)
                }
            }
            CommonPressButton{
                id:icon_m
                text:isSmall?"m":"M"
                height: buttonHeight
                width: top8EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(icon_m.text)
                }
            }

        }
        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:icon_fh
                text:"符号"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    switchKeyBoard(true)
                }
            }
            CommonPressButton{
                id:icon_english
                text:isEnglish?"英":"中"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    isEnglish = !isEnglish
                    chineseSwitchEnglish()
                }
            }
            CommonPressButton{
                id:icon_english_space
                text:"space"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(" ")
                }
            }
            CommonPressButton{
                id:icon_english_change_num
                text:"123"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    console.log("切换数字键盘")
                }
            }
            CommonPressButton{
                id:icon_english_sure
                text:"确定"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    targetInput.focus = false
                    keyBoard.visible = false
                    console.log("点击了确定")
                }
            }
        }
    }
    //符号键盘
    Column{
        id:cl_symbol
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.margins: leftRightMarign/2   // 左右边距 10dp
        anchors.verticalCenter: parent.verticalCenter
        visible: false
        Row{
            spacing: 5
            CommonPressButton{
                id:num_symbol_1
                text:"1"
                height: buttonHeight
                width: top11EveryWidth
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                radius: borderRadius
                onClicked: {
                    insertTextToTarget(num_symbol_1.text)
                }
            }
            CommonPressButton{
                id:num_symbol_2
                text:"2"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_2.text)
                }
            }
            CommonPressButton{
                id:num_symbol_3
                text:"3"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_3.text)
                }
            }
            CommonPressButton{
                id:num_symbol_4
                text:"4"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_4.text)
                }
            }
            CommonPressButton{
                id:num_symbol_5
                text:"5"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_5.text)
                }
            }
            CommonPressButton{
                id:num_symbol_6
                text:"6"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_6.text)
                }
            }
            CommonPressButton{
                id:num_symbol_7
                text:"7"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_7.text)
                }
            }
            CommonPressButton{
                id:num_symbol_8
                text:"8"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_8.text)
                }
            }
            CommonPressButton{
                id:num_symbol_9
                text:"9"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_9.text)
                }
            }
            CommonPressButton{
                id:num_symbol_0
                text:"0"
                height: buttonHeight
                width: top11EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_0.text)
                }
            }
            CommonPressButton{
                id:icon_symbol_del
                text:"del"
                height: buttonHeight
                width: top11EveryWidth
                radius:5
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: "red"
                borderColor: borderColor
                textColor: 'white'
                onClicked: {
                    deleteLastCharFromTarget()
                }
            }
        }
        DriverView{
            height: 10
            width: keyBoard.width
        }

        Row{
            spacing: 5
            CommonPressButton{
                id:num_symbol_heng
                text:"-"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_heng.text)
                }
            }
            CommonPressButton{
                id:num_symbol_xie
                text:"/"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_xie.text)
                }
            }
            CommonPressButton{
                id:num_symbol_maohao
                text:":"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_maohao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_fenhao
                text:";"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_fenhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_lkuohao
                text:"("
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_lkuohao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_rkuohao
                text:")"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_rkuohao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_da_hengxian
                text:"——"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_da_hengxian.text)
                }
            }
            CommonPressButton{
                id:num_symbol_left_yinhao
                text:"“"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_left_yinhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_right_yinhao
                text:"”"
                height: buttonHeight
                width: top9EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_right_yinhao.text)
                }
            }
        }
        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:num_symbol_aite
                text:"@"
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_aite.text)
                }
            }
            CommonPressButton{
                id:num_symbol_sangedian
                text:"..."
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_sangedian.text)
                }
            }
            CommonPressButton{
                id:num_symbol_xiaobolang
                text:"~"
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_xiaobolang.text)
                }
            }
            CommonPressButton{
                id:num_symbol_dunhao
                text:"、"
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_dunhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_wenhao
                text:"?"
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_wenhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_tanhao
                text:"!"
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_tanhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_dian
                text:"."
                height: buttonHeight
                width: top7EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_dian.text)
                }
            }
        }
        DriverView{
            height: 10
            width: keyBoard.width
        }
        Row{
            spacing: 5
            CommonPressButton{
                id:num_symbol_fh
                text:"返回"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    switchKeyBoard(false)
                }
            }
            CommonPressButton{
                id:num_symbol_douhao
                text:","
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_douhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_space
                text:"space"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(" ")
                }
            }
            CommonPressButton{
                id:num_symbol_juhao
                text:"。"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    insertTextToTarget(num_symbol_juhao.text)
                }
            }
            CommonPressButton{
                id:num_symbol_sure
                text:"确定"
                height: buttonHeight
                width: top5EveryWidth
                radius:borderRadius
                testSize:textSize
                pressedColor: pressColor
                backgroundColor: bgColor
                borderColor: borderColor
                textColor: txtColor
                onClicked: {
                    targetInput.focus = false
                    keyBoard.visible = false
                    console.log("点击了确定")
                    switchKeyBoard(false)
                }
            }
        }

    }
}

内部组件

CommonText.qml

import QtQuick 2.0
Text {
    property color textColor: "#333333"
    property int pixelSize: 15
    property bool isBold: false
    property int hAlign: Text.AlignLeft      // 传 horizontalAlignment
    property int vAlign: Text.AlignVCenter      // 传 horizontalAlignment
    property bool centerSelf: false          // 是否自动居中自身
    property string cTitle: "默认文字"

    text: cTitle
    color: textColor
    font.pixelSize: pixelSize
    font.bold: isBold
    horizontalAlignment: hAlign

    // 如果需要让 Text 自身在父级中居中,则设 anchors.horizontalCenter
    anchors.horizontalCenter: centerSelf ? parent.horizontalCenter : undefined
}

CommonPressButton.qml

import QtQuick 2.0

Rectangle {
    id: root
    width: buttonWidth
    height: buttonHeight
    radius: buttonRadius
    color: mouseArea.pressed ? pressedColor : backgroundColor
    anchors.leftMargin: leftMargin
    anchors.rightMargin: rightMargin
    scale: mouseArea.pressed ? 0.97 : 1.0  // 缩放效果
    border.color:borderColor

    // ✅ 可传入的参数(可绑定)
    property alias text: buttonText.text
    property color textColor: "white"
    property color backgroundColor: "blue"
    property color pressedColor: "#004080" // 按压时颜色(可改)
    property color borderColor: "#DDDDDD" // 边框颜色
    property int buttonWidth: 200
    property int buttonHeight: 50
    property int buttonRadius: 20
    property int testSize: 20
    property int leftMargin: 5
    property int rightMargin: 5

    signal clicked()

    Text {
        id: buttonText
        anchors.centerIn: parent
        color: textColor
        font.pixelSize: testSize
    }

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: root.clicked()
    }

    Behavior on scale {
        NumberAnimation { duration: 80; easing.type: Easing.InOutQuad }
    }

    Behavior on color {
        ColorAnimation { duration: 80 }
    }
}

DriverView.qml

import QtQuick 2.0
import QtQuick.Window 2.3
Rectangle{
    property string bgColor: "transparent"
    property int viewWidth: Screen.width
    property int viewHeight: 5
    property int viewRadius: 1
    id: root
    width: viewWidth
    height: viewHeight
    radius: viewRadius
    color: bgColor

}

PinYinToChinese.js

//// 拼音映射表,简化版
const PINYIN_DICT = {
    "a": ["啊", "阿", "呵", "吖", "锕", "腌"],
    "ai": ["爱", "哎", "唉", "哀", "矮", "癌", "碍", "艾", "隘", "霭", "皑", "挨"],
    "an": ["安", "按", "暗", "岸", "案", "俺", "庵", "鞍", "黯", "桉", "铵", "谙"],
    "ang": ["昂", "肮", "卬", "盎", "醠"],
    "ao": ["奥", "熬", "袄", "傲", "凹", "澳", "翱", "坳", "懊", "獒", "遨", "鏖"],
    "ba": ["把", "八", "爸", "吧", "拔", "霸", "巴", "扒", "疤", "芭", "靶", "跋"],
    "bai": ["白", "百", "败", "拜", "柏", "摆", "佰", "掰", "呗", "稗", "捭"],
    "ban": ["班", "半", "办", "般", "版", "拌", "斑", "搬", "坂", "扳", "伴", "扮"],
    "bang": ["帮", "棒", "绑", "磅", "榜", "蚌", "邦", "浜", "镑", "傍", "梆"],
    "bao": ["包", "宝", "报", "保", "爆", "薄", "苞", "胞", "剥", "褒", "堡", "褓"],
    "bei": ["北", "被", "备", "杯", "背", "贝", "悲", "辈", "碑", "卑", "惫", "焙"],
    "ben": ["本", "奔", "笨", "夯", "苯", "畚", "贲", "锛"],
    "beng": ["崩", "泵", "绷", "甭", "迸", "嘣", "甏", "蹦"],
    "bi": ["比", "笔", "必", "逼", "鼻", "币", "闭", "壁", "碧", "彼", "毕", "庇"],
    "bian": ["边", "变", "遍", "便", "编", "扁", "辨", "辩", "汴", "砭", "苄", "煸"],
    "biao": ["表", "标", "彪", "膘", "裱", "鳔", "飙", "镖", "镳", "骠", "杓"],
    "bie": ["别", "憋", "瘪", "蹩", "莂", "蟞"],
    "bin": ["宾", "彬", "斌", "滨", "濒", "鬓", "缤", "殡", "膑", "玢", "髌"],
    "bing": ["并", "兵", "冰", "病", "丙", "柄", "饼", "禀", "摒", "邴", "冰晶"],
    "bo": ["波", "博", "播", "伯", "驳", "脖", "泊", "勃", "搏", "铂", "菠", "礴"],
    "bu": ["不", "步", "补", "布", "捕", "簿", "部", "堡", "埠", "哺", "埔", "钚"],
    "ca": ["擦", "嚓", "礤", "拆"],
    "cai": ["才", "菜", "采", "财", "裁", "睬", "材", "猜", "蔡", "踩", "彩", "骖"],
    "can": ["参", "餐", "残", "蚕", "惭", "惨", "灿", "孱", "璨", "黪", "粲"],
    "cang": ["仓", "藏", "沧", "苍", "舱", "伧", "臧"],
    "cao": ["草", "操", "曹", "槽", "糙", "吵", "漕", "嘈", "螬", "艚", "蹭"],
    "ce": ["测", "侧", "策", "厕", "册", "恻", "岑"],
    "cen": ["参", "岑", "涔", "笒"],
    "ceng": ["曾", "蹭", "层", "噌", "嶒"],
    "cha": ["茶", "查", "差", "插", "叉", "察", "岔", "刹", "诧", "衩", "碴", "嚓"],
    "chai": ["柴", "拆", "差", "钗", "豺", "瘥", "侪"],
    "chan": ["产", "长", "站", "馋", "缠", "颤", "蝉", "婵", "禅", "忏", "潺", "蟾"],
    "chang": ["长", "常", "厂", "场", "唱", "偿", "昌", "倡", "肠", "畅", "怅", "菖"],
    "chao": ["超", "吵", "炒", "朝", "潮", "巢", "嘲", "晁", "焯", "绰", "剿"],
    "che": ["车", "扯", "撤", "掣", "彻", "澈", "坼", "砗", "嗔"],
    "chen": ["陈", "晨", "沉", "臣", "尘", "衬", "趁", "辰", "宸", "谌", "谶", "琛"],
    "cheng": ["成", "城", "称", "程", "乘", "盛", "承", "诚", "橙", "逞", "秤", "澄"],
    "chi": ["吃", "池", "迟", "尺", "齿", "赤", "持", "翅", "斥", "驰", "痴", "耻"],
    "chong": ["冲", "重", "虫", "宠", "崇", "充", "忡", "憧", "舂", "铳", "艟"],
    "chou": ["抽", "愁", "丑", "臭", "仇", "筹", "绸", "酬", "惆", "瞅", "踌"],
    "chu": ["出", "处", "初", "除", "触", "厨", "楚", "础", "储", "搐", "矗", "刍"],
    "chuai": ["揣", "踹", "搋", "膪"],
    "chuan": ["传", "船", "穿", "川", "串", "喘", "椽", "舛", "钏", "氚"],
    "chuang": ["创", "窗", "床", "闯", "疮", "怆", "幢", "戗"],
    "chui": ["吹", "垂", "炊", "锤", "捶", "陲", "槌", "棰"],
    "chun": ["春", "纯", "蠢", "唇", "醇", "淳", "椿", "鹑", "莼", "皴", "蝽"],
    "chuo": ["戳", "绰", "啜", "辍", "龊", "踔"],
    "ci": ["次", "词", "此", "刺", "瓷", "慈", "磁", "雌", "疵", "茨", "糍", "赐"],
    "cong": ["从", "聪", "葱", "丛", "匆", "琮", "淙", "苁", "骢", "囱"],
    "cou": ["凑", "蔟", "辏", "腠", "楱"],
    "cu": ["粗", "醋", "促", "卒", "蔟", "猝", "蹙", "蹴", "徂", "殂"],
    "cuan": ["窜", "蹿", "篡", "攒", "汆", "撺", "镩", "爨"],
    "cui": ["催", "翠", "脆", "崔", "淬", "瘁", "摧", "璀", "悴", "啐", "榱"],
    "cun": ["村", "存", "寸", "忖", "皴", "籿"],
    "cuo": ["错", "搓", "撮", "措", "挫", "痤", "磋", "锉", "厝", "脞"],
    "da": ["大", "打", "达", "答", "搭", "瘩", "耷", "哒", "怛", "妲", "笪"],
    "dai": ["带", "代", "呆", "待", "戴", "贷", "袋", "逮", "傣", "殆", "怠", "埭"],
    "dan": ["但", "单", "蛋", "丹", "胆", "淡", "担", "弹", "诞", "郸", "耽", "殚"],
    "dang": ["当", "党", "挡", "荡", "档", "裆", "宕", "谠", "砀", "铛"],
    "dao": ["到", "道", "刀", "导", "岛", "倒", "稻", "蹈", "祷", "盗", "悼", "捣"],
    "de": ["的", "得", "地", "德", "底", "嘚"],
    "deng": ["等", "灯", "登", "邓", "瞪", "凳", "蹬", "噔", "嶝", "磴", "镫"],
    "di": ["地", "的", "第", "低", "滴", "敌", "堤", "迪", "笛", "狄", "涤", "嫡"],
    "dian": ["点", "电", "店", "垫", "典", "颠", "碘", "佃", "甸", "惦", "淀", "玷"],
    "diao": ["掉", "吊", "钓", "雕", "调", "叼", "貂", "碉", "凋", "鲷", "屌"],
    "die": ["叠", "跌", "爹", "蝶", "谍", "牒", "迭", "堞", "瓞", "蹀", "鲽"],
    "ding": ["定", "顶", "丁", "盯", "钉", "鼎", "锭", "订", "叮", "仃", "酊", "啶"],
    "diu": ["丢", "铥"],
    "dong": ["东", "动", "懂", "冬", "洞", "董", "冻", "栋", "侗", "咚", "峒", "胨"],
    "dou": ["都", "斗", "豆", "抖", "逗", "陡", "兜", "窦", "篼", "蚪", "痘"],
    "du": ["度", "读", "都", "毒", "独", "堵", "肚", "杜", "镀", "妒", "督", "笃"],
    "duan": ["段", "短", "断", "端", "锻", "缎", "簖", "煅", "椴"],
    "dui": ["对", "队", "堆", "兑", "怼", "碓", "镦", "憝"],
    "dun": ["吨", "顿", "蹲", "敦", "盾", "囤", "钝", "遁", "沌", "盹", "砘", "趸"],
    "duo": ["多", "夺", "朵", "躲", "剁", "惰", "驮", "哆", "踱", "铎", "掇", "咄"],
    "e": ["额", "饿", "恶", "俄", "蛾", "厄", "讹", "阿", "遏", "鄂", "噩", "垩"],
    "en": ["恩", "嗯", "蒽", "摁"],
    "er": ["二", "儿", "耳", "尔", "饵", "洱", "迩", "贰", "铒", "鲕"],
    "fa": ["发", "法", "罚", "阀", "乏", "珐", "筏", "砝", "垡"],
    "fan": ["反", "饭", "翻", "犯", "凡", "烦", "帆", "番", "樊", "矾", "繁", "泛"],
    "fang": ["方", "放", "房", "防", "芳", "纺", "肪", "仿", "访", "舫", "邡", "坊"],
    "fei": ["飞", "非", "费", "肥", "废", "肺", "匪", "啡", "诽", "吠", "蜚", "翡"],
    "fen": ["分", "份", "粉", "坟", "奋", "愤", "芬", "酚", "氛", "焚", "汾", "吩"],
    "feng": ["风", "封", "丰", "疯", "峰", "缝", "冯", "枫", "烽", "逢", "讽", "俸"],
    "fo": ["佛", "仏"],
    "fou": ["否", "缶", "鄜"],
    "fu": ["福", "服", "付", "负", "富", "扶", "复", "附", "腐", "肤", "伏", "俘"],
    "ga": ["嘎", "噶", "尬", "伽"],
    "gai": ["改", "该", "盖", "钙", "概", "溉", "丐", "垓", "赅", "芥"],
    "gan": ["干", "感", "敢", "肝", "甘", "杆", "竿", "柑", "尴", "秆", "酐", "擀"],
    "gang": ["刚", "钢", "港", "杠", "缸", "岗", "罡", "戆", "扛"],
    "gao": ["高", "搞", "告", "糕", "稿", "篙", "皋", "羔", "膏", "镐", "诰", "杲"],
    "ge": ["个", "歌", "哥", "割", "革", "格", "葛", "阁", "隔", "蛤", "胳", "咯"],
    "gei": ["给"],
    "gen": ["根", "跟", "亘", "艮", "哏", "茛"],
    "geng": ["更", "耕", "耿", "梗", "赓", "羹", "埂", "哽", "绠"],
    "gong": ["工", "公", "共", "功", "攻", "供", "宫", "躬", "龚", "巩", "拱", "贡"],
    "gou": ["够", "沟", "狗", "构", "购", "钩", "苟", "垢", "篝", "佝", "鞲", "遘"],
    "gu": ["古", "故", "顾", "谷", "骨", "鼓", "姑", "孤", "辜", "菇", "沽", "蛊"],
    "gua": ["瓜", "挂", "刮", "褂", "寡", "胍", "呱", "剐", "卦"],
    "guai": ["怪", "拐", "乖", "夬"],
    "guan": ["关", "官", "管", "观", "馆", "罐", "冠", "惯", "灌", "贯", "莞", "棺"],
    "guang": ["光", "广", "逛", "咣", "犷", "胱", "桄"],
    "gui": ["贵", "归", "鬼", "跪", "轨", "柜", "桂", "闺", "硅", "瑰", "癸", "皈"],
    "gun": ["滚", "棍", "衮", "磙", "鲧", "绲"],
    "guo": ["过", "国", "果", "裹", "锅", "郭", "涡", "聒", "蝈", "椁", "帼", "馃"],
    "ha": ["哈", "蛤", "虾", "铪", "吓"],
    "hai": ["还", "海", "害", "咳", "亥", "骇", "氦", "孩", "骸", "嗨", "胲"],
    "han": ["汉", "喊", "含", "寒", "汗", "韩", "函", "旱", "翰", "撼", "捍", "悍"],
    "hang": ["行", "航", "巷", "杭", "夯", "沆"],
    "hao": ["好", "号", "浩", "耗", "豪", "毫", "郝", "蒿", "壕", "嚎", "貉", "蚝"],
    "he": ["和", "合", "河", "喝", "赫", "荷", "核", "何", "贺", "呵", "褐", "鹤"],
    "hei": ["黑", "嘿"],
    "hen": ["很", "狠", "恨", "痕"],
    "heng": ["横", "恒", "哼", "衡", "亨", "蘅"],
    "hong": ["红", "洪", "哄", "虹", "宏", "鸿", "轰", "烘", "讧", "黉"],
    "hou": ["后", "候", "喉", "猴", "厚", "吼", "侯", "篌", "逅"],
    "hu": ["护", "湖", "呼", "户", "互", "乎", "虎", "忽", "弧", "狐", "胡", "壶"],
    "hua": ["化", "花", "华", "画", "滑", "划", "哗", "桦", "猾", "砉"],
    "huai": ["坏", "怀", "徊", "淮", "槐", "踝"],
    "huan": ["换", "还", "患", "环", "欢", "缓", "幻", "焕", "宦", "唤", "桓", "痪"],
    "huang": ["黄", "慌", "晃", "皇", "谎", "凰", "惶", "璜", "簧", "恍"],
    "hui": ["会", "回", "汇", "辉", "慧", "恢", "毁", "绘", "徽", "蛔", "贿", "晖"],
    "hun": ["混", "昏", "婚", "魂", "浑", "荤", "馄", "诨"],
    "huo": ["或", "活", "火", "获", "货", "祸", "惑", "伙", "霍", "豁", "劐"],
    "ji": ["机", "几", "及", "级", "记", "己", "积", "急", "计", "技", "集", "季", "击", "既", "纪", "继", "基", "寄", "迹", "吉", "忌", "疾", "鸡", "剂", "辑", "妓", "蓟", "稽", "亟", "畸", "挤", "嫉", "冀"],
    "jia": ["家", "加", "价", "架", "甲", "假", "驾", "佳", "嘉", "贾", "嫁", "稼", "夹", "伽", "茄", "钾", "荚", "颊", "珈", "枷"],
    "jian": ["见", "间", "件", "建", "坚", "检", "简", "践", "渐", "剪", "减", "剑", "肩", "监", "尖", "鉴", "贱", "健", "舰", "煎", "俭", "兼", "奸", "箭", "茧", "笺", "槛", "涧"],
    "jiang": ["将", "讲", "强", "降", "奖", "江", "蒋", "疆", "酱", "浆", "匠", "桨", "绛", "犟"],
    "jiao": ["教", "交", "角", "较", "叫", "觉", "焦", "脚", "胶", "娇", "轿", "狡", "浇", "骄", "椒", "矫", "搅", "缴", "嚼", "皎", "饺", "绞"],
    "jie": ["接", "节", "界", "结", "解", "借", "介", "街", "姐", "皆", "阶", "杰", "洁", "捷", "劫", "竭", "揭", "诫", "戒", "桔", "睫", "藉"],
    "jin": ["进", "金", "近", "仅", "紧", "尽", "劲", "禁", "锦", "筋", "今", "津", "巾", "晋", "浸", "瑾", "襟", "谨"],
    "jing": ["经", "京", "精", "警", "竟", "井", "镜", "景", "境", "敬", "静", "惊", "劲", "净", "竞", "茎", "鲸", "晶", "荆", "儆"],
    "jiong": ["窘", "炯", "迥", "冏", "扃"],
    "jiu": ["就", "九", "旧", "久", "救", "酒", "究", "纠", "舅", "咎", "厩", "臼", "灸", "鸠", "玖", "赳"],
    "ju": ["局", "举", "据", "剧", "聚", "居", "拒", "巨", "句", "俱", "矩", "鞠", "驹", "沮", "锯", "菊", "咀", "橘", "拘", "桔"],
    "juan": ["卷", "捐", "倦", "娟", "眷", "鹃", "涓", "卷帙"],
    "jue": ["觉", "决", "绝", "角", "掘", "诀", "倔", "爵", "珏", "厥", "攫", "噱"],
    "jun": ["军", "君", "均", "俊", "郡", "菌", "峻", "骏", "竣", "钧", "浚", "隽"],
    "ka": ["卡", "咖", "喀", "咯", "佧", "胩"],
    "kai": ["开", "凯", "慨", "楷", "揩", "垲", "铠"],
    "kan": ["看", "刊", "砍", "坎", "侃", "勘", "堪", "龛", "槛"],
    "kang": ["抗", "康", "炕", "慷", "糠", "伉"],
    "kao": ["考", "靠", "烤", "拷", "栲", "尻"],
    "ke": ["可", "科", "克", "客", "课", "颗", "壳", "渴", "棵", "柯", "咳", "坷", "苛", "磕", "嗑", "窠", "蝌"],
    "ken": ["肯", "垦", "恳", "啃", "裉"],
    "keng": ["坑", "吭", "铿", "忐忑"],
    "kong": ["空", "控", "孔", "恐", "倥", "崆"],
    "kou": ["口", "扣", "寇", "抠", "叩", "蔻", "眍"],
    "ku": ["苦", "库", "哭", "酷", "裤", "枯", "窟", "刳", "骷"],
    "kua": ["跨", "夸", "垮", "胯", "挎", "侉"],
    "kuai": ["快", "块", "筷", "脍", "蒯", "侩"],
    "kuan": ["宽", "款", "髋"],
    "kuang": ["狂", "况", "矿", "框", "旷", "匡", "筐", "邝", "夼", "诓"],
    "kui": ["亏", "愧", "馈", "溃", "窥", "奎", "魁", "盔", "葵", "匮", "喟", "愦"],
    "kun": ["困", "昆", "捆", "坤", "鲲", "锟", "髡"],
    "kuo": ["扩", "括", "阔", "廓", "蛞", "栝"],
    "la": ["拉", "啦", "辣", "腊", "喇", "垃", "蜡", "剌", "邋", "旯"],
    "lai": ["来", "赖", "莱", "睐", "癞", "籁", "徕"],
    "lan": ["蓝", "栏", "烂", "懒", "拦", "篮", "览", "兰", "滥", "揽", "澜", "婪", "岚", "斓"],
    "lang": ["浪", "狼", "廊", "朗", "榔", "琅", "螂", "莨", "啷"],
    "lao": ["老", "劳", "牢", "捞", "姥", "烙", "潦", "唠", "酪", "佬", "崂", "铑"],
    "le": ["了", "乐", "勒", "肋", "泐", "仂"],
    "lei": ["类", "雷", "泪", "累", "擂", "蕾", "垒", "磊", "儡", "羸", "镭"],
    "leng": ["冷", "愣", "棱", "楞", "塄"],
    "li": ["里", "理", "力", "利", "立", "离", "历", "礼", "丽", "黎", "李", "厉", "莉", "励", "栗", "璃", "俐", "粒", "荔", "狸", "篱", "罹", "沥", "锂", "隶", "痢", "戾", "漓", "傈"],
    "lia": ["俩", "俩儿"],
    "lian": ["连", "练", "联", "脸", "莲", "恋", "炼", "廉", "链", "帘", "怜", "涟", "敛", "殓", "镰"],
    "liang": ["两", "量", "亮", "辆", "良", "梁", "凉", "晾", "粮", "谅", "踉", "魉"],
    "liao": ["了", "料", "疗", "辽", "聊", "燎", "撩", "缭", "寥", "潦", "镣", "廖"],
    "lie": ["列", "烈", "猎", "裂", "劣", "咧", "趔", "冽", "埒"],
    "lin": ["林", "临", "邻", "淋", "琳", "磷", "麟", "吝", "鳞", "凛", "赁", "蔺"],
    "ling": ["领", "令", "灵", "零", "龄", "铃", "岭", "凌", "玲", "菱", "聆", "羚", "囹"],
    "liu": ["流", "六", "刘", "留", "柳", "瘤", "硫", "馏", "溜", "琉", "榴", "绺"],
    "long": ["龙", "隆", "垄", "聋", "笼", "拢", "胧", "珑", "窿", "陇", "垅"],
    "lou": ["楼", "漏", "露", "喽", "搂", "篓", "陋", "娄", "偻"],
    "lu": ["路", "陆", "炉", "露", "鲁", "鹿", "录", "芦", "卢", "颅", "庐", "碌", "掳", "潞", "麓", "卤", "虏", "橹", "漉", "戮"],
    "lv": ["绿", "率", "履", "律", "虑", "旅", "吕", "缕", "滤", "屡", "铝", "氯", "驴"],
    "luan": ["乱", "卵", "峦", "孪", "滦", "鸾", "栾", "銮"],
    "lue": ["掠", "略", "锊"],
    "lun": ["论", "轮", "伦", "仑", "抡", "沦", "囵"],
    "luo": ["落", "罗", "络", "逻", "锣", "裸", "骆", "螺", "箩", "洛", "漯", "烙", "倮"],
    "ma": ["马", "吗", "妈", "码", "麻", "骂", "嘛", "抹", "玛", "蚂", "唛", "杩"],
    "mai": ["买", "卖", "麦", "脉", "埋", "迈", "霾", "劢", "荬"],
    "man": ["满", "慢", "漫", "蛮", "曼", "瞒", "馒", "蔓", "幔", "谩", "熳"],
    "mang": ["忙", "芒", "盲", "茫", "莽", "氓", "蟒"],
    "mao": ["毛", "矛", "猫", "帽", "貌", "冒", "茂", "卯", "锚", "昴", "茅", "懋"],
    "me": ["么", "麽", "嚒"],
    "mei": ["没", "每", "美", "妹", "眉", "梅", "煤", "媒", "谜", "媚", "枚", "霉", "玫", "昧", "寐"],
    "men": ["们", "门", "闷", "扪", "焖", "懑"],
    "meng": ["梦", "蒙", "猛", "盟", "孟", "氓", "萌", "锰", "艨", "懵", "礞"],
    "mi": ["米", "迷", "秘", "密", "蜜", "弥", "靡", "觅", "泌", "谜", "眯", "糜", "敉", "麋"],
    "mian": ["面", "棉", "眠", "绵", "勉", "免", "冕", "缅", "娩", "腼"],
    "miao": ["妙", "苗", "秒", "庙", "描", "瞄", "渺", "藐", "杪", "喵"],
    "mie": ["灭", "蔑", "篾", "咩", "蠛", "乜"],
    "min": ["民", "敏", "闽", "皿", "悯", "珉", "岷", "泯", "愍"],
    "ming": ["明", "名", "命", "鸣", "铭", "冥", "茗", "酩", "瞑"],
    "miu": ["谬", "缪"],
    "mo": ["没", "末", "莫", "模", "墨", "摸", "魔", "漠", "默", "磨", "沫", "膜", "抹", "寞", "陌", "脉", "蓦"],
    "mou": ["某", "谋", "牟", "眸", "鍪", "哞"],
    "mu": ["目", "母", "木", "模", "幕", "牧", "墓", "慕", "亩", "穆", "睦", "拇", "牡"],
    "na": ["那", "拿", "哪", "纳", "呐", "捺", "衲", "钠"],
    "nai": ["乃", "奶", "耐", "奈", "鼐", "氖"],
    "nan": ["南", "难", "男", "楠", "喃", "囡", "赧"],
    "nang": ["囊", "囔", "馕", "攮"],
    "nao": ["脑", "闹", "恼", "挠", "瑙", "淖", "孬"],
    "ne": ["呢", "讷", "哪"],
    "nei": ["内", "馁", "那"],
    "nen": ["嫩", "恁"],
    "neng": ["能", "嫩能"],
    "ni": ["你", "尼", "呢", "泥", "拟", "腻", "逆", "倪", "妮", "匿", "霓", "昵", "坭", "铌"],
    "nian": ["年", "念", "粘", "碾", "蔫", "捻", "拈", "鲇", "黏"],
    "niang": ["娘", "酿"],
    "niao": ["鸟", "尿", "溺", "脲", "袅"],
    "nie": ["捏", "聂", "涅", "孽", "镍", "啮", "蹑", "蘖", "乜"],
    "nin": ["您", "恁"],
    "ning": ["宁", "凝", "拧", "柠", "咛", "狞", "甯", "泞"],
    "niu": ["牛", "纽", "扭", "钮", "妞", "忸", "狃"],
    "nong": ["农", "弄", "浓", "脓", "侬"],
    "nu": ["女", "怒", "努", "奴", "孥"],
    "nuan": ["暖", "奻"],
    "nue": ["虐", "疟"],
    "nuo": ["诺", "挪", "懦", "糯", "喏", "傩"],
    "o": ["哦", "喔", "噢", "讴", "怄", "鸥", "瓯", "欧", "殴"],
    "ou": ["欧", "偶", "呕", "藕", "鸥", "讴", "沤", "耦", "殴", "怄"],
    "pa": ["怕", "爬", "啪", "帕", "琶", "趴", "扒", "杷", "筢"],
    "pai": ["派", "排", "牌", "拍", "徘", "湃", "俳", "哌"],
    "pan": ["判", "盘", "盼", "叛", "潘", "攀", "畔", "蹒", "磐", "爿", "泮"],
    "pang": ["旁", "胖", "庞", "耪", "彷", "滂", "逄", "磅"],
    "pao": ["跑", "炮", "泡", "抛", "袍", "刨", "咆", "庖", "疱", "狍"],
    "pei": ["陪", "配", "培", "佩", "赔", "沛", "裴", "呸", "锫", "旆"],
    "pen": ["喷", "盆", "湓", "呠"],
    "peng": ["朋", "碰", "棚", "捧", "膨", "蓬", "烹", "澎", "彭", "篷", "砰", "怦"],
    "pi": ["批", "皮", "披", "疲", "屁", "脾", "匹", "劈", "啤", "譬", "痞", "砒", "貔", "铍"],
    "pian": ["片", "偏", "骗", "篇", "扁", "翩", "骈", "犏", "谝"],
    "piao": ["票", "漂", "飘", "瓢", "嫖", "瞟", "剽", "螵", "缥"],
    "pie": ["撇", "瞥", "氕"],
    "pin": ["品", "贫", "拼", "频", "聘", "拚", "榀", "嫔", "颦", "牝"],
    "ping": ["平", "评", "瓶", "凭", "屏", "乒", "苹", "坪", "萍", "娉"],
    "po": ["破", "坡", "迫", "泼", "颇", "婆", "粕", "魄", "泊", "叵", "笸", "珀"],
    "pou": ["剖", "掊", "裒", "婄"],
    "pu": ["普", "铺", "扑", "仆", "葡", "谱", "浦", "朴", "瀑", "莆", "蒲", "埔", "菩", "镤", "氆"],
    "qi": ["起", "其", "气", "期", "七", "奇", "企", "齐", "器", "汽", "旗", "骑", "弃", "启", "契", "妻", "歧", "棋", "欺", "栖", "岂", "祈", "泣", "祺", "琦", "岐", "颀", "杞", "憩", "鳍", "亟"],
    "qia": ["恰", "掐", "洽", "髂", "葜", "伽", "袷"],
    "qian": ["前", "钱", "千", "签", "欠", "迁", "潜", "牵", "谦", "歉", "铅", "浅", "乾", "倩", "嵌", "钳", "纤", "黔", "阡", "骞", "虔", "谴", "堑"],
    "qiang": ["强", "抢", "枪", "墙", "腔", "呛", "羌", "锵", "蔷", "跄", "戕", "嫱"],
    "qiao": ["桥", "巧", "敲", "悄", "瞧", "侨", "窍", "翘", "撬", "峭", "锹", "鞘", "雀", "谯", "跷","乔"],
    "qie": ["切", "且", "茄", "窃", "怯", "妾", "砌", "郄", "惬", "趄"],
    "qin": ["亲", "勤", "侵", "秦", "琴", "禽", "钦", "芹", "擒", "覃", "衾", "矜", "噙", "芩"],
    "qing": ["情", "青", "清", "请", "轻", "晴", "氢", "倾", "擎", "顷", "卿", "苘", "蜻"],
    "qiong": ["穷", "琼", "邛", "筇", "茕", "跫"],
    "qiu": ["求", "球", "秋", "丘", "囚", "酋", "泅", "邱", "裘", "糗", "虬", "俅", "鳅"],
    "qu": ["去", "取", "区", "趣", "曲", "屈", "趋", "渠", "躯", "驱", "娶", "瞿", "戌", "岖", "龋", "苣", "劬"],
    "quan": ["全", "权", "圈", "拳", "劝", "泉", "券", "犬", "痊", "诠", "铨", "蜷", "筌", "鬈"],
    "que": ["却", "缺", "确", "雀", "阙", "鹊", "瘸", "榷", "炔"],
    "qun": ["群", "裙", "逡", "麇"],
    "ran": ["然", "燃", "冉", "苒", "染", "髯", "蚺"],
    "rang": ["让", "嚷", "瓤", "壤", "攘", "禳"],
    "rao": ["绕", "扰", "饶", "荛", "娆", "桡", "袍"],
    "re": ["热", "惹", "喏", "若", "仞"],
    "ren": ["人", "认", "仁", "任", "忍", "韧", "刃", "壬", "妊", "纫", "荏", "稔", "仞"],
    "reng": ["仍", "扔", "礽"],
    "ri": ["日", "驲", "釰"],
    "rong": ["容", "荣", "融", "绒", "蓉", "溶", "冗", "戎", "茸", "嵘", "肜", "蝾"],
    "rou": ["肉", "柔", "揉", "糅", "蹂", "鞣", "媃"],
    "ru": ["如", "入", "乳", "辱", "儒", "蠕", "嚅", "孺", "茹", "濡", "铷", "襦", "薷", "洳"],
    "ruan": ["软", "阮", "朊", "媆"],
    "rui": ["瑞", "锐", "蕊", "芮", "睿", "蚋", "枘"],
    "run": ["润", "闰", "洳", "撋"],
    "ruo": ["若", "弱", "偌", "箬", "鄀"],
    // s 开头拼音
    "sa": ["撒", "洒", "萨", "飒", "卅", "仨"],
    "sai": ["赛", "塞", "腮", "鳃", "噻"],
    "san": ["三", "散", "伞", "参", " san", "馓", "毵"],
    "sang": ["桑", "丧", "嗓", "搡", "磉"],
    "sao": ["扫", "嫂", "骚", "臊", "缫", "瘙"],
    "se": ["色", "塞", "瑟", "涩", "啬", "铯"],
    "sen": ["森", "椮"],
    "seng": ["僧"],
    "sha": ["杀", "沙", "傻", "啥", "纱", "煞", "厦", "砂", "鲨", "霎"],
    "shai": ["晒", "筛", "色", "酾"],
    "shan": ["山", "善", "单", "扇", "闪", "衫", "删", "陕", "珊", "擅", "汕", "潸"],
    "shang": ["上", "商", "伤", "赏", "尚", "裳", "晌", "殇", "熵", "垧"],
    "shao": ["少", "烧", "绍", "勺", "哨", "邵", "梢", "韶", "捎", "芍", "鞘"],
    "she": ["设", "社", "射", "舌", "蛇", "舍", "摄", "奢", "赦", "涉", "畲"],
    "shen": ["身", "深", "神", "沈", "审", "甚", "参", "肾", "绅", "呻", "慎", "娠"],
    "sheng": ["生", "声", "省", "升", "圣", "盛", "剩", "绳", "胜", "甥", "晟"],
    "shi": ["是", "时", "事", "市", "师", "石", "十", "实", "使", "史", "式", "识", "世", "施", "食", "室", "始", "驶", "士", "氏", "湿", "诗", "尸"],
    "shou": ["手", "受", "收", "守", "首", "寿", "兽", "售", "授", "瘦", "狩"],
    "shu": ["书", "数", "树", "属", "术", "叔", "输", "舒", "鼠", "署", "熟", "梳", "殊", "蔬"],
    "shua": ["刷", "耍", "唰", "刷"],
    "shuai": ["帅", "摔", "衰", "率", "蟀"],
    "shuan": ["拴", "栓", "闩", "涮"],
    "shuang": ["双", "霜", "爽", "孀", "泷"],
    "shui": ["水", "谁", "睡", "税", "帅", "氵"],
    "shun": ["顺", "瞬", "舜", "吮", "顺", "楯"],
    "shuo": ["说", "朔", "硕", "烁", "妁", "铄"],
    "si": ["四", "死", "思", "丝", "司", "似", "寺", "私", "撕", "厮", "饲", "肆"],
    "song": ["送", "松", "宋", "颂", "耸", "讼", "嵩", "淞", "怂", "菘"],
    "sou": ["搜", "艘", "擞", "嗽", "叟", "馊", "薮"],
    "su": ["苏", "素", "速", "俗", "诉", "宿", "塑", "肃", "粟", "溯", "稣"],
    "suan": ["算", "酸", "蒜", "狻"],
    "sui": ["岁", "随", "碎", "虽", "遂", "隋", "穗", "髓", "绥", "隧"],
    "sun": ["孙", "损", "笋", "隼", "荪", "狲"],
    "suo": ["所", "锁", "索", "缩", "琐", "唆", "唢", "蓑"],

    // ------------------------------
    // t 开头拼音
    "ta": ["他", "她", "它", "塔", "塌", "踏", "榻", "挞", "獭"],
    "tai": ["太", "台", "态", "泰", "胎", "抬", "苔", "汰", "邰", "酞"],
    "tan": ["谈", "叹", "弹", "碳", "滩", "坦", "贪", "探", "坛", "炭", "瘫", "痰"],
    "tang": ["唐", "糖", "汤", "躺", "堂", "烫", "塘", "倘", "淌", "棠", "膛"],
    "tao": ["套", "涛", "桃", "讨", "逃", "陶", "滔", "韬", "萄", "洮"],
    "te": ["特", "忑", "忒"],
    "teng": ["疼", "腾", "藤", "誊", "滕"],
    "ti": ["体", "题", "提", "替", "梯", "踢", "蹄", "涕", "剃", "屉", "啼"],
    "tian": ["天", "田", "填", "甜", "添", "恬", "腆", "佃", "舔", "阗"],
    "tiao": ["条", "调", "跳", "挑", "眺", "迢", "苕", "窕", "铫"],
    "tie": ["铁", "贴", "帖", "餮"],
    "ting": ["听", "停", "厅", "庭", "挺", "艇", "汀", "婷", "霆"],
    "tong": ["通", "同", "童", "痛", "桶", "铜", "筒", "桐", "瞳", "捅"],
    "tou": ["头", "投", "透", "偷", " tou", "骰"],
    "tu": ["图", "土", "突", "途", "吐", "兔", "徒", "屠", "涂", "凸"],
    "tuan": ["团", "湍", "抟", "疃"],
    "tui": ["推", "退", "腿", "颓", "蜕", "褪", "忒"],
    "tun": ["吞", "屯", "臀", "囤", "饨", "豚"],
    "tuo": ["托", "脱", "拖", "妥", "驼", "拓", "陀", "椭", "唾", "跎"],

    // ------------------------------
    // u 开头拼音(含整体认读音节)
    "u": ["乌", "污", "呜", "钨", "巫", "诬", "邬"],
    "wu": ["无", "五", "午", "吴", "武", "舞", "雾", "物", "悟", "务", "勿"], // 补充wu(u的整体认读)

    // ------------------------------
    // v 开头拼音(对应汉语拼音 ü 系列,键盘输入用v代替)
    "v": ["于", "与", "宇", "语", "雨", "愈", "喻", "裕", "芋"], // ü
    "van": ["元", "原", "园", "员", "缘", "源", "袁", "怨", "苑"], // üan
    "ve": ["月", "越", "悦", "乐", "阅", "岳", "粤", "跃"], // üe
    "vn": ["云", "运", "匀", "允", "陨", "孕", "韵", "耘"], // ün

    // ------------------------------
    // w 开头拼音
    "wa": ["瓦", "挖", "娃", "哇", "袜", "蛙", "洼"],
    "wai": ["外", "歪", "怀", "踝", "崴"],
    "wan": ["万", "晚", "完", "玩", "湾", "丸", "碗", "挽", "皖", "烷"],
    "wang": ["王", "望", "网", "忘", "汪", "旺", "枉", "惘", "往"],
    "wei": ["为", "位", "未", "微", "围", "伟", "味", "威", "卫", "违", "唯", "韦"],
    "wen": ["文", "问", "温", "稳", "闻", "纹", "吻", "紊", "瘟"],
    "weng": ["翁", "嗡", "瓮", "蓊"],
    "wo": ["我", "窝", "卧", "握", "沃", "蜗", "斡"],

    // ------------------------------
    // x 开头拼音
    "xi": ["西", "希", "喜", "系", "细", "习", "吸", "溪", "息", "惜", "析", "悉"],
    "xia": ["下", "夏", "吓", "虾", "霞", "侠", "峡", "暇", "辖", "瞎"],
    "xian": ["先", "现", "线", "显", "仙", "鲜", "闲", "险", "贤", "县", "献"],
    "xiang": ["想", "向", "香", "相", "象", "像", "祥", "乡", "厢", "镶"],
    "xiao": ["小", "笑", "消", "肖", "晓", "销", "效", "萧", "霄", "硝"],
    "xie": ["写", "谢", "些", "鞋", "斜", "解", "协", "屑", "卸", "泄"],
    "xin": ["心", "新", "信", "欣", "辛", "薪", "馨", "芯", "锌"],
    "xing": ["行", "星", "兴", "性", "姓", "刑", "形", "醒", "杏", "腥"],
    "xiong": ["熊", "胸", "雄", "凶", "汹", "匈"],
    "xiu": ["修", "休", "秀", "锈", "袖", "羞", "嗅", "宿"],
    "xu": ["许", "需", "徐", "续", "虚", "序", "绪", "旭", "叙", "恤"],
    "xuan": ["选", "宣", "旋", "悬", "炫", "眩", "轩", "喧", "萱"],
    "xue": ["学", "雪", "血", "薛", "穴", "靴", "削"],
    "xun": ["寻", "训", "讯", "迅", "勋", "熏", "循", "旬", "询"],

    // ------------------------------
    // y 开头拼音
    "ya": ["呀", "牙", "压", "鸭", "崖", "哑", "雅", "亚", "讶"],
    "yan": ["言", "眼", "沿", "严", "烟", "延", "盐", "研", "演", "验"],
    "yang": ["阳", "杨", "扬", "样", "养", "羊", "洋", "痒", "仰"],
    "yao": ["要", "摇", "药", "妖", "腰", "遥", "咬", "窑", "谣", "姚"],
    "ye": ["也", "叶", "业", "野", "爷", "页", "液", "冶", "椰"],
    "yi": ["一", "以", "已", "易", "医", "衣", "依", "议", "义", "意", "忆"],
    "yin": ["因", "银", "引", "饮", "印", "音", "阴", "隐", "尹", "吟"],
    "ying": ["应", "英", "影", "映", "硬", "营", "迎", "盈", "颖"],
    "yo": ["哟", "唷"],
    "yong": ["用", "永", "勇", "拥", "泳", "庸", "咏", "蛹", "恿"],
    "you": ["有", "又", "由", "油", "游", "友", "优", "忧", "悠", "幼"],
    "yu": ["于", "与", "语", "雨", "鱼", "玉", "余", "遇", "愈", "欲"],
    "yuan": ["元", "远", "院", "园", "愿", "源", "圆", "援", "缘"],
    "yue": ["月", "越", "乐", "悦", "岳", "阅", "约", "粤"],
    "yun": ["云", "运", "晕", "允", "韵", "匀", "孕", "耘", "蕴"],

    // ------------------------------
    // z 开头拼音
    "za": ["杂", "砸", "扎", "咋", "匝", "咂"],
    "zai": ["在", "再", "载", "栽", "灾", "宰", "崽"],
    "zan": ["赞", "暂", "咱", "簪", "攒", "昝"],
    "zang": ["脏", "藏", "葬", "赃", "奘"],
    "zao": ["早", "造", "遭", "澡", "枣", "灶", "燥", "躁", "皂"],
    "ze": ["则", "泽", "责", "择", "仄", "啧"],
    "zen": ["怎", "谮"],
    "zeng": ["增", "曾", "赠", "憎", "甑"],
    "zha": ["扎", "炸", "渣", "眨", "闸", "榨", "扎", "诈", "楂"],
    "zhai": ["摘", "宅", "窄", "债", "寨", "翟"],
    "zhan": ["站", "战", "展", "占", "沾", "盏", "斩", "瞻", "崭"],
    "zhang": ["张", "长", "章", "涨", "账", "仗", "障", "掌", "彰"],
    "zhao": ["照", "找", "招", "兆", "赵", "罩", "召", "沼", "肇"],
    "zhe": ["这", "着", "折", "哲", "遮", "浙", "辙", "蔗"],
    "zhen": ["真", "阵", "镇", "珍", "震", "诊", "枕", "斟", "臻"],
    "zheng": ["正", "整", "证", "争", "征", "挣", "睁", "政", "蒸"],
    "zhi": ["之", "只", "知", "直", "制", "智", "治", "指", "支", "纸"],
    "zhong": ["中", "种", "重", "众", "终", "钟", "忠", "肿", "仲"],
    "zhou": ["周", "州", "舟", "皱", "宙", "昼", "咒", "骤"],
    "zhu": ["主", "住", "朱", "珠", "煮", "助", "筑", "竹", "烛"],
    "zhua": ["抓", "爪", "挝"],
    "zhuai": ["拽", "跩"],
    "zhuan": ["转", "专", "传", "赚", "砖", "撰", "篆", "颛"],
    "zhuang": ["庄", "装", "壮", "状", "撞", "妆", "幢"],
    "zhui": ["追", "坠", "椎", "缀", "赘", "惴"],
    "zhun": ["准", "谆", "肫"],
    "zhuo": ["着", "捉", "桌", "浊", "茁", "灼", "酌", "啄"],
    "zi": ["子", "自", "字", "紫", "资", "姿", "兹", "滋", "籽"],
    "zong": ["总", "宗", "纵", "踪", "棕", "粽", "鬃"],
    "zou": ["走", "奏", "邹", "揍", "驺"],
    "zu": ["组", "祖", "族", "租", "足", "阻", "卒", "俎"],
    "zuan": ["钻", "纂", "攥", "缵"],
    "zui": ["最", "罪", "醉", "嘴", "催", "啐"],
    "zun": ["尊", "遵", "樽", "撙"],
    "zuo": ["做", "坐", "左", "作", "座", "昨", "佐", "柞"]
};
// 常用词组映射表,简化版
const PHRASE_DICT = {
    "nihao": ["你好", "您好", "您好呀"],
    "zainali": ["在哪里", "在那里", "在哪儿"],
    "xiexie": ["谢谢", "多谢", "感谢", "谢谢你"],
    "bukeqi": ["不客气", "没关系", "不谢", "没事儿"],
    "zaoshanghao": ["早上好", "早安", "早晨好"],
    "xiawuhao": ["下午好", "午后好"],
    "wanan": ["晚安", "晚上好", "安睡"],
    "qingwen": ["请问", "请问一下", "想请教"],
    "shijian": ["时间", "时候", "时光", "时刻"],
    "jintian": ["今天", "今日", "今儿"],
    "mingtian": ["明天", "明日", "明儿"],
    "zuotian": ["昨天", "昨日", "昨儿"],
    "zhidao": ["知道", "了解", "晓得", "知晓"],
    "buzhidao": ["不知道", "不晓得", "不清楚"],
    "henhao": ["很好", "非常好", "挺好", "不错"],
    "yidian": ["一点", "一些", "一点儿", "些许"],
    "meiyou": ["没有", "无", "没", "未曾"],
    "women": ["我们", "咱们", "我等"],
    "tamen": ["他们", "她们", "它们", "TA们"],
    "nimen": ["你们", "您二位", "你们几位"],
    "shenme": ["什么", "啥", "何物", "何事"],
    "zhende": ["真的", "确实", "的确", "果真"],
    "jiushi": ["就是", "即是", "正是", "便是"],
    "keyi": ["可以", "能够", "行", "准予"],
    "bukeyi": ["不可以", "不能", "不行", "不准"],
    "hao": ["好", "行", "可以", "不错", "真棒"],
    "buhao": ["不好", "不行", "差", "欠佳"],
    "dangran": ["当然", "自然", "肯定", "固然"],
    "feichang": ["非常", "很", "十分", "极其"],
    "hen": ["很", "非常", "十分", "特别"],
    "zaijian": ["再见", "再会", "拜拜", "下次见"],
    "dianhua": ["电话", "手机", "号码", "电话机"],
    "diqiu": ["地球", "世界", "环球", "大地"],
    "zhongguo": ["中国", "中华", "华夏", "神州"],
    "beijing": ["北京", "首都", "燕京", "北平"],
    "shanghai": ["上海", "申城", "沪上"],
    "guangzhou": ["广州", "羊城", "穗城"],
    "shenzhen": ["深圳", "鹏城"],
    "xuexiao": ["学校", "学堂", "校园", "院校"],
    "gongzuo": ["工作", "上班", "任务", "职业"],
    "xuesheng": ["学生", "学员", "学子", "门生"],
    "laoshi": ["老师", "教师", "教员", "导师"],
    "shujia": ["暑假", "假期", "暑期", "暑假如"],
    "dongjia": ["寒假", "冬假", "冬日假期"],
    "chifan": ["吃饭", "用餐", "进餐", "用膳"],
    "shuijiao": ["睡觉", "睡眠", "歇息", "安睡"],
    "xihuan": ["喜欢", "喜爱", "爱好", "钟爱"],
    "buxihuan": ["不喜欢", "讨厌", "厌恶", "反感"],
    "henkuai": ["很快", "快速", "迅速", "即刻"],
    "henduo": ["很多", "许多", "大量", "不少"],
    "henshao": ["很少", "少许", "不多", "寥寥"],
    "hendai": ["很大", "巨大", "庞大", "硕大"],
    "henxiao": ["很小", "微小", "细小", "渺小"],
    "hengao": ["很高", "高大", "崇高", "魁梧"],
    "hendi": ["很低", "低矮", "低下", "低洼"],
    "henkuan": ["很宽", "宽阔", "宽广", "宽敞"],
    "henzhai": ["很窄", "狭窄", "狭小", "窄小"],
    "henzhang": ["很长", "长久", "漫长", "悠久"],
    "henduan": ["很短", "短暂", "短促", "片刻"],
    "henzhong": ["很重", "沉重", "繁重", "笨重"],
    "henqing": ["很轻", "轻松", "轻盈", "轻快"],
    "hennuan": ["很暖", "温暖", "暖和", "和煦"],
    "henleng": ["很冷", "寒冷", "冰冷", "严寒"],
    "henre": ["很热", "炎热", "酷热", "炙热"],
    "henliang": ["很亮", "明亮", "光亮", "光明"],
    "henan": ["很难", "困难", "艰难", "不易"],
    "henrongyi": ["很容易", "容易", "简单", "轻而易举"],
    "meitian": ["每天", "天天", "每日", "日日"],
    "meizhou": ["每周", "每星期", "礼拜", "每礼拜"],
    "meiyue": ["每月", "每个月", "月份", "月月"],
    "meinian": ["每年", "每一年", "年度", "年年"],
    "jinian": ["今年", "本年度", "现年", "今朝"],
    "qunian": ["去年", "上一年", "旧年", "去岁"],
    "xiayinian": ["明年", "下一年", "来年", "明年"],
    "zaoshang": ["早上", "早晨", "上午", "清晨"],
    "xiawu": ["下午", "午后", "下昼"],
    "wanshang": ["晚上", "夜晚", "晚间", "夜里"],
    "zhongwu": ["中午", "正午", "晌午", "午间"],
    "bangwan": ["傍晚", "黄昏", "日暮", "薄暮"],
    "yejian": ["夜间", "夜里", "晚上", "入夜"],
    "zhouyi": ["周一", "星期一", "礼拜一"],
    "zhouer": ["周二", "星期二", "礼拜二"],
    "zhousan": ["周三", "星期三", "礼拜三"],
    "zhousi": ["周四", "星期四", "礼拜四"],
    "zhouwu": ["周五", "星期五", "礼拜五"],
    "zhouliu": ["周六", "星期六", "礼拜六"],
    "zhouri": ["周日", "星期日", "星期天", "礼拜天"],
    "yige": ["一个", "某个", "某一个", "一桩"],
    "liangge": ["两个", "俩", "一对", "一双"],
    "sange": ["三个", "仨", "三项", "三件"],
    // 新增常用词语
    "xuexi": ["学习", "研习", "求学", "攻读"],
    "gongzuo": ["工作", "上班", "任职", "履职"],
    "shangban": ["上班", "工作", "出勤", "到岗"],
    "xiaban": ["下班", "收工", "离岗", "放工"],
    "pengyou": ["朋友", "友人", "好友", "伙伴"],
    "jiaren": ["家人", "亲属", "亲人", "家属"],
    "tongxue": ["同学", "同窗", "学友", "校友"],
    "bangzhu": ["帮助", "帮忙", "协助", "援助"],
    "buyongxie": ["不用谢", "不客气", "应该的", "没事儿"],
    "meiguanxi": ["没关系", "没事儿", "不碍事", "不要紧"],
    "duibuqi": ["对不起", "抱歉", "不好意思", "致歉"],
    "weishenme": ["为什么", "为何", "何以", "为啥"],
    "zenmeban": ["怎么办", "如何是好", "咋办", "怎办"],
    "shibushi": ["是不是", "对不对", "是不是呀", "是否"],
    "youmeiyou": ["有没有", "是否有", "有无", "有没有呢"],
    "henhao": ["很好", "很棒", "不错", "优秀"],
    "piaoliang": ["漂亮", "美丽", "好看", "靓丽"],
    "kaixin": ["开心", "高兴", "快乐", "愉快"],
    "nanguo": ["难过", "伤心", "难受", "不快"],
    "shengqi": ["生气", "发怒", "恼火", "气愤"],
    "gaoxing": ["高兴", "开心", "快乐", "喜悦"],
    "meili": ["美丽", "漂亮", "好看", "靓丽"],
    "congming": ["聪明", "聪慧", "机灵", "伶俐"],
    "nuli": ["努力", "勤奋", "刻苦", "发奋"],
    "renzhen": ["认真", "仔细", "专注", "用心"],
    "zixi": ["仔细", "认真", "细致", "详尽"],
    "kuaisu": ["快速", "迅速", "快捷", "火速"],
    "huanman": ["缓慢", "迟缓", "慢条斯理", "慢悠悠"],
    "zhengque": ["正确", "对的", "准确", "无误"],
    "cuowu": ["错误", "错的", "谬误", "差错"],
    "jiandan": ["简单", "容易", "简便", "简洁"],
    "fuzha": ["复杂", "繁杂", "繁复", "错综复杂"],
    "yinwei": ["因为", "由于", "起因", "缘于"],
    "suoyi": ["所以", "因此", "因而", "故而"],
    "danshi": ["但是", "可是", "然而", "不过"],
    "erqie": ["而且", "并且", "况且", "再说"],
    "huozhe": ["或者", "或是", "要么", "抑或"],
    "keneng": ["可能", "或许", "也许", "大概"],
    "yiding": ["一定", "必定", "必然", "肯定"],
    "bixu": ["必须", "必需", "务必", "非得"],
    "yinggai": ["应该", "应当", "理应", "该当"],
    "xuyao": ["需要", "须要", "需求", "必要"],
    "xiangyao": ["想要", "希望", "渴望", "巴不得"],
    "renshi": ["认识", "相识", "认知", "认得"],
    "mingbai": ["明白", "清楚", "理解", "知晓"],
    "qingchu": ["清楚", "明白", "清晰", "明晰"],
    "diannao": ["电脑", "计算机", "微机", "PC机"],
    "shouji": ["手机", "电话机", "移动电话", "智能机"],
    "wangluo": ["网络", "互联网", "网际网路", "联机"],
    "tianqi": ["天气", "气象", "气候", "天候"],
    "xianzai": ["现在", "此刻", "目前", "当下"],
    "guoqu": ["过去", "以往", "从前", "往昔"],
    "weilai": ["未来", "将来", "今后", "来日"],
    "xihuan": ["喜欢", "喜爱", "钟爱", "喜好"],
    "taoyan": ["讨厌", "厌恶", "反感", "憎恶"],
    "kanshu": ["看书", "阅读", "念书", "读书"],
    "xiezi": ["写字", "书写", "动笔", "练字"],
    "shuohua": ["说话", "讲话", "发言", "交谈"],
    "tingyinle": ["听音乐", "欣赏音乐", "听乐曲", "听歌"],
    "kandianshi": ["看电视", "看电视机", "观赏电视", "看电视节目"],
    "dadianhua": ["打电话", "拨电话", "打电话给", "致电"],
    "kaihui": ["开会", "召开会议", "开会讨论", "集会"],
    "shangke": ["上课", "授课", "听课", "上课学习"],
    "xiake": ["下课", "课程结束", "放学", "下堂"],
    "yiyuan": ["医院", "医疗机构", "病院", "诊疗所"],
    "shangdian": ["商店", "店铺", "商场", "商铺"],
    "gongyuan": ["公园", "园林", "公园绿地", "游园"],
    "malu": ["马路", "公路", "街道", "道路"],
    "qiche": ["汽车", "轿车", "车辆", "机动车"],
    "huoche": ["火车", "列车", "铁道车", "动车"],
    "feiji": ["飞机", "航空器", "客机", "飞行器"],
    "bukeneng": ["不可能", "没可能", "绝不会", "万万不可"],
    "bixu": ["必须", "必需", "务必", "一定要"],
    "xuyao": ["需要", "须要", "需求", "必要"],
    "yinggai": ["应该", "应当", "理应", "该当"],
    // 食物相关
    "haochi": ["好吃", "美味", "可口", "好吃的"],
    "nanchi": ["难吃", "不好吃", "没味道", "难以下咽"],
    "fancai": ["饭菜", "菜肴", "菜品", "膳食"],
    "mifan": ["米饭", "白饭", "主食", "米饭粒"],
    "mianbao": ["面包", "吐司", "面包含", "面包片"],
    "shuiguo": ["水果", "鲜果", "果品", "瓜果"],
    "caiyuan": ["菜园", "菜地", "蔬菜园", "菜田"],
    "tangshui": ["糖水", "甜汤", "甜品", "甜水"],
    "doujiang": ["豆浆", "豆乳", "豆浆饮品", "鲜豆浆"],

    // 交通出行
    "gongjiaoche": ["公交车", "公交", "公共汽车", "巴士"],
    "ditie": ["地铁", "地下铁", "地铁线", "地铁站"],
    "zuoche": ["坐车", "乘车", "搭车", "乘车出行"],
    "xingli": ["行李", "行囊", "包裹", "行装"],
    "chepiao": ["车票", "车票", "票券", "乘车票"],
    "zhantian": ["站台", "月台", "车站站台", "候车台"],
    "tingchechang": ["停车场", "停车区", "泊车区", "车位"],

    // 情感与状态
    "beishang": ["悲伤", "难过", "伤心", "哀伤"],
    "jingxi": ["惊喜", "意外惊喜", "吃惊又高兴", "惊喜不已"],
    "fennu": ["愤怒", "气愤", "发怒", "怒火"],
    "jinghuang": ["惊慌", "慌张", "慌乱", "惊惶"],
    "anshin": ["安心", "放心", "踏实", "安心下来"],
    "kunnao": ["困扰", "烦恼", "苦恼", "困扰不已"],
    "xingfen": ["兴奋", "激动", "兴高采烈", "亢奋"],

    // 动作与行为
    "paobu": ["跑步", "慢跑", "快跑", "跑步锻炼"],
    "tiaowu": ["跳舞", "舞蹈", "跳舞蹈", "跳舞表演"],
    "changge": ["唱歌", "歌唱", "唱歌儿", "演唱"],
    "dushu": ["读书", "看书", "阅读", "念书"],
    "xiezuoye": ["写作业", "做作业", "写功课", "做功课"],
    "daqiu": ["打球", "打球运动", "玩球", "球类运动"],
    "saohuo": ["扫地", "打扫", "清扫地面", "扫地清洁"],
    "xishou": ["洗手", "清洁手", "洗手消毒", "洗手手"],

    // 物品与工具
    "shoubiao": ["手表", "腕表", "手表带", "电子表"],
    "qianbao": ["钱包", "钱夹", "皮夹", "钱包袋"],
    "shuibei": ["水杯", "杯子", "水瓶", "饮水杯"],
    "mianjin": ["毛巾", "面巾", "洗脸巾", "毛巾布"],
    "diannao": ["电脑", "计算机", "笔记本电脑", "台式机"],
    "shouji": ["手机", "智能手机", "移动电话", "手机设备"],
    "zidongche": ["自行车", "单车", "脚踏车", "自行车儿"],
    "dianshi": ["电视", "电视机", "电视节目", "电视屏幕"],

    // 地点与场所
    "tushuguan": ["图书馆", "图书室", "图书馆里", "借书处"],
    "yinhang": ["银行", "银行柜台", "银行网点", "储蓄所"],
    "yiyuan": ["医院", "医院门诊", "医疗机构", "住院部"],
    "binguan": ["宾馆", "酒店", "旅馆", "住宿宾馆"],
    "shangchang": ["商场", "购物中心", "商场里", "百货商场"],
    "gongyuan": ["公园", "公园绿地", "游乐园", "公园景点"],
    "xuexiao": ["学校", "校园", "学堂", "院校"],  // 原有保留,补充场景
    "jiao shi": ["教室", "课堂", "教室里", "授课室"],

    // 职业与身份
    "yisheng": ["医生", "医师", "大夫", "医务工作者"],
    "nushi": ["护士", "护理人员", "护士小姐", "护师"],
    "gongren": ["工人", "职工", "劳动者", "产业工人"],
    "shangren": ["商人", "生意人", "商户", "商贩"],
    "jingcha": ["警察", "警官", "警员", "公安干警"],
    "jiaoshi": ["教师", "老师", "教员", "教书先生"],  // 与原有"laoshi"互补

    // 学习与工作
    "zuoye": ["作业", "功课", "练习题", "课后作业"],
    "kaoshi": ["考试", "测验", "考核", "考试卷"],
    "fudao": ["辅导", "指导", "辅导学习", "补课"],
    "huiyi": ["会议", "开会", "讨论会", "会议记录"],
    "baogao": ["报告", "汇报", "报告书", "汇报材料"],
    "gongzuoanpai": ["工作计划", "工作安排", "任务安排", "工作部署"],
    "xiuxi": ["休息", "歇息", "休整", "休息时间"],

    // 时间与天气
    "qingtian": ["晴天", "晴朗", "晴空", "晴天万里"],
    "xiayu": ["下雨", "降雨", "下雨了", "雨天"],
    "xiaxue": ["下雪", "降雪", "下雪了", "雪天"],
    "fengda": ["风大", "刮风", "大风", "风力大"],
    "retian": ["热天", "炎热天气", "高温天", "酷暑"],
    "lengtian": ["冷天", "寒冷天气", "低温天", "严寒"],
    "zhongwu": ["中午", "正午", "晌午", "午间"],  // 原有保留,补充表达
    "shenye": ["深夜", "夜里", "半夜", "深夜时分"],

    // 人际与社交
    "hao pengyou": ["好朋友", "挚友", "好友", "知心朋友"],
    "lianxi": ["联系", "联络", "保持联系", "联系一下"],
    "yaoqing": ["邀请", "邀约", "请客", "邀请参加"],
    "jiaowang": ["交往", "来往", "相处", "社交往来"],
    "hezuo": ["合作", "协作", "配合", "共同合作"],
    "dajia": ["大家", "大伙儿", "各位", "所有人"],
    "gewei": ["各位", "诸位", "大家", "各位朋友"],

    // 状态与程度
    "henkuai": ["很快", "迅速", "即刻", "马上"],  // 原有保留,补充场景
    "henman": ["很慢", "迟缓", "慢悠悠", "慢腾腾"],
    "henduo": ["很多", "许多", "大量", "不少"],  // 原有保留,扩展
    "henshao": ["很少", "稀少", "寥寥无几", "不多"],
    "feichanghao": ["非常好", "特别好", "好极了", "棒极了"],
    "henbuhao": ["很不好", "非常差", "糟糕", "不怎么样"],
    "manmanlai": ["慢慢来", "别急", "一步一步来", "慢慢做"],

    // 疑问与回应
    "zenmele": ["怎么了", "出什么事了", "怎么啦", "有什么事"],
    "zenmeban": ["怎么办", "如何是好", "咋办", "怎办"],  // 原有保留,补充
    "haoma": ["好吗", "可以吗", "行不", "好不好"],
    "xingbuxing": ["行不行", "可以吗", "能行吗", "成不成"],
    "keyima": ["可以吗", "行不行", "能允许吗", "是否可以"],
    "wenti": ["问题", "疑问", "难题", "问题所在"],
    "jiejue": ["解决", "处理", "搞定", "解决问题"],

    // 日常琐事
    "chifan": ["吃饭", "用餐", "进餐", "用膳"],  // 原有保留,场景扩展
    "shuijiao": ["睡觉", "入眠", "安睡", "睡覺"],  // 原有保留
    "xizao": ["洗澡", "沐浴", "冲澡", "洗淋浴"],
    "chuqu": ["出去", "外出", "出去一下", "出门"],
    "huilai": ["回来", "返回", "回来啦", "回到家"],
    "maidongxi": ["买东西", "购物", "买物品", "采购"],
    "shangjie": ["上街", "逛街", "去街上", "逛街购物"]
};

// 拼音转中文主函数
function pinyinOrLetterTurnChinese(val) {
    if (!val) return "";

    // 首先检查是否是完整拼音词组
    if (PHRASE_DICT[val]) {
        return PHRASE_DICT[val].join('');
    }

    // 检查是否是单个拼音
    if (PINYIN_DICT[val]) {
        return PINYIN_DICT[val].join('');
    }

    // 尝试分词处理
    const result = segmentPinyin(val);
    if (result) {
        return result;
    }

    // 如果都不是,返回原输入(可能是字母或其他字符)
    return val;
    //    return "";
}

function pinyinOrLetterTurnChinese(val) {
    if (!val) return [];
    // 首先检查是否是完整拼音词组
    if (PHRASE_DICT[val]) {
        return PHRASE_DICT[val]; // 返回数组
    }

    // 检查是否是单个拼音
    if (PINYIN_DICT[val]) {
        return PINYIN_DICT[val]; // 返回数组
    }

    // 尝试分词处理
    const result = segmentPinyin(val);
    if (result) {
        return result; // 假设 segmentPinyin 返回数组
    }

    // 返回单字符数组
    return [val]; // 兜底为数组
}
// 拼音分词函数
function segmentPinyin(pinyin) {
    if (!pinyin) return '';

    var result = '';
    var i = 0;

    while (i < pinyin.length) {
        // 尝试匹配最长拼音
        var maxMatch = '';
        for (var j = pinyin.length; j > i; j--) {
            const substring = pinyin.substring(i, j);
            if (PINYIN_DICT[substring]) {
                maxMatch = substring;
                break;
            }
        }

        if (maxMatch) {
            // 找到匹配的拼音,添加第一个候选汉字
            result += PINYIN_DICT[maxMatch][0];
            i += maxMatch.length;
        } else {
            // 未找到匹配,添加原字符
            result += pinyin[i];
            i++;
        }
    }

    return result;
}

//英文状态不展示 缓冲区   ,中文状态 当 textBuffer 不为空的时候 展示 缓冲区
function isEnglistAndChooseData(isEnglish,textBuffer){
    if(isEnglish){
        return false
    }else{
        if(!isEnglish){
            if(textBuffer===null){
                return false
            }else{
                return true
            }
        }

    }
}
// 示例用法
//console.log(pinyinOrLetterTurnChinese("nihao")); // 输出: 你好
//console.log(pinyinOrLetterTurnChinese("xiexie")); // 输出: 谢谢
//console.log(pinyinOrLetterTurnChinese("wo")); // 输出: 我
//console.log(pinyinOrLetterTurnChinese("henhao")); // 输出: 很好
//console.log(pinyinOrLetterTurnChinese("abc")); // 输出: abc(原样返回)
//console.log(pinyinOrLetterTurnChinese("women")); // 输出: 我们
//console.log(pinyinOrLetterTurnChinese("")); // 输出: ""

使用方式

在任意 qml 页面 加入后 keyboard 控制显示隐藏

    KeyBoard{
        id:keyboard
        anchors.bottom: parent.bottom //底部展示
        //        anchors.top: parent.top //顶部展示
        width:parent.width
        //        width:parent.width - 100
        anchors.horizontalCenter: parent.horizontalCenter  // ✅ 水平居中
        visible: false
    }

网站公告

今日签到

点亮在社区的每一天
去签到