Speech recognition method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202310189364.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-03-01
AI Technical Summary
[0005]本申请实施例提供了一种语音识别方法、存储介质及电子装置,以至少解决相关技术中对待识别语音的语义识别准确度差的技术问题
[0024]在本发明实施例中,采用获取待识别语音和环境参数;基于环境参数对待识别语音进行筛选,得到目标语音;利用预设识别模型和预设语音库,对目标语音包含的文本进行识别,得到待识别语音的语义识别结果的方式,通过先获取输出待识别语音的用户所处环境的环境参数,从待识别语音中筛选出需要进行识别的目标语音,能够避免出现对无效语音误识别的问题,在筛选出目标语音之后,进一步的利用预设识别模型对目标语音的文本内容进行语义识别,并将识别结果与预设语音库进行匹配,确定出待识别语音的语义识别结果,从而提高语义识别结果的准确度,进而解决相关技术中对待识别语音的语义识别准确度差的技术问题。
Smart Images

Figure CN116389179B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart homes, and more specifically, to a voice recognition method, storage medium, and electronic device. Background Technology
[0002] Currently, in human-computer interaction, such as smart home applications, the main method used is rule matching to identify and execute user commands. For example, by constructing some matching rules, the voice commands issued by the user are matched and recognized, and then the recognized commands are executed.
[0003] However, this method restricts language rules, and users can only operate home appliances through specified instructions. Home appliances also cannot semantically interpret the user's voice with the same meaning and instructions, resulting in poor semantic recognition accuracy.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a speech recognition method, storage medium, and electronic device to at least solve the technical problem of poor semantic recognition accuracy of speech to be recognized in related technologies.
[0006] According to one aspect of the embodiments of this application, a speech recognition method is provided, comprising: acquiring speech to be recognized and environmental parameters, wherein the environmental parameters are parameters of the environment in which the user outputs the speech to be recognized is located; filtering the speech to be recognized based on the environmental parameters to obtain target speech; and recognizing the text contained in the target speech using a preset recognition model and a preset speech library to obtain a semantic recognition result of the speech to be recognized.
[0007] Optionally, the speech to be recognized is filtered based on environmental parameters to obtain target speech, including: constructing speech filtering conditions based on environmental parameters; and filtering the speech to be recognized based on the speech filtering conditions to obtain target speech.
[0008] Optionally, constructing speech filtering conditions based on environmental parameters includes: obtaining weather parameters and temperature parameters from the environmental parameters; determining the type and number of texts to be filtered based on the weather parameters and temperature parameters, wherein the type and number of texts to be filtered are used to characterize the type and number of texts contained in the target speech; and constructing speech filtering conditions based on the type and number of texts to be filtered.
[0009] Optionally, the text contained in the target speech is identified using a preset recognition model and a preset speech library to obtain the semantic recognition result of the speech to be recognized, including: performing semantic recognition on the target speech using the preset recognition model to obtain a first recognition vector; filtering a second recognition vector from the preset speech library based on a preset index framework; and determining the semantic result corresponding to the second recognition vector as the semantic recognition result in response to the matching of the first recognition vector and the second recognition vector.
[0010] Optionally, semantic recognition of the target speech is performed using a preset recognition model to obtain a first recognition vector, including: extracting attribute features and text content of the target speech; vectorizing the text content using the preset recognition model and attribute features to obtain a semantic recognition vector; and embedding the semantic recognition vector based on preset fixed parameters to obtain the first recognition vector.
[0011] Optionally, the text content is vectorized using a preset recognition model and attribute features to obtain a semantic recognition vector, including: splitting the text content based on attribute features to obtain multiple texts to be recognized; encoding the multiple texts to be recognized to obtain multiple encoded texts; processing the multiple encoded texts using a first weight matrix to obtain multiple attention values corresponding to the multiple encoded texts; and processing the target attention value based on a second weight matrix to obtain a semantic recognition vector, wherein the target attention value is a value obtained by concatenating multiple attention values.
[0012] Optionally, the second recognition vector is selected from a preset speech library based on a preset index framework, including: obtaining data features of multiple semantic vectors stored in the preset speech library; exponentially decaying the number of multiple semantic vectors to obtain the number of index layers; generating an index graph based on the hierarchical relationship of the data features, the multiple semantic vectors, and the number of index layers, wherein different index layers in the index graph contain different index semantic vectors, and the index semantic vectors are vectors obtained by dividing multiple semantic vectors using hierarchical relationships; and determining the second recognition vector from the index semantic vectors in the index graph based on the hierarchical relationship of the index graph.
[0013] Optionally, the method further includes: acquiring sample attribute features and sample text content of sample speech; processing the sample attribute features and sample text content using a preset recognition model to obtain a sample recognition vector; embedding the sample recognition vector based on preset fixed parameters to obtain a second recognition vector; and storing the second recognition vector according to a preset storage format to obtain a preset speech library.
[0014] According to one aspect of the embodiments of this application, a speech recognition device is also provided, comprising: an acquisition module for acquiring speech to be recognized and environmental parameters, wherein the environmental parameters are parameters of the environment in which the user outputs the speech to be recognized is located; a filtering module for filtering the speech to be recognized based on the environmental parameters to obtain target speech; and a recognition module for recognizing the text contained in the target speech using a preset recognition model and a preset speech library to obtain a semantic recognition result of the speech to be recognized.
[0015] Optionally, the filtering module includes: a condition construction unit for constructing speech filtering conditions based on environmental parameters; and a speech filtering unit for filtering the speech to be recognized based on the speech filtering conditions to obtain the target speech.
[0016] Optionally, the condition construction unit includes: a parameter acquisition subunit for acquiring weather parameters and temperature parameters from environmental parameters; a determination subunit for determining the type and quantity of text to be filtered based on the weather parameters and temperature parameters, wherein the type and quantity of text to be filtered are used to characterize the type and quantity of text contained in the target speech; and a construction subunit for constructing speech filtering conditions based on the type and quantity of text to be filtered.
[0017] Optionally, the recognition module includes: a first vector determination unit, used to perform semantic recognition on the target speech using a preset recognition model to obtain a first recognition vector; a second vector determination unit, used to filter a second recognition vector from a preset speech library based on a preset index framework; and a result determination unit, used to determine the semantic result corresponding to the second recognition vector as the semantic recognition result in response to the matching of the first recognition vector and the second recognition vector.
[0018] Optionally, the first vector determination unit includes: an extraction subunit for extracting attribute features and text content of the target speech; a vectorization subunit for vectorizing the text content using a preset recognition model and attribute features to obtain a semantic recognition vector; and an embedding subunit for embedding the semantic recognition vector based on preset fixed parameters to obtain a first recognition vector.
[0019] Optionally, the vectorization subunit is also used to: split the text content based on attribute features to obtain multiple texts to be identified; encode the multiple texts to be identified to obtain multiple encoded texts; process the multiple encoded texts using a first weight matrix to obtain multiple attention values corresponding to the multiple encoded texts; and process the target attention value based on a second weight matrix to obtain a semantic recognition vector, wherein the target attention value is a value obtained by concatenating multiple attention values.
[0020] Optionally, the second vector determination unit includes: a feature acquisition subunit, used to acquire data features of multiple semantic vectors stored in a preset speech library; a layer number determination subunit, used to exponentially decay the number of multiple semantic vectors to obtain the number of index layers; an index graph generation subunit, used to generate an index graph based on the hierarchical relationship of the data features, multiple semantic vectors, and the number of index layers, wherein different index layers in the index graph contain different index semantic vectors, and the index semantic vectors are vectors obtained by dividing multiple semantic vectors using hierarchical relationships; and a second vector determination subunit, used to determine a second recognition vector from the index semantic vectors in the index graph based on the hierarchical relationship of the index graph.
[0021] Optionally, the device further includes: a sample acquisition module for acquiring sample attribute features and sample text content of sample speech; a sample processing module for processing the sample attribute features and sample text content using a preset recognition model to obtain a sample recognition vector; a vector embedding module for embedding the sample recognition vector based on preset fixed parameters to obtain a second recognition vector; and a speech library determination module for storing the second recognition vector according to a preset storage format to obtain a preset speech library.
[0022] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, characterized in that the computer-readable storage medium includes a stored program, wherein the program executes any of the above-described speech recognition methods when it is run.
[0023] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, characterized in that the memory stores a computer program, and the processor is configured to execute any of the above-described speech recognition methods through the computer program.
[0024] In this embodiment of the invention, the method involves acquiring the speech to be recognized and environmental parameters; filtering the speech based on the environmental parameters to obtain the target speech; and using a preset recognition model and a preset speech library to recognize the text contained in the target speech to obtain the semantic recognition result of the speech to be recognized. By first acquiring the environmental parameters of the user's environment in which the speech to be recognized is output, and then filtering out the target speech to be recognized from the speech to be recognized, the problem of misrecognizing invalid speech can be avoided. After the target speech is filtered out, the preset recognition model is further used to perform semantic recognition on the text content of the target speech, and the recognition result is matched with the preset speech library to determine the semantic recognition result of the speech to be recognized, thereby improving the accuracy of the semantic recognition result and solving the technical problem of poor semantic recognition accuracy of the speech to be recognized in related technologies. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram of the hardware environment for an interaction method of a smart device according to an embodiment of this application;
[0028] Figure 2 This is a schematic diagram illustrating a conventional function instruction recognition method according to an embodiment of this application;
[0029] Figure 3 This is a flowchart illustrating the steps of a speech recognition method according to an embodiment of this application;
[0030] Figure 4 This is a schematic diagram illustrating a simplified speech recognition process according to an embodiment of this application;
[0031] Figure 5 This is a device block diagram of a speech recognition device according to an embodiment of this application. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] According to one aspect of the embodiments of this application, an interaction method for smart home devices is provided. This interaction method for smart home devices is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned interaction method for smart home devices can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A voice library can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0035] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0036] Figure 2 This is a schematic diagram illustrating a conventional function instruction recognition method according to an embodiment of this application, such as... Figure 2 As shown, a domain is a lexical domain composed of functional instructions related to an application scenario. For example, in human-computer interaction scenarios, common functional instructions include: power on, power off, pause, etc. The aforementioned domain behavior can refer to these common functional instructions. Figure 2The basic idea of the function command recognition method shown is as follows: First, multiple word sequences are obtained from the sample speech, i.e., the preset function command. Then, the word sequences are preprocessed, such as merging, to obtain multiple chunk sequences. These chunk sequences can be keyword groups or other data from the sample speech. After labeling the multiple chunk sequences, a semantic classification tree is generated. This semantic classification tree contains a series of semantic rules and speech probability information automatically obtained during the processing of the sample speech during the generation process, which is equivalent to constructing a speech recognition model. When the user outputs a speech to be recognized, the function command recognition system first preprocesses the speech to be recognized to obtain the chunks to be parsed. Then, the semantic classification tree is used to determine the chunks to be parsed and compare them with the labeled chunks to determine the semantic information and similarity of the chunks to be parsed. Finally, a preset statistical parsing model is used to combine the semantic results of multiple words to obtain the corresponding function command of the entire speech to be recognized.
[0037] However, this method has a low context window. When using HMM (Hidden Markov Model) to parse the speech to be recognized, the recognition window generally only acquires a fixed number of words or chunks, such as two words or chunks. This has great limitations and is difficult to apply to the speech recognition process with many variations and few norms, resulting in low accuracy of the recognition results. Furthermore, since the behavioral concepts in the above-mentioned domain behaviors all require human intervention to set the corresponding behavioral labels and interpretation rules, if there are too many behavioral concepts, there will also be many interpretation rules to set, making the entire recognition process too cumbersome and inefficient.
[0038] Example 1
[0039] According to an embodiment of this application, a speech recognition method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0040] Figure 3 This is a flowchart illustrating the steps of a speech recognition method according to an embodiment of this application, such as... Figure 3 As shown, the method includes the following steps:
[0041] Step S302: Obtain the speech to be recognized and environmental parameters.
[0042] Among them, the environmental parameters mentioned above are the parameters of the environment in which the user outputs the speech to be recognized is located, and may include, but are not limited to, environmental temperature, environmental humidity, weather conditions, etc.
[0043] The aforementioned speech to be recognized can refer to continuous speech output by the user;
[0044] In one optional solution of this embodiment, considering that the voice commands output by the user are highly colloquial and do not have the standard and format of machine language, and that the types of voice commands output by the user in different environments, such as speech rate, loudness, and tone, are different, in order to improve the semantic recognition accuracy of the text content of the speech to be recognized, the environmental parameters of the user's current environment can be obtained while obtaining the speech output by the user to be recognized.
[0045] In one optional embodiment, the user can remotely output voice commands to the target application scenario. For example, the user can send the voice command "turn on the air conditioner" to the air conditioning system in the house from the vehicle. The corresponding environmental parameters can refer to the parameters corresponding to the user's location, such as the temperature and humidity inside the vehicle.
[0046] Step S304: Based on environmental parameters, filter the speech to be recognized to obtain the target speech.
[0047] The aforementioned target voice can refer to voice related to preset functional commands in the application scenario, which contains the voice commands that the user actually wants the home appliances to execute.
[0048] In one optional embodiment, since there may be too many invalid words and too few valid keywords in the speech to be recognized, after obtaining the environmental parameters and the speech to be recognized, the environmental parameters can be used to filter the speech to be recognized, and the target speech can be selected from the speech to be recognized.
[0049] In one alternative embodiment, when filtering out the target speech from multiple speech samples to be recognized, environmental parameters can be used to predict the emotion of the speech samples to be recognized, and the emotion results of the recognition can be used to filter the speech samples to be recognized to determine the target speech.
[0050] For example, in different environments, the voice output by a user for the same function command may be different. If the ambient temperature and humidity are high, the user may not have the energy to output a large amount of text, and the output time will be longer. For example, for the power-on command, the user may spend 3 seconds outputting the voice command "Air conditioner on". This means that the amount of text in the voice command may be small, but the voice time will be long. Since a typical voice recognition system analyzes the voice command word by word, when analyzing the above voice command "Air conditioner on", the long voice time may cause the voice recognition system to fail to successfully parse the function command corresponding to turning on the air conditioner.
[0051] If the outdoor temperature is low, users use underfloor heating home appliances to ensure a moderate indoor temperature. However, when chatting with friends, the statements may resemble function commands, such as "It's too cold, many neighbors have turned on their air conditioners for heating." In this case, the voice recognition system may misrecognize the statement, causing the air conditioner to be turned on for heating. This results in a situation where the voice to be recognized contains statements similar to function commands, but the user's purpose is not to have the home appliance execute that function command.
[0052] Therefore, in order to improve the accuracy of speech recognition, after obtaining the speech to be recognized and environmental parameters, the speech recognition system can use the environmental parameters to filter out the target speech that needs to be recognized, thereby avoiding the problem of incorrect operation of home appliances in the application scenario due to semantic misrecognition.
[0053] It should be noted that the two examples above are merely illustrative and are not intended to impose any specific limitations.
[0054] In one optional embodiment, the voice recognition system can be in standby mode in real time, receiving voice commands from the user in real time. The user does not need to wake up the voice recognition system with a specified voice identifier every time, thereby improving the efficiency of controlling home appliances to perform corresponding operations based on the user's voice commands. At the same time, by using environmental parameters to filter the voice commands output by the user, semantic misrecognition can also be avoided.
[0055] Step S306: Using a preset recognition model and a preset speech library, the text contained in the target speech is recognized to obtain the semantic recognition result of the speech to be recognized.
[0056] The aforementioned preset recognition model can refer to a model used to extract features from target speech and convert the text content of target speech into semantic vectors.
[0057] The aforementioned preset voice library can refer to a model used to store the semantic vectors corresponding to the text content of the functional instructions of multiple home devices in the application scenario.
[0058] In one optional embodiment, the text content of the target speech can be obtained, and the semantic vector corresponding to the text content can be used to ensure the efficiency of the semantic recognition result of the target speech. Then, the semantic vector of the recognized target speech is matched with the semantic vector in the preset speech library to determine the semantic recognition result of the target speech, so that the corresponding home device can perform the corresponding operation.
[0059] In one optional embodiment, the target speech is input into a preset recognition model as a whole to avoid the limitations of using partial segmentation results for recognition after the target speech is segmented.
[0060] In this embodiment of the invention, the method involves acquiring the speech to be recognized and environmental parameters; filtering the speech based on the environmental parameters to obtain the target speech; and using a preset recognition model and a preset speech library to recognize the text contained in the target speech to obtain the semantic recognition result of the speech to be recognized. By first acquiring the environmental parameters of the user's environment in which the speech to be recognized is output, and then filtering out the target speech to be recognized from the speech to be recognized, the problem of misrecognizing invalid speech can be avoided. After the target speech is filtered out, the preset recognition model is further used to perform semantic recognition on the text content of the target speech, and the recognition result is matched with the preset speech library to determine the semantic recognition result of the speech to be recognized, thereby improving the accuracy of the semantic recognition result and solving the technical problem of poor semantic recognition accuracy of the speech to be recognized in related technologies.
[0061] Optionally, the speech to be recognized is filtered based on environmental parameters to obtain target speech, including: constructing speech filtering conditions based on environmental parameters; and filtering the speech to be recognized based on the speech filtering conditions to obtain target speech.
[0062] The above filtering conditions can refer to the conditions used to remove invalid speech from the speech to be recognized and retain the valid target speech. Among them, invalid speech does not involve the user's true intention to perform operations on the home device.
[0063] In one alternative embodiment, when filtering the speech to be recognized using environmental parameters, one or more of the above-mentioned filtering conditions can be constructed using environmental parameters, such as whether there are keywords related to the current environmental parameters in the speech to be recognized, and the filtering conditions can be used to filter the speech to be recognized in order to obtain the target speech.
[0064] For example, as mentioned above, a voice recognition system can receive multiple voices in an application scenario in real time. If the current environmental parameters are abnormal, such as high humidity, and the user outputs three voices in a short period of time, namely "voice 1, voice 2, and voice 3", where voice 1 is used to express the user's desired destination, voice 2 is used to express the user's desired departure time, and voice 3 is used to express the need to turn on the dehumidification function of the air conditioner after the user leaves the current scenario, then it can be determined that the target voice to be executed by the home appliances in the scenario is voice 3. At this time, the voice recognition system can perform deep recognition on voice 3.
[0065] Optionally, constructing speech filtering conditions based on environmental parameters includes: obtaining weather parameters and temperature parameters from the environmental parameters; determining the type and number of texts to be filtered based on the weather parameters and temperature parameters, wherein the type and number of texts to be filtered are used to characterize the type and number of texts contained in the target speech; and constructing speech filtering conditions based on the type and number of texts to be filtered.
[0066] In one optional embodiment, when constructing the speech filtering conditions, the text type and number of target semantic vectors to be recognized can be determined based on environmental parameter names, such as weather parameters and temperature parameters. For example, if the current temperature is high, the corresponding text type can mainly be related to cooling. Since users may be less willing to output target speech when the temperature is high, the corresponding text number may also be smaller. Therefore, after determining the above-mentioned text type and text number, the speech filtering conditions can be constructed using the text type and text number.
[0067] Optionally, the text contained in the target speech is identified using a preset recognition model and a preset speech library to obtain the semantic recognition result of the speech to be recognized, including: performing semantic recognition on the target speech using the preset recognition model to obtain a first recognition vector; filtering a second recognition vector from the preset speech library based on a preset index framework; and determining the semantic result corresponding to the second recognition vector as the semantic recognition result in response to the matching of the first recognition vector and the second recognition vector.
[0068] The first recognition vector mentioned above can refer to the semantic vector corresponding to the text content of the target speech, and the second recognition vector mentioned above can refer to the semantic vector stored in the preset speech library. By matching the first recognition vector and the second recognition vector, the semantic recognition result corresponding to the first recognition vector can be quickly determined.
[0069] The aforementioned preset index framework can refer to a framework used to select the second recognition vector from a preset speech library, and may include, but is not limited to, the Faiss vector index framework, the HNSWLib vector index framework, etc.
[0070] In one optional embodiment, the text content of the target speech can be first processed using the aforementioned preset recognition model to obtain a first recognition vector corresponding to the target speech. Then, based on the aforementioned preset index framework, a second recognition vector is determined from the preset speech library. The first and second recognition vectors are matched. If the match is successful, the semantic result corresponding to the second recognition vector can be determined, i.e., the aforementioned function instruction is the semantic recognition result of the first recognition vector. This semantic recognition result can be determined as the semantic recognition result of the speech to be recognized. If the match fails, the second recognition vector is re-determined for matching.
[0071] In one optional embodiment, the Euclidean distance between the first identification vector and the second identification vector can be calculated, and it can be determined whether the calculated Euclidean distance is less than a preset distance threshold. If it is less than the threshold, the matching can be determined to be successful; if it is not less than the threshold, the matching can be determined to be unsuccessful.
[0072] In one optional embodiment, when the Euclidean distance is less than a preset distance threshold, the Euclidean distance can be retained, and a new second recognition vector can be obtained. A new Euclidean distance is then calculated and compared with the preset distance threshold. After the number of calculated Euclidean distances less than the preset distance threshold reaches a certain threshold, the second recognition vector corresponding to the smallest Euclidean distance among the multiple Euclidean distances can be determined as the target second recognition vector. The semantic result corresponding to this target second recognition vector is then used as the semantic recognition result, thereby improving the accuracy of the determined semantic recognition result.
[0073] It should be noted that the above method of using Euclidean distance to determine whether a match is successful is merely an illustrative example and is not intended to impose any specific limitations.
[0074] Optionally, semantic recognition of the target speech is performed using a preset recognition model to obtain a first recognition vector, including: extracting attribute features and text content of the target speech; vectorizing the text content using the preset recognition model and attribute features to obtain a semantic recognition vector; and embedding the semantic recognition vector based on preset fixed parameters to obtain the first recognition vector.
[0075] The aforementioned attribute features may refer to characteristics such as speech rate, intonation, and loudness of the target speech. It should be noted that speech rate, intonation, and loudness are only illustrative examples and are not specifically limited.
[0076] In one optional embodiment, when determining the first recognition vector corresponding to the target speech, the attribute features and text content of the target speech can be extracted first, and the text content can be vectorized using a preset recognition model and attribute features to obtain the corresponding semantic recognition vector.
[0077] In one optional solution of this embodiment, since the data length of the semantic recognition vector corresponding to different text content is different, and different data lengths may affect the efficiency of matching the first recognition vector and the second recognition vector, after obtaining the above-mentioned semantic recognition vector, a preset fixed parameter can be used to embed and fix the length of the semantic recognition vector to obtain the above-mentioned first recognition vector.
[0078] Optionally, the text content is vectorized using a preset recognition model and attribute features to obtain a semantic recognition vector, including: splitting the text content based on attribute features to obtain multiple texts to be recognized; encoding the multiple texts to be recognized to obtain multiple encoded texts; processing the multiple encoded texts using a first weight matrix to obtain multiple attention values corresponding to the multiple encoded texts; and processing the target attention value based on a second weight matrix to obtain a semantic recognition vector, wherein the target attention value is a value obtained by concatenating multiple attention values.
[0079] In one optional embodiment, a multi-head attention mechanism can be used to construct the aforementioned preset recognition model, and the text features can be vectorized using the preset recognition model and attribute features to obtain the corresponding semantic recognition vector.
[0080] Specifically, the text content of the target speech can be split first using attribute features to obtain multiple texts to be recognized. For example, the loudness can be divided into multiple intervals, and the target speech can be split into multiple texts based on the loudness of the target speech at different times, rather than directly splitting multiple keywords from the text content of the target speech, thereby avoiding the limitations caused by only recognizing keywords.
[0081] In one optional embodiment, in order to improve the accuracy of semantic recognition results, the text content can be further subdivided, that is, a piece of text content can be split character by character.
[0082] After obtaining multiple texts to be recognized, the multiple texts to be recognized can be encoded, and the encoded texts to be recognized can be processed using the first weight matrix mentioned above to obtain the attention corresponding to each text to be recognized.
[0083] After obtaining the attention value corresponding to each text to be recognized, multiple attention values can be concatenated according to the position order of the corresponding text to be recognized in the text content of the target speech. The concatenated attention values are then processed using the second weight matrix to obtain the semantic recognition vector mentioned above.
[0084] Optionally, the second recognition vector is selected from a preset speech library based on a preset index framework, including: obtaining data features of multiple semantic vectors stored in the preset speech library; exponentially decaying the number of multiple semantic vectors to obtain the number of index layers; generating an index graph based on the hierarchical relationship of the data features, the multiple semantic vectors, and the number of index layers, wherein different index layers in the index graph contain different index semantic vectors, and the index semantic vectors are vectors obtained by dividing multiple semantic vectors using hierarchical relationships; and determining the second recognition vector from the index semantic vectors in the index graph based on the hierarchical relationship of the index graph.
[0085] The aforementioned index diagram can refer to an index framework containing multiple index layers, each with different index semantic vectors. The index semantic vectors can refer to vectors in a pre-defined speech library.
[0086] In one alternative embodiment, in order to improve the efficiency of selecting the second recognition vector from the preset speech library, an index graph can be constructed, and the hierarchical relationship of the index graph can be used to determine the second recognition vector.
[0087] Specifically, we can first obtain the data features of multiple semantic vectors in the preset speech library, such as the application scenarios, home devices used, application time periods, hierarchical relationships between different functional commands, and the number of multiple semantic vectors. Considering that concentrating all semantic vectors in the same index layer will affect the efficiency of determining the second recognition vector using the index graph, we can exponentially decay the number of the above multiple semantic vectors and use the decay number as the index layer number of the index graph.
[0088] In one optional embodiment, while determining the number of index layers, multiple semantic vectors can be divided according to the above-mentioned data characteristics, such as the hierarchical relationship between different functional instructions. The upper-level vectors, such as the index semantic vectors of functional instructions corresponding to the entire application scenario, are placed in higher index layers, and the lower-level vectors, such as the index semantic vectors of functional instructions that a specific home device in the scenario can execute within a preset time, are placed in lower index layers to generate the above-mentioned index map.
[0089] After generating the index map, for example, based on the hierarchical relationship of the index map, the second identification vector is determined first from the higher index layer, and then the second identification vector is determined sequentially from the lower index layers.
[0090] Optionally, the method further includes: acquiring sample attribute features and sample text content of sample speech; processing the sample attribute features and sample text content using a preset recognition model to obtain a sample recognition vector; embedding the sample recognition vector based on preset fixed parameters to obtain a second recognition vector; and storing the second recognition vector according to a preset storage format to obtain a preset speech library.
[0091] The sample voice mentioned above may refer to voice commands that can be triggered by multiple home devices in the application scenario.
[0092] In one optional embodiment, similar to the process of obtaining the first recognition vector, when constructing the preset speech library, the sample attribute features and sample text content of the sample speech can be obtained first. Then, the sample attribute features and sample text content are processed using the preset recognition model to obtain multiple sample recognition vectors. The length of the sample vectors is embedded and fixed using preset fixed parameters to obtain multiple second recognition vectors to construct the preset speech library.
[0093] In one optional embodiment, in order to further improve the efficiency of determining the second recognition vector from the preset speech library, the preset speech library can be constructed in the form of a columnar database or a horizontal database.
[0094] In one optional embodiment, the local dialect can be obtained based on the location of the application scenario, and the local dialect can be used to construct the aforementioned preset speech library to improve the applicability of the speech recognition system.
[0095] To facilitate understanding of the above scheme, Figure 4 This is a schematic diagram illustrating a simplified speech recognition process according to an embodiment of this application, such as... Figure 4 As shown, a large number of sample speech samples can be acquired first, and then processed using a preset recognition model to obtain a large number of second recognition vectors. These second recognition vectors are then used to construct a preset speech library in a columnar database format. When a user outputs the speech to be recognized, the speech recognition system can simultaneously acquire the speech to be recognized and environmental parameters. Using the environmental parameters, the system filters out the target speech from the speech to be recognized, and then inputs the text content of the target speech into the aforementioned preset recognition model to obtain a first recognition vector. Using a preset index framework, a second recognition vector is filtered out from the preset speech library. The two vectors are matched, and the Euclidean distance between them is calculated. If the Euclidean distance is less than a preset distance threshold, it indicates that the first and second recognition vectors match, and the semantic result corresponding to the second recognition vector can be determined as the semantic recognition result of the speech to be recognized. If the Euclidean distance is not less than the preset distance threshold, it indicates that the first and second recognition vectors do not match. In this case, a new second recognition vector can be determined from the preset speech library based on the preset index framework, and this vector can be re-matched with the first recognition vector.
[0096] Example 2
[0097] According to one aspect of the embodiments of this application, corresponding to the embodiments of the speech recognition method, a speech recognition device is also provided. Figure 5 This is a device block diagram illustrating a speech recognition apparatus according to an embodiment of this application, such as... Figure 5As shown, the device includes: an acquisition module 502, used to acquire the speech to be recognized and environmental parameters, wherein the environmental parameters are the parameters of the environment in which the user outputs the speech to be recognized is located; a filtering module 504, used to filter the speech to be recognized based on the environmental parameters to obtain the target speech; and a recognition module 506, used to recognize the text contained in the target speech using a preset recognition model and a preset speech library to obtain the semantic recognition result of the speech to be recognized.
[0098] Optionally, the filtering module 504 includes: a condition construction unit for constructing speech filtering conditions based on environmental parameters; and a speech filtering unit for filtering the speech to be recognized based on the speech filtering conditions to obtain the target speech.
[0099] Optionally, the condition construction unit includes: a parameter acquisition subunit for acquiring weather parameters and temperature parameters from environmental parameters; a determination subunit for determining the type and quantity of text to be filtered based on the weather parameters and temperature parameters, wherein the type and quantity of text to be filtered are used to characterize the type and quantity of text contained in the target speech; and a construction subunit for constructing speech filtering conditions based on the type and quantity of text to be filtered.
[0100] Optionally, the recognition module 506 includes: a first vector determination unit, used to perform semantic recognition on the target speech using a preset recognition model to obtain a first recognition vector; a second vector determination unit, used to filter a second recognition vector from a preset speech library based on a preset index framework; and a result determination unit, used to determine the semantic result corresponding to the second recognition vector as the semantic recognition result in response to the matching of the first recognition vector and the second recognition vector.
[0101] Optionally, the first vector determination unit includes: an extraction subunit for extracting attribute features and text content of the target speech; a vectorization subunit for vectorizing the text content using a preset recognition model and attribute features to obtain a semantic recognition vector; and an embedding subunit for embedding the semantic recognition vector based on preset fixed parameters to obtain a first recognition vector.
[0102] Optionally, the vectorization subunit is also used to: split the text content based on attribute features to obtain multiple texts to be identified; encode the multiple texts to be identified to obtain multiple encoded texts; process the multiple encoded texts using a first weight matrix to obtain multiple attention values corresponding to the multiple encoded texts; and process the target attention value based on a second weight matrix to obtain a semantic recognition vector, wherein the target attention value is a value obtained by concatenating multiple attention values.
[0103] Optionally, the second vector determination unit includes: a feature acquisition subunit, used to acquire data features of multiple semantic vectors stored in a preset speech library; a layer number determination subunit, used to exponentially decay the number of multiple semantic vectors to obtain the number of index layers; an index graph generation subunit, used to generate an index graph based on the hierarchical relationship of the data features, multiple semantic vectors, and the number of index layers, wherein different index layers in the index graph contain different index semantic vectors, and the index semantic vectors are vectors obtained by dividing multiple semantic vectors using hierarchical relationships; and a second vector determination subunit, used to determine a second recognition vector from the index semantic vectors in the index graph based on the hierarchical relationship of the index graph.
[0104] Optionally, the device further includes: a sample acquisition module for acquiring sample attribute features and sample text content of sample speech; a sample processing module for processing the sample attribute features and sample text content using a preset recognition model to obtain a sample recognition vector; a vector embedding module for embedding the sample recognition vector based on preset fixed parameters to obtain a second recognition vector; and a speech library determination module for storing the second recognition vector according to a preset storage format to obtain a preset speech library.
[0105] Example 3
[0106] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, characterized in that the computer-readable storage medium includes a stored program, wherein the program executes any of the above-described speech recognition methods when it is run.
[0107] Example 4
[0108] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, characterized in that the memory stores a computer program, and the processor is configured to execute any of the above-described speech recognition methods through the computer program.
[0109] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
[0110] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0111] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0112] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0113] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0114] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0115] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A speech recognition method, characterized in that, include: Acquire the speech to be recognized and environmental parameters, wherein the environmental parameters are parameters of the environment in which the user outputs the speech to be recognized; The speech to be recognized is filtered based on the environmental parameters to obtain the target speech; Using a preset recognition model and a preset speech library, the text contained in the target speech is recognized to obtain the semantic recognition result of the speech to be recognized; The process of filtering the speech to be recognized based on the environmental parameters to obtain the target speech includes: Obtain the weather and temperature parameters from the environmental parameters; based on the weather and temperature parameters, determine the type and number of texts to be filtered, wherein the type and number of texts to be filtered are used to characterize the type and number of texts contained in the target speech; based on the type and number of texts to be filtered, construct speech filtering conditions; filter the speech to be recognized based on the speech filtering conditions to obtain the target speech.
2. The method according to claim 1, characterized in that, Using a preset recognition model and a preset speech library, the text contained in the target speech is recognized to obtain the semantic recognition result of the speech to be recognized, including: The target speech is semantically recognized using the preset recognition model to obtain a first recognition vector; The second recognition vector is selected from the preset speech library based on the preset index framework; In response to the matching of the first identification vector and the second identification vector, the semantic result corresponding to the second identification vector is determined as the semantic identification result.
3. The method according to claim 2, characterized in that, The target speech is semantically recognized using the preset recognition model to obtain a first recognition vector, including: Extract the attribute features and text content of the target speech; Using the preset recognition model and the attribute features, the text content is vectorized to obtain a semantic recognition vector; The semantic recognition vector is embedded based on preset fixed parameters to obtain the first recognition vector.
4. The method according to claim 3, characterized in that, Using the preset recognition model and the attribute features, the text content is vectorized to obtain a semantic recognition vector, including: The text content is segmented based on the attribute features to obtain multiple texts to be identified; The multiple texts to be identified are encoded to obtain multiple encoded texts; The first weight matrix is used to process the multiple encoded texts to obtain multiple attention values corresponding to the multiple encoded texts; The target attention value is processed based on the second weight matrix to obtain the semantic recognition vector, wherein the target attention value is obtained by concatenating the multiple attention values.
5. The method according to claim 2, characterized in that, The second recognition vector is selected from the preset speech library based on a preset index framework, including: Obtain the data features of multiple semantic vectors stored in the preset speech library; The number of index layers is obtained by exponentially decaying the number of semantic vectors. Based on the hierarchical relationship of the data features, the multiple semantic vectors, and the number of index layers, an index graph is generated, wherein different index layers in the index graph contain different index semantic vectors, and the index semantic vectors are vectors obtained by dividing the multiple semantic vectors using the hierarchical relationship; Based on the hierarchical relationship of the index graph, the second identification vector is determined from the index semantic vector of the index graph.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Obtain the sample attribute features and sample text content of the sample speech; The sample attribute features and sample text content are processed using the preset recognition model to obtain the sample recognition vector; The sample recognition vector is embedded based on preset fixed parameters to obtain a second recognition vector. The second recognition vector is stored according to a preset storage format to obtain the preset speech library.
7. A voice recognition device, characterized in that, include: The acquisition module is used to acquire the speech to be recognized and environmental parameters, wherein the environmental parameters are the parameters of the environment in which the user who outputs the speech to be recognized is located; A filtering module is used to filter the speech to be recognized based on the environmental parameters to obtain the target speech; The recognition module is used to recognize the text contained in the target speech using a preset recognition model and a preset speech library, and to obtain the semantic recognition result of the speech to be recognized. The aforementioned filtering module is further configured to acquire weather parameters and temperature parameters from the environmental parameters; determine the type and quantity of text to be filtered based on the weather parameters and temperature parameters, wherein the type and quantity of text to be filtered are used to characterize the type and quantity of text contained in the target speech; construct speech filtering conditions based on the type and quantity of text to be filtered based on the speech filtering conditions to obtain the target speech.
8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Emotion speech recognition method based on natural language comprehension
CN102723078A
Intelligent voice control method and device, electronic equipment and storage medium
CN113241073A