Semantic analysis method and device, equipment and storage medium
By inputting the fixed-dimensional processing results of custom features into the pre-trained semantic parsing model, the problem of needing to modify the model structure when the feature types change is solved, reducing development costs and improving development efficiency.
Patent Information
- Application Number
- CN202310319989.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-01
AI Technical Summary
Existing semantic parsing methods need to modify the model structure when the feature type changes, which increases development costs.
By acquiring text features and custom features, we process the dimensional changes of the custom features to obtain processing results with fixed dimensions, and input them into the pre-trained semantic parsing model to avoid changing the model structure.
It reduces development costs, simplifies users' development work, improves development efficiency, and improves user experience.
Smart Images

Figure CN118737133A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a semantic parsing method, apparatus, device and storage medium. Background Art
[0002] With the development of technology, the application of artificial intelligence is becoming more and more extensive. For example, intelligent control can be performed through voice. Among them, semantic analysis is an important part of intelligent control. Therefore, when performing intelligent control, semantic analysis of voice text is required.
[0003] The commonly used semantic analysis method is to input the features related to the speech text into the corresponding model to obtain the semantic analysis results. When the type of features changes, the structure of the model needs to be modified, which increases the development cost.
[0004] Application Contents
[0005] The embodiments of the present application provide a semantic parsing method, apparatus, device and storage medium, which can reduce development costs when the feature type changes.
[0006] In a first aspect, an embodiment of the present application provides a semantic parsing method, including:
[0007] Acquire a first text feature and at least one first custom feature, where the first text feature is obtained by parsing the first voice text;
[0008] For each first custom feature, when the dimension of the first custom feature changes, the first custom feature is processed to obtain a first processing result, the dimension of the first processing result is fixed, and the first processing result is used to uniquely identify the first custom feature;
[0009] The first text feature and the first processing result are input into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, wherein the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
[0010] In a second aspect, an embodiment of the present application provides a semantic parsing device, including:
[0011] An acquisition module, used to acquire a first text feature and at least one first custom feature, where the first text feature is obtained by parsing the first voice text;
[0012] a processing module, configured to process each first custom feature, when the dimension of the first custom feature changes, to obtain a first processing result, wherein the dimension of the first processing result is fixed, and the first processing result is used to uniquely identify the first custom feature;
[0013] A generation module is used to input the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0015] processor;
[0016] a memory for storing computer program instructions;
[0017] When the computer program instructions are executed by a processor, the method according to the first aspect is implemented.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which implement the method described in the first aspect when the computer program instructions are executed by a processor.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method described in the first aspect.
[0020] The embodiment of the present application obtains a first text feature and at least one first custom feature, processes the first custom feature for each first custom feature when the dimension of the first custom feature changes, obtains a first processing result, inputs the first text feature and the first processing result into a pre-trained first semantic parsing model, and obtains a semantic parsing result of the first speech text, wherein the dimension of the first processing result is fixed, the first processing result is used to uniquely identify the first custom feature, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result. That is, when the dimension of the first custom feature changes in the embodiment of the present application, it can be converted into a processing result with a fixed dimension. Since the processing result is the same as the input dimension of the first semantic parsing model relative to the first custom feature, it can be directly input into the first semantic parsing model without changing the structure of the first semantic parsing model, which can reduce the user's development work and thus reduce development costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1A flowchart of a semantic parsing method provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of a first interface provided in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of a custom feature setting interface provided in an embodiment of the present application;
[0025] Figure 4 A schematic diagram of a process for adding custom features provided in an embodiment of the present application;
[0026] Figure 5 A structural diagram of a semantic parsing device provided in an embodiment of the present application;
[0027] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0029] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0030] As mentioned above, with the development of technology, the application of artificial intelligence is becoming more and more extensive. Taking intelligent control through voice as an example, semantic analysis of the user's voice signal is an important part of intelligent control.
[0031] At present, semantic analysis is mainly performed through models. In order to accurately analyze the user's intention and meet the user's needs, in addition to considering the voice and text features, user-defined features can also be considered when performing semantic analysis based on the model, such as user-defined dictionary features, multimodal features, device features, etc. That is, the voice and text features and the customized features need to be input into the model to obtain the semantic analysis results.
[0032] The structure of the model is consistent with the dimension of the input feature. When the dimension of the input feature changes, such as the dimension of the custom feature, that is, the type changes, the original model structure is no longer applicable. At this time, the structure of the model needs to be changed to make the input dimension of the model consistent with the dimension of the input feature. This will increase a series of development work caused by the change of the model structure and increase the development cost.
[0033] To this end, the embodiments of the present application provide a semantic parsing method, apparatus, device and storage medium, which do not require changing the structure of the model when the feature type changes, thereby reducing development costs.
[0034] The semantic parsing method provided in the embodiment of the present application is described below in conjunction with specific embodiments. The semantic parsing method provided in the embodiment of the present application can be applied to an electronic device that can support intelligent control. Exemplarily, the electronic device can be a projection device, a laptop computer, a desktop computer, etc.
[0035] Figure 1 A flowchart of a semantic parsing method provided in an embodiment of the present application. Figure 1 As shown, the semantic parsing method may include the following steps:
[0036] S110: Acquire a first text feature and at least one first custom feature.
[0037] The first text feature is obtained by parsing the first voice text.
[0038] S120 . For each first custom feature, when the dimension of the first custom feature changes, process the first custom feature to obtain a first processing result.
[0039] The dimension of the first processing result is fixed, and the first processing result is used to uniquely identify the first custom feature.
[0040] S130, inputting the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text.
[0041] The input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
[0042] The embodiment of the present application obtains a first text feature and at least one first custom feature, processes the first custom feature for each first custom feature when the dimension of the first custom feature changes, obtains a first processing result, inputs the first text feature and the first processing result into a pre-trained first semantic parsing model, and obtains a semantic parsing result of the first speech text, wherein the dimension of the first processing result is fixed, the first processing result is used to uniquely identify the first custom feature, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result. That is, when the dimension of the first custom feature changes in the embodiment of the present application, it can be converted into a processing result with a fixed dimension. Since the processing result is the same as the input dimension of the first semantic parsing model relative to the first custom feature, there is no need to change the structure of the first semantic parsing model, which can reduce the user's development work and thus reduce development costs.
[0043] The above steps are described in detail below:
[0044] In S110, the first text feature is obtained by parsing the first voice text. The first voice text can be obtained by recognizing the voice signal of the user. The embodiment of the present application does not limit the specific recognition method of the voice signal.
[0045] Exemplarily, the first text feature may include a word embedding and a character embedding, which may be obtained by parsing the first speech text. The dimensions of the word embedding and the character embedding may be set as needed, for example, the dimensions of the word embedding and the character embedding may both be 128 dimensions.
[0046] The first custom feature is a user-defined feature for assisting in parsing the first voice text. Exemplarily, the first custom feature may include one or more, for example, the first custom feature may include one or more of a dictionary feature, a speech feature, a user multimodal feature, and a device feature.
[0047] Exemplarily, the dictionary features may include a dictionary of personal names, a dictionary of place names, a dictionary of institution names, etc. Each dictionary may include multiple pieces of information. For example, a dictionary of personal names may include Zhang San, Li Si, Wang Wu, Zhao Liu, etc.
[0048] Script features may include weather scripts, music scripts, ticket scripts, etc.
[0049] User multimodal features may be features related to the user himself, for example, may include the volume of a voice signal, a user portrait, user behavior, etc.
[0050] Device characteristics may include the history record, current status, etc. of the electronic device. The history record may include the historical usage time and historical usage record of the electronic device. The historical usage record may include, for example, what video or song is currently being played.
[0051] Exemplarily, the first custom feature can be obtained in the following way:
[0052] Receiving a first input to a first control in a first interface;
[0053] In response to the first input, a custom feature setting interface is displayed, the custom feature setting interface including at least one of the following input areas for the custom feature: a feature category input area, a feature source input area, and a feature calculation method input area;
[0054] receiving a second input to a target setting control, where the target setting control is at least one setting control included in the custom feature setting interface;
[0055] Based on input information of at least one input area, a newly added first custom feature is determined.
[0056] The first interface may be an interface including a first text feature, namely, a word vector and a character vector. For example, Figure 2 The first interface may include a first text feature and a first control, and the first control is used to add a custom feature. Exemplarily, the first control may be a touch control.
[0057] The first input may be a click, touch, or other operation on the first control. When the user needs to add a custom feature, the first input may be performed on the first control. When the user's first input to the first control is received, the Figure 3 The interface shown is the custom feature setting interface, through which users can add custom features.
[0058] Compared with the traditional solution in which the system provides fixed features, the embodiments of the present application can customize features, thus meeting the personalized needs of users.
[0059] Figure 3Taking three input areas as an example, they are feature category input area 310, feature source input area 320 and feature calculation method input area 330, among which, feature category input area 310 is used to input the feature category of the custom feature, feature source input area 320 is used to input the source of the custom feature, and feature calculation method input area 330 is used to input the calculation method of the custom feature. For example, when a certain type of feature contains multiple features, the multiple features can be converted into a processing result that can identify multiple features according to a preset calculation method.
[0060] The input information for each input area is used to input information corresponding to the input area. For example, the user can input the corresponding information by himself or select from a list provided by the system. Figure 3 Take the system provided as an example.
[0061] For example, for the feature category input area 310 , the user can select from a drop-down list corresponding to the feature category input area 310 whether the custom feature is a dictionary feature, a multimodal feature, or a device feature.
[0062] For example, for the feature source input area 320 , the user can select from a drop-down list corresponding to the feature source input area 320 whether the custom feature is from a feature dictionary or is directly introduced.
[0063] For example, for the feature calculation method input area 330 , the user can select from the drop-down list corresponding to the feature source input area 320 whether the custom feature is marked by the number of dictionary digits or does not require calculation.
[0064] According to the information input by the user in each input area, the newly added first custom feature can be determined.
[0065] In some embodiments, Figure 3 As shown, the custom feature setting interface also includes a second control 340. For example, the second control 340 can be a touch control for adding additional custom features. Figure 3 In the interface shown, the user can add a first custom feature, and through the second control 340, the user can add additional first custom features to meet personalized needs. That is, when the user needs to add multiple first custom features, it can be achieved through the second control 340.
[0066] For example, reference Figure 4 When receiving input to the second control 340, a new row can be added, and the newly added custom feature can be set by the new row to obtain the newly added first custom feature.
[0067] In the embodiment of the present application, based on the interface of the existing features provided by the system, by touching the first control, a custom feature setting interface can be displayed, and custom features can be added to the custom feature setting interface, thereby meeting the personalized needs of users.
[0068] In some embodiments, reference Figure 3 The custom feature setting interface may further include a custom feature statistics area 350, which is used to display the number of features included in each type of newly added first custom feature. For example, the number of newly added dictionary features, the number of newly added multimodal features, and the number of newly added device features may be displayed. The custom feature statistics area 350 may be used to quickly understand the category and number of newly added first custom features.
[0069] In S120, the dimension of the first custom feature may be the category of the first custom feature. For example, the dimension of the first custom feature is N dimensions, indicating that the first custom feature includes N categories of features. Each category of features may include multiple feature information. Taking the first custom feature as a dictionary feature as an example, the dictionary feature may include multiple categories of features such as a dictionary of personal names, a dictionary of place names, and a dictionary of institution names. Different first custom features may include the same or different number of feature categories.
[0070] The dimensional change of the first custom feature may be an increase or decrease in the category of the first custom feature. The increase or decrease here may be for the previous semantic analysis, for example, relative to the custom feature corresponding to the previous semantic analysis, the category of the first custom feature corresponding to the current semantic analysis may increase or decrease.
[0071] For example, in order to meet the needs of users as much as possible, the system may also provide some pre-set custom features for users to choose from. In this case, the dimensional change of the first custom feature may also be a custom feature added relative to the custom features provided by the system.
[0072] When the category of the first custom feature changes, in order to keep the structure of the model unchanged, the embodiment of the present application can process the first custom feature to obtain a processing result that is the same as the input dimension of the model relative to the first custom feature, that is, no matter how the category of the first custom feature changes, it can ultimately be converted into a result with a fixed dimension. This not only meets the user's personalized needs for input features, but also reduces a series of development work caused by changes in the model structure, thereby reducing development costs.
[0073] The first processing result is used to uniquely identify the first custom feature. The dimension of the first processing result is fixed. Exemplarily, the dimension of the first processing result is 1, that is, the N-dimensional first custom feature can be converted into a 1-dimensional processing result.
[0074] The embodiment of the present application does not limit the processing scheme of the first custom feature. Any processing scheme that can convert the N-dimensional first custom feature into a processing result with a fixed dimension and can uniquely identify the first custom feature can be applied to the embodiment of the present application.
[0075] Compared with the traditional solution of semantic analysis based on features provided by the system, the embodiment of the present application can customize multiple first features, which can not only solve the problem of inability to parse the corresponding voice text due to limited system features, but also solve the problem of low accuracy of semantic analysis results due to low coverage of system features. This can allow users to experience more intelligent semantic analysis technology.
[0076] In S130, the first semantic parsing model is a pre-set model for parsing the first speech text. The structure of the first semantic parsing model may adopt an existing model structure or may be constructed by itself as needed.
[0077] The semantic analysis result of the first speech text can be obtained by inputting the first text feature and the first processing result into a pre-trained first semantic analysis model.
[0078] In the embodiment of the present application, when the type of the first custom feature changes, it is only necessary to retrain the first semantic parsing model without changing the structure of the first semantic parsing model, which can reduce development work and improve development efficiency. When the specific feature information of a category changes, the pre-trained first semantic parsing model can be directly used without retraining, which can simplify the user's operation and improve the user's experience.
[0079] Taking the first custom feature including at least one type of first feature as an example, each first feature may represent a type of named entity. In some embodiments, the above S120 may include the following steps:
[0080] S1201. When the category of the first feature changes, convert each first feature according to a preset feature conversion rule to obtain flag information of each first feature, where the flag information is used to indicate the corresponding first feature;
[0081] S1202: Perform operation on the flag information of each first feature according to the operation rule to obtain a first processing result.
[0082] Specifically, in S1201, the feature conversion rule is used to convert each first feature into another representation form, and the representation form is recorded as flag information, and the flag information can uniquely identify the first feature.
[0083] The embodiment of the present application does not limit the feature conversion rule, and any rule that can convert the first feature into flag information that can uniquely represent the first feature can be applied to the embodiment of the present application.
[0084] Taking the feature conversion rule including the base number conversion rule as an example, illustratively, the above S1201 may include the following steps:
[0085] According to the base number conversion rule and in combination with the positional relationship of each first feature, each first feature is converted to obtain the base number of each first feature as the mark information of each first feature.
[0086] The base number conversion rule is used to convert the first feature into a base number representation. Exemplarily, the base number conversion rule may include but is not limited to a binary number conversion rule and an octal number conversion rule.
[0087] Taking the conversion rule of base number to binary number as an example, illustratively, the first features can be arranged, and then the first first feature can be converted to 00...01 (N-1 zeros), the second first feature can be converted to 00...010 (N-1 zeros), the third first feature can be converted to 00..0100 (N-1 zeros), and so on. The Nth first feature can be converted to 100...0 (N-1 zeros), that is, according to the position of the first feature, the corresponding position can be set to 1, and the rest can be set to 0, thereby obtaining the binary representation of each first feature, that is, the flag information.
[0088] In the embodiment of the present application, each first feature is converted into a uniquely representable base number by using a base number conversion rule, so that it is possible to uniquely determine which first features are included in the first custom feature based on the first processing result.
[0089] In S1202, the flag information of each first feature is operated according to the operation rule to obtain a processing result that can uniquely identify the first custom feature.
[0090] Taking the conversion of each first feature into the above binary number representation as an example, illustratively, the above S1202 may include the following steps:
[0091] A bitwise OR operation is performed on the binary numbers of the first features to obtain a first processing result.
[0092] A bitwise OR operation is performed on the binary numbers of each first feature, that is, as long as one of the two binary digits involved in the operation is 1, the result is 1. For example, if the first custom feature includes both the first first feature and the third first feature, a bitwise OR operation is performed on 00…01 and 00…100 to obtain 00…0101. Through 00…0101, it can also be uniquely determined that the first custom feature includes the first first feature and the third first feature.
[0093] Exemplarily, for the convenience of description, the above binary number can be converted into a decimal number to obtain the first processing result.
[0094] When binary numbers are used to represent each first feature in the embodiment of the present application, the first processing result obtained can be made unique by performing a bitwise OR operation on each binary number, and based on the first processing result, each binary number involved in the operation can be uniquely determined, so that the form of the first custom feature can be uniquely determined.
[0095] Exemplarily, other conversion rules can also be used. For example, the first first feature can be expressed as 1, the second first feature as 10, the third first feature as 100, the fourth first feature as 1000, and so on. In this way, the uniqueness of the combined first feature can also be guaranteed. For example, 10001 can only be composed of the first first feature and the fifth first feature.
[0096] Exemplarily, the first processing result may also be expressed in the following form:
[0097] f(x)=a1*x b1 +a2*x b2 +a3*x b3 +…+a n *x bn
[0098] Where x is a number greater than 0 and not equal to 1. For example, when using binary numbers, x = 2, a n is 1 or 0, that is, when the nth first feature exists, a n =1, otherwise, a n = 0. bn can be rational numbers that are not equal to 0 and are different from each other, or can be in the form of logarithmic functions, exponential functions, power functions, etc.
[0099] In this way, no matter how many first features the first custom feature contains, they can all be converted into a unique decimal number in the end, which not only meets the requirement of fixed model input dimension, but also meets the user's customization requirement.
[0100] When there are multiple first custom features, the processing process of each first custom feature is similar. For example, if there are three first custom features, namely dictionary features, user multimodal features, and device features, the above scheme can be used to process the dictionary features, user multimodal features, and device features respectively to obtain the processing results corresponding to the dictionary features, the processing results corresponding to the user multimodal features, and the processing results corresponding to the device features. For example, when the processing result is 1-dimensional, each multi-dimensional dictionary feature, user multimodal feature, and device feature can be converted into a one-dimensional processing result to meet the model's requirements for input dimensions.
[0101] When performing semantic analysis, the embodiment of the present application can not only parse out the named entity corresponding to the first voice text, but also parse out the field to which the first voice text belongs and the user's intention. In this way, when other operations are subsequently performed based on the semantic analysis results, the accuracy of the execution results can be improved.
[0102] Based on this, in some embodiments, the first semantic parsing model may include a named entity recognition model and a classification model;
[0103] Accordingly, the above S130 may include the following steps:
[0104] Inputting the first text feature and the first processing result into a pre-trained named entity recognition model to obtain a named entity of the first speech text;
[0105] Inputting the first text feature and the first processing result into a pre-trained classification model to obtain the field to which the first voice text belongs and the user intention;
[0106] The named entity, the field to which the first voice text belongs, and the user intention are determined as a semantic parsing result.
[0107] The named entity recognition model is used to recognize the named entities of the first speech text, and the named entities may include, for example, names of people, places, and institutions. Exemplarily, the named entity recognition model may adopt a long short-term memory network (Long Short-Term Memory, LSTM). Before application, the named entity recognition model may be trained, and the embodiments of the present application do not limit the specific training process.
[0108] The first text feature and the first processing result are input into a pre-trained named entity recognition model to obtain a named entity of the first speech text. For example, for "play Zhang San's Rice Fragrance", it can be recognized that "Zhang San" is a person's name and "Rice Fragrance" is a song title.
[0109] The classification model is used to identify the field to which the first voice text belongs and the user's intention. For example, the classification model can use a convolutional neural network (CNN). For example, for "play Zhang San's Daoxiang", the classification model can identify that the voice text belongs to the music field and the user's intention is "play".
[0110] In this way, for "play Zhang San's Daoxiang", the semantic analysis result can be obtained as follows: the field belongs to the music field, Zhang San is a person's name, Daoxiang is the song title, and the user's intention is to play.
[0111] The execution process of the above-mentioned named entity recognition model and classification model can be performed simultaneously or in sequence, that is, the first text feature and the first processing result can be input into the pre-trained named entity recognition model, and the first text feature and the first processing result can be input into the pre-trained classification model at the same time; the first text feature and the first processing result can be input into the pre-trained named entity recognition model first, and after obtaining the named entity of the first voice text, the first text feature and the first processing result can be input into the pre-trained classification model; the first text feature and the first processing result can be input into the pre-trained classification model first, and the field and user intention to which the first voice text belongs can be obtained, and then the first text feature and the first processing result can be input into the pre-trained named entity recognition model.
[0112] It should be noted that when determining the named entity of the first voice text, the first custom feature may include dictionary features, user multimodal features and device features. At this time, the input dimension of the named entity recognition model relative to the first custom feature can be set to 3. Through the above processing scheme, each first custom feature can be converted into a processing result with a dimension of 1. In this way, when the feature category contained in each first custom feature changes, it can be converted into a decimal number with a dimension of 1 to ensure that the input dimension of the named entity recognition model remains unchanged, which can reduce the development work of the model and reduce the development cost.
[0113] When determining the field to which the first voice text belongs and the user's intention, exemplarily, the first custom feature may include speech features, user multimodal features and device features. The processing process of the speech features, user multimodal features and device features can be found in the named entity recognition model, which will not be repeated here for the sake of brevity.
[0114] After training, the above-mentioned named entity recognition model and classification model can be saved to the cloud (semantic parsing development platform). When it is necessary to parse the user's voice file, the corresponding named entity recognition model and classification model can be downloaded from the cloud, and the user's voice file can be parsed based on the downloaded named entity recognition model and classification model to obtain the semantic parsing result.
[0115] In the embodiments of the present application, whether it is a named entity recognition model or a classification model, when the category of the first custom feature changes, it can be converted into a processing result with a fixed dimension to meet the input requirements of the model, while also meeting the user's custom requirements, which not only improves the intelligence of the semantic parsing platform, but also enhances the user experience.
[0116] In some embodiments, after S130, the semantic parsing method may further include the following steps:
[0117] In response to the semantic parsing result, an operation corresponding to the semantic parsing result is performed.
[0118] For example, for “play Zhang San’s Rice Fragrance”, based on the semantic analysis results, the music player can be controlled to play Zhang San’s Rice Fragrance to meet the user’s needs.
[0119] Based on the same embodiment of the present application, a semantic parsing device is also provided. Figure 4 The semantic parsing device provided in the embodiment of the present application is described in detail.
[0120] Figure 5 A structural diagram of a semantic parsing device provided in an embodiment of the present application.
[0121] like Figure 5 As shown, the semantic parsing device may include:
[0122] An acquisition module 510 is used to acquire a first text feature and at least one first custom feature, where the first text feature is obtained by parsing the first speech text;
[0123] A processing module 520 is used to process each first custom feature, when the dimension of the first custom feature changes, to obtain a first processing result, where the dimension of the first processing result is fixed and the first processing result is used to uniquely identify the first custom feature;
[0124] The generation module 530 is used to input the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
[0125] The embodiment of the present application obtains a first text feature and at least one first custom feature, processes the first custom feature for each first custom feature when the dimension of the first custom feature changes, obtains a first processing result, inputs the first text feature and the first processing result into a pre-trained first semantic parsing model, and obtains a semantic parsing result of the first speech text, wherein the dimension of the first processing result is fixed, the first processing result is used to uniquely identify the first custom feature, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result. That is, when the dimension of the first custom feature changes in the embodiment of the present application, it can be converted into a processing result with a fixed dimension. Since the processing result is the same as the input dimension of the first semantic parsing model relative to the first custom feature, there is no need to change the structure of the first semantic parsing model, which can reduce the user's development work and thus reduce development costs.
[0126] In some embodiments, the first custom feature includes at least one type of first feature;
[0127] The processing module 520 includes:
[0128] a conversion unit, configured to convert each first feature according to a preset feature conversion rule when the category of the first feature changes, to obtain flag information of each first feature, where the flag information is used to indicate the corresponding first feature;
[0129] The operation unit is used to operate on the flag information of each first feature according to the operation rule to obtain the first processing result.
[0130] In some embodiments, the conversion unit is specifically configured to:
[0131] According to the base number conversion rule and in combination with the positional relationship of each first feature, each first feature is converted to obtain the base number of each first feature as the mark information of each first feature.
[0132] In some embodiments, the base number includes a binary number;
[0133] The computing unit is used to:
[0134] A bitwise OR operation is performed on the binary numbers of the first features to obtain a first processing result.
[0135] In some embodiments, the first semantic parsing model includes a named entity recognition model and a classification model;
[0136] The generating module 530 is specifically used for:
[0137] Inputting the first text feature and the first processing result into a pre-trained named entity recognition model to obtain a named entity of the first speech text;
[0138] Inputting the first text feature and the first processing result into a pre-trained classification model to obtain the field to which the first voice text belongs and the user intention;
[0139] The named entity, the field to which the first voice text belongs, and the user intention are determined as a semantic parsing result.
[0140] In some embodiments, the acquisition module 510 is specifically configured to:
[0141] Receiving a first input to a first control in a first interface;
[0142] In response to the first input, a custom feature setting interface is displayed, the custom feature setting interface including at least one of the following input areas for the custom feature: a feature category input area, a feature source input area, and a feature calculation method input area;
[0143] Based on input information of at least one input area, a newly added first custom feature is determined.
[0144] In some embodiments, the custom feature setting interface further includes a custom feature statistics area, and the custom feature statistics area is used to display the number of features included in each type of newly added first custom feature.
[0145] In some embodiments, the semantic parsing device may further include:
[0146] The response module is used to input the first text feature and the first processing result into the pre-trained first semantic parsing model after the generation module 530 obtains the semantic parsing result of the first voice text, and then respond to the semantic parsing result and perform an operation corresponding to the semantic parsing result.
[0147] Figure 5 Each module in the device shown has the function of realizing Figure 1-Figure 4 The functions of each step in the process can achieve the corresponding technical effects, so for the sake of brevity, they will not be described in detail here.
[0148] Based on the same inventive concept, the embodiment of the present application also provides an electronic device, which may be, for example, a projection device, a mobile phone, a computer, etc. Figure 6 The electronic device provided in the embodiments of the present application is described in detail.
[0149] like Figure 6 As shown, the electronic device may include a processor 610 and a memory 620 for storing computer program instructions.
[0150] The processor 610 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0151] The memory 620 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 620 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 620 may include a removable or non-removable (or fixed) medium, or the memory 620 is a non-volatile solid-state memory. In one example, the memory 620 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0152] The processor 610 reads and executes the computer program instructions stored in the memory 620 to implement Figure 1-Figure 4 The method in the embodiment shown in the figure is achieved Figure 1-Figure 4 The corresponding technical effects achieved by executing the method in the illustrated embodiment are not described in detail here for the sake of brevity.
[0153] In one example, the electronic device may further include a communication interface 630 and a bus 640. Figure 6 As shown, the processor 610, the memory 620, and the communication interface 630 are connected via a bus 640 and communicate with each other.
[0154] The communication interface 630 is mainly used to implement communication between various modules, devices and / or equipment in the embodiments of the present application.
[0155] Bus 640 includes hardware, software or both, and each component of electronic device is coupled to each other.For example, but not limitation, bus 640 may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), hypertransmission (Hyper Transport, HT) interconnection, industry standard architecture (IndustryStandard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 640 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0156] After acquiring the first text feature and at least one first custom feature, the electronic device can execute the semantic parsing method in the embodiment of the present application, thereby realizing the combination of Figure 1-Figure 4 The semantic parsing method described and Figure 5 Describes the semantic parsing device.
[0157] In addition, in combination with the semantic parsing method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the semantic parsing methods in the above embodiment is implemented.
[0158] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0159] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0160] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0161] The above reference is according to the method of the present application embodiment, the flow chart of the device (system) and the computer program product and / or the block diagram of the present application embodiment. It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0162] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A semantic parsing method, characterized in that: include: Acquire a first text feature and at least one first custom feature, wherein the first text feature is obtained by parsing a first voice text; For each of the first custom features, in the case where the dimension of the first custom feature changes, the first custom feature is processed to obtain a first processing result, the dimension of the first processing result is fixed, and the first processing result is used to uniquely identify the first custom feature; The first text feature and the first processing result are input into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, wherein the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
2. The method according to claim 1, characterized in that The first custom feature includes at least one type of first feature; When the dimension of the first custom feature changes, processing the first custom feature to obtain a first processing result includes: When the category of the first feature changes, convert each of the first features according to a preset feature conversion rule to obtain flag information of each of the first features, where the flag information is used to indicate the corresponding first feature; According to the operation rules, the flag information of each of the first features is operated to obtain a first processing result.
3. The method according to claim 2, characterized in that The converting each of the first features according to a preset feature conversion rule to obtain the flag information of each of the first features includes: According to the base number conversion rule and in combination with the positional relationship of each of the first features, each of the first features is converted to obtain the base number of each of the first features as the mark information of each of the first features.
4. The method according to claim 3, characterized in that The base number includes a binary number; The step of computing the flag information of each of the first features according to the computing rule to obtain a first processing result includes: A bitwise OR operation is performed on the binary numbers of the first features to obtain a first processing result.
5. The method according to claim 1, characterized in that The first semantic parsing model includes a named entity recognition model and a classification model; The step of inputting the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text includes: Inputting the first text feature and the first processing result into a pre-trained named entity recognition model to obtain the named entity of the first speech text; Inputting the first text feature and the first processing result into a pre-trained classification model to obtain the field to which the first voice text belongs and the user intention; The named entity, the field to which the first voice text belongs, and the user intention are determined as a semantic parsing result.
6. The method according to any one of claims 1 to 5, characterized in that: The obtaining of at least one first custom feature includes: Receiving a first input to a first control in a first interface; In response to the first input, displaying a custom feature setting interface, the custom feature setting interface including at least one of the following input areas for custom features: a feature category input area, a feature source input area, and a feature calculation method input area; Based on the input information of the at least one input area, a newly added first custom feature is determined.
7. The method according to claim 6, characterized in that The custom feature setting interface also includes a custom feature statistics area, and the custom feature statistics area is used to display the number of features included in each type of newly added first custom feature.
8. The method according to any one of claims 1 to 5, characterized in that: After inputting the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, the method further includes: In response to the semantic parsing result, an operation corresponding to the semantic parsing result is performed.
9. A semantic analysis device, characterized in that: include: An acquisition module, used to acquire a first text feature and at least one first custom feature, wherein the first text feature is obtained by parsing a first speech text; a processing module, configured to process each of the first custom features, when the dimension of the first custom feature changes, to obtain a first processing result, wherein the dimension of the first processing result is fixed, and the first processing result is used to uniquely identify the first custom feature; A generation module is used to input the first text feature and the first processing result into a pre-trained first semantic parsing model to obtain a semantic parsing result of the first speech text, and the input dimension of the first semantic parsing model relative to the first custom feature is the same as the dimension of the first processing result.
10. An electronic device, characterized in that: include: processor; a memory for storing computer program instructions; When the computer program instructions are executed by the processor, the method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
