Universal voice instruction distribution method, electronic equipment and computer readable storage medium
By defining unified entity classes and interfaces, using dynamic proxy and reflection technology to convert semantic callback instructions of different voice engines into unified parameters, the problem of high R&D costs caused by different voice engine APIs in the existing technology is solved, and the problem of different voice engines is achieved The voice command distribution and processing of the voice engine improves development efficiency.
Patent Information
- Application Number
- CN202411037138.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-07-31
AI Technical Summary
The different APIs of existing voice engines lead to the need to reprocess instructions when replacing voice engines, which increases R&D costs and coupling, and affects the development efficiency of vehicle functions.
Define a unified entity class and interface, convert semantic callback instructions of different voice engines into unified parameters through dynamic proxy and reflection, realize voice command distribution and processing of different voice engines, and flexibly access the API of the new engine.
It reduces the R&D cost when replacing the voice engine, improves the development efficiency, and realizes the distribution and processing of voice commands for different voice engines, and hardly affects the processing logic of vehicle commands.
Smart Images

Figure CN119091907A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of voice commands, and in particular relates to a universal voice command distribution method, an electronic device and a computer-readable storage medium. Background Art
[0002] With the development of vehicle technology, more and more vehicles are equipped with in-vehicle terminals, and users can interact with the in-vehicle terminals while driving. In order to provide a better driving experience, voice control functions on vehicles have become a must-have option, the proportion of voice interaction is increasing, and various voice engines are also increasing day by day.
[0003] Each speech recognition engine has its own set of APIs, or application programming interfaces, which results in different semantic formats and methods for each speech recognition engine to return after recognizing speech. When developing subsequent functions, the vehicle R&D team can only perform corresponding instruction processing based on the API provided by the vehicle itself, that is, perform subsequent development based on the semantic format and method returned by the API. The coupling is relatively tight, which means that if the speech engine is replaced, another set of instruction processing needs to be performed based on the API of the replaced speech engine, increasing the R&D cost. Summary of the invention
[0004] In order to solve the above deficiencies in the known technology, the present invention aims to provide a universal voice command distribution method.
[0005] To achieve the above purpose, the technical solution adopted by the present invention is as follows: A general voice command distribution method, the method comprising the following steps performed in sequence: S1. Define the entity class and define the entity class as an interface; Define all parameter variables required by all semantic callback instructions in the entity class, including the parameter variable domain used to determine the semantic callback instruction type and the parameter variable action used to determine the semantic callback instruction method; S2. Classify and define all semantic callback instructions in the form of interfaces to obtain the types of all semantic callback instructions, that is, obtain all callback interfaces and the semantic callback instruction methods contained in each callback interface; all the callback interfaces are inherited by the entity class and finally implemented as a unified parameter VoiceBeanImpl, which is finally passed to the semantic callback instruction method; Define the annotation VoiceArea for modifying the callback interface; define the annotation CallBackMethod for modifying the semantic callback instruction method, and define the parameter ActionName to determine the semantic callback instruction method to be executed; Defining a semantic executor interface, wherein the semantic executor interface is inherited by the callback interface; S3. Connect to the voice engine to implement the voice engine API, convert the returned semantic callback instruction into a unified entity class, assign values to the parameter variables domain and action according to the type of the semantic callback instruction, and pass it into the semantic executor interface through the unified parameter VoiceBeanImpl; S4, instantiate the semantic executor interface through dynamic proxy; S5. The instantiated semantic executor interface obtains the callback interface modified by the annotation, the semantic callback instruction method, and the unified parameter VoiceBeanImpl of the semantic callback instruction method through reflection; S6. Match the parameter variables domain and action in the unified parameter VoiceBeanImpl with the callback interface modified by the VoiceArea annotation and the parameter actionName of the annotation CallBackMethod. The unified parameter VoiceBeanImpl returns a Boolean value to determine whether to execute a semantic callback. If it is determined to be a callback, continue to execute the matched callback semantic instruction; otherwise, it prompts that this command is not supported.
[0006] As a limitation, the unified parameter VoiceBeanImpl is passed into the semantic callback instruction method that requires parameters, and the unified parameter VoiceBeanImpl is received by an external application that processes the semantic callback instruction.
[0007] As a second limitation, the entity class, all callback interfaces and semantic executor interfaces all exist in the form of background services.
[0008] As a third limitation, the specific process of instantiating the semantic executor interface through the dynamic proxy in step S4 is: Get the callback instance from the semantic execution project through AIDL; The semantic executor interface is instantiated through dynamic proxy, and then the obtained callback instance is passed to the semantic executor interface.
[0009] As a fourth limitation, the semantic execution project includes registered semantic execution instructions for vehicle cockpit, map navigation, music and multimedia applications, system settings and air conditioning.
[0010] Another object of the present invention is to provide an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of a general voice instruction distribution method when executing the computer program.
[0011] Another object of the present invention is to provide a storage medium having a computer program stored thereon, which implements the steps of a general voice instruction distribution method when executed by a processor.
[0012] Due to the adoption of the above technical solution, the present invention has the following beneficial effects compared with the prior art: (1) The method of the present invention can realize the distribution and processing of voice commands of different voice engines by converting the semantics returned by different voice engines into a unified entity class and assigning values to parameter variables for determining the type of semantic callback instructions and parameter variables for determining the method of semantic callback instructions according to the semantic classification; (2) The method of the present invention can flexibly access the API of the new engine without affecting the processing logic of the vehicle command, thereby improving R&D efficiency and reducing R&D costs.
[0013] In summary, when the voice engine is replaced, the present invention can flexibly access the API of the new engine to achieve distribution and processing of voice commands of different voice engines, thereby reducing R&D costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0015] Figure 1 This is a flow chart of the method after connecting to an external voice engine according to Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0016] In order to better explain the present invention and facilitate understanding, the preferred embodiments of the present invention are described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0017] Example 1 General voice command distribution method like Figure 1 As shown, this embodiment provides a general voice command distribution method, which includes the following steps performed in sequence: S1. Define the entity class IVoiceBean and define the entity class IVoiceBean as an interface. Define all parameter variables required by all semantic callback instructions in the entity class, including the parameter variable domain used to determine the semantic callback instruction type and the parameter variable action used to determine the semantic callback instruction method.
[0018] Among them, all semantic callback commands include commands for vehicle cabin, map navigation, music and multimedia applications, system settings and air conditioning, etc.
[0019] S2. Classify and define all semantic callback instructions in the form of interfaces to obtain the types of all semantic callback instructions, that is, obtain all callback interfaces and the semantic callback instruction methods contained in each callback interface.
[0020] The types of semantic callback instructions include vehicle cabin, map navigation, music and multimedia applications, system settings and air conditioning, etc. Each semantic callback instruction type includes multiple semantic callback instruction methods. For example, the control semantics for air conditioning include: "Turn on the air conditioning", "Turn off the air conditioning", "Adjust the air conditioning temperature to 26℃" and other semantic callback instruction methods.
[0021] All callback interfaces are inherited by the entity class and finally implemented as a unified parameter VoiceBeanImpl, which is finally passed to the semantic callback instruction method as a unified parameter. The unified parameter VoiceBeanImpl is passed into the semantic callback instruction method that requires parameters, and the unified parameter VoiceBeanImpl is received by the external application that processes the semantic callback instruction. For example, the instruction "adjust the air conditioning temperature to 26℃" has a numerical parameter "26℃", so it is a semantic callback instruction that requires parameters, while similar instructions such as "turn on the air conditioning" and "turn off the air conditioning" are semantic callback instructions that do not require parameters. The external applications here refer to vehicle-mounted applications such as vehicle cockpit, map navigation, music and multimedia applications, system settings, and air conditioning.
[0022] Define the annotation VoiceArea that modifies the callback interface; define the annotation CallBackMethod that modifies the semantic callback instruction method, and define the parameter ActionName to determine the semantic callback instruction method to be executed.
[0023] Define the semantic executor interface, which is inherited by the callback interface for use by dynamic proxy and reflection in subsequent steps.
[0024] S3. Connect to the voice engine to implement the voice engine API, convert the returned semantic callback instruction into a unified entity class, assign values to the parameter variables domain and action according to the type of the semantic callback instruction, and pass it into the semantic executor interface through the unified parameter VoiceBeanImpl.
[0025] S4. Instantiate the semantic executor interface through dynamic proxy. The specific process is as follows: Get the callback instance from the semantic execution project through AIDL (Android Interface Definition Language), instantiate the semantic executor interface through dynamic proxy, and then pass the obtained instance to the semantic executor interface.
[0026] Among them, the semantic execution projects include registered semantic execution instructions for vehicle cabin, map navigation, music and multimedia applications, system settings and air conditioning.
[0027] S5, the instantiated semantic executor interface obtains the callback interface modified by the annotation, the semantic callback instruction method, and the unified parameter VoiceBeanImpl of the semantic callback instruction method through reflection; S6. Match the parameter variables domain and action in the unified parameter VoiceBeanImpl with the callback interface modified by the VoiceArea annotation and the parameter actionName of the annotation CallBackMethod. The unified parameter VoiceBeanImpl returns a Boolean value, that is, returns "0" or "1", to determine whether to execute the semantic callback; if it is determined to be a callback, continue to execute the matched callback semantic instruction; if it is determined not to be a callback, prompt that this command is not supported.
[0028] The entity class IVoiceBean, all callback interfaces and semantic executor interfaces in this embodiment exist in the form of background services.
[0029] Example 2 Universal voice command distribution electronic device and computer readable storage medium The electronic device in this embodiment is a computer device, which mainly includes one or more processors and a memory. This embodiment takes one processor as an example.
[0030] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips. A general-purpose processor may be a microprocessor or any conventional processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of the general voice instruction distribution method in Example 1 may be implemented.
[0031] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the steps of the general voice instruction distribution method of Example 1. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable storage medium includes: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
Claims
1. A general voice command distribution method, characterized in that: The method comprises the following steps performed in sequence: S1. Define the entity class and define the entity class as an interface; Define all parameter variables required by all semantic callback instructions in the entity class, including the parameter variable domain used to determine the semantic callback instruction type and the parameter variable action used to determine the semantic callback instruction method; S2. Classify and define all semantic callback instructions in the form of interfaces to obtain the types of all semantic callback instructions, that is, obtain all callback interfaces and the semantic callback instruction methods contained in each callback interface; All the callback interfaces are inherited by the entity class and finally implemented as a unified parameter VoiceBeanImpl, which is finally passed to the semantic callback instruction method as a unified parameter; Define the annotation VoiceArea for modifying the callback interface; define the annotation CallBackMethod for modifying the semantic callback instruction method, and define the parameter ActionName to determine the semantic callback instruction method to be executed; Defining a semantic executor interface, wherein the semantic executor interface is inherited by the callback interface; S3. Connect to the voice engine to implement the voice engine API, convert the returned semantic callback instruction into a unified entity class, assign values to the parameter variables domain and action according to the type of the semantic callback instruction, and pass it into the semantic executor interface through the unified parameter VoiceBeanImpl; S4, instantiate the semantic executor interface through dynamic proxy; S5. The instantiated semantic executor interface obtains the callback interface modified by the annotation, the semantic callback instruction method, and the unified parameter VoiceBeanImpl of the semantic callback instruction method through reflection; S6. Match the parameter variables domain and action in the unified parameter VoiceBeanImpl with the callback interface modified by the VoiceArea annotation and the parameter actionName of the annotation CallBackMethod. The unified parameter VoiceBeanImpl returns a Boolean value to determine whether to execute a semantic callback. If it is determined to be a callback, continue to execute the matched callback semantic instruction; otherwise, it prompts that this command is not supported.
2. The universal voice command distribution method according to claim 1, characterized in that: The unified parameter VoiceBeanImpl is passed into the semantic callback instruction method that requires parameters, and the unified parameter VoiceBeanImpl is received by the external application that processes the semantic callback instruction.
3. The universal voice command distribution method according to claim 2, characterized in that: The entity class, all callback interfaces and semantic executor interfaces all exist in the form of background services.
4. The universal voice command distribution method according to any one of claims 1 to 3, characterized in that: The specific process of instantiating the semantic executor interface through the dynamic proxy in step S4 is: Get the callback instance from the semantic execution project through AIDL; The semantic executor interface is instantiated through dynamic proxy, and then the obtained callback instance is passed to the semantic executor interface.
5. The universal voice command distribution method according to claim 4, characterized in that: The semantic execution projects include registered semantic execution instructions for vehicle cockpit, map navigation, music and multimedia applications, system settings and air conditioning.
6. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the method described in any one of claims 1 to 5 when executing the computer program.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Voice interaction method and device of application program, equipment and medium
CN110647305A
Voice processing method and device and distributed system
CN111833857A
Control method, device and system supporting multi-manufacturer voice engine access application
CN117376426A
Conversational networking via transport, coding and control conversational protocols
US20020184373A1
Generating compilable machine code programs from dynamic language code
US20210303283A1
