Semantic parsing method, device, medium and electronic device based on machine learning
Through the semantic parsing solution based on machine learning, using preset models and real-time environment information, the problem of low semantic parsing efficiency and low accuracy caused by different user outputs is solved, and efficient and accurate semantic parsing results are achieved.
Patent Information
- Application Number
- CN201910879338.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-09-18
AI Technical Summary
During semantic parsing in the prior art, for the same semantic parsing result, the initial information output by the user is different, resulting in low parsing efficiency and low accuracy. Moreover, the same user expresses in various ways at different times, making it difficult to ensure the efficiency and accuracy of semantic parsing. sex.
Using a semantic parsing solution based on machine learning, the input information to be processed is converted into pre-input information through a preset machine learning model, and the pre-trained model is used to obtain the predictive semantic template, combined with real-time environment information to constrain and generate constraints. After the semantic template, the semantic parsing result is finally obtained.
It improves the accuracy and efficiency of semantic analysis, can accurately analyze user intentions under different users and at different times, adapt to diverse expression methods, and meet the needs of real-time environments.
Smart Images

Figure CN110688859B
Abstract
Description
Background Art
[0002] Semantic parsing is to parse a piece of information output by the user to obtain the semantic parsing result that the user wants to output for a certain object.
[0003] At present, when performing semantic analysis, for the same semantic analysis result, the initial information output by different legal users is usually different, and the same user may have various expressions at different times. For example, when the air conditioner needs to be turned on, different users, or even the same user, will have many ways of expression. For the analysis of the initial information output by the user, there are multiple semantic analysis results, and the efficiency is difficult to guarantee. Therefore, there is a problem in the prior art that the fixed analysis method is used to parse user semantics with low efficiency and low accuracy.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of this application is to provide a semantic parsing solution based on machine learning, and then to parse and obtain a semantic template based on various input information, at least to a certain extent, based on a preset machine learning model, thereby effectively ensuring the accuracy and efficiency of semantic parsing.
[0006] According to one aspect of the present application, a semantic parsing method based on machine learning is provided, comprising:
[0007] When receiving input information to be processed, converting the input information to be processed into pre-input information;
[0008] Inputting the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed;
[0009] Acquire semantic template constraint information when receiving input information to be processed, and input it into a prediction semantic template constraint model together with the prediction semantic template, and output the constrained prediction semantic template, wherein the semantic template constraint information is real-time environment information related to the input information;
[0010] According to the constrained semantic template, converting the input information to be processed into pre-parsed data;
[0011] According to the pre-parsed data, a semantic parsing result of the input information to be processed is obtained.
[0012] In an exemplary embodiment of the present application, when the input information to be processed is in text form, upon receiving the input information to be processed, converting the input information to be processed into pre-input information includes:
[0013] According to the text of the input information to be processed, searching a word vector dictionary to obtain a word vector for each word in the text;
[0014] The word vectors are concatenated into a word vector string as the pre-input information.
[0015] In an exemplary embodiment of the present application, if the received input information to be processed is in a non-text form,
[0016] When receiving the input information to be processed, converting the input information to be processed into pre-input information includes:
[0017] Converting the non-textual input information to be processed into textual form;
[0018] The input information to be processed in text form is converted into pre-input information.
[0019] In an exemplary embodiment of the present application, the training method of the machine learning model is:
[0020] Collecting a set of input information samples to be processed, wherein the input information samples to be processed are pre-labeled with corresponding semantic templates;
[0021] Convert each of the input information samples to be processed into pre-input information;
[0022] Inputting the pre-input information obtained by transforming each of the input information samples to be processed into a machine learning model to obtain a semantic template corresponding to each of the input information samples to be processed;
[0023] If there is a semantic template output by the machine learning model for the input information sample to be processed that is inconsistent with the semantic template calibrated in advance for the sample, adjust the coefficient of the machine learning model until the semantic template output by the machine learning model for the input information sample to be processed is consistent with the semantic template calibrated in advance for the sample;
[0024] If the semantic template output by the machine learning model for all the input information samples to be processed is consistent with the semantic template pre-calibrated for each of the samples, the training is completed.
[0025] In an exemplary embodiment of the present application, according to the application environment type of each of the input information to be processed, a machine learning model suitable for each of the application environment types is trained, and the inputting of the pre-input information into the pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed includes:
[0026] Obtaining the application environment type corresponding to the pre-input information;
[0027] According to the application environment type, searching for a machine learning model corresponding to the application environment type;
[0028] The pre-input information is input into a machine learning model corresponding to the application environment type to obtain a prediction semantic template corresponding to the input information to be processed.
[0029] In an exemplary embodiment of the present application, after inputting the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed, the method further includes:
[0030] Acquire semantic blocks constituting the predicted semantic template;
[0031] Determining whether necessary semantic blocks are missing from the semantic blocks constituting the predicted semantic template;
[0032] If a necessary semantic block is missing, a necessary to-be-processed input information supplementation instruction is issued to the user to supplement the necessary to-be-processed input information corresponding to the type of the missing necessary semantic block.
[0033] In an exemplary embodiment of the present application, after issuing a supplementary instruction to the user to supplement the necessary input information to be processed corresponding to the type of the missing necessary semantic block if the necessary semantic block is missing, the method further includes:
[0034] When necessary input information to be processed corresponding to the type of the missing necessary semantic block is received, the necessary input information to be processed and the previous input information to be processed are converted into pre-input information;
[0035] Inputting the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the necessary input information to be processed and the previous input information to be processed;
[0036] According to the prediction semantic template, converting the necessary input information to be processed and the previous input information to be processed into pre-parsed data;
[0037] According to the pre-parsed data, a semantic parsing result of the input information to be processed is obtained.
[0038] According to one aspect of the present application, a semantic parsing device based on machine learning is provided, characterized in that it includes:
[0039] A preprocessing module, configured to convert the input information to be processed into pre-input information upon receiving the input information to be processed;
[0040] A template parsing module, used to input the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed;
[0041] A template constraint module is used to obtain semantic template constraint information when receiving input information to be processed, and input the semantic template constraint information together with the predicted semantic template into a predicted semantic template constraint model, and output the constrained predicted semantic template, wherein the semantic template constraint information is real-time environmental information related to the input information;
[0042] A conversion module, used for converting the input information to be processed into pre-parsed data according to the constrained semantic template;
[0043] The acquisition module is used to acquire the semantic analysis result of the input information to be processed according to the pre-analysis data.
[0044] According to one aspect of the present application, a computer-readable storage medium is provided, on which a semantic parsing program based on machine learning is stored, characterized in that the semantic parsing program based on machine learning implements any of the methods described above when executed by a processor.
[0045] According to one aspect of the present application, there is provided an electronic device, characterized in that it includes:
[0046] Processor; and
[0047] A memory for storing a semantic parsing program based on machine learning of the processor; wherein the processor is configured to execute any of the above-mentioned methods by executing the semantic parsing program based on machine learning.
[0048] The present application discloses a semantic parsing method and related device based on machine learning. First, when receiving input information to be processed, the input information to be processed is converted into pre-input information; in this way, various forms of input information to be processed can be converted into pre-input information that can be input into a machine learning model. Furthermore, the pre-input information is input into a pre-trained machine learning model, and the predicted semantic template corresponding to the input information to be processed can be accurately and efficiently obtained. Secondly, the semantic template constraint information when the input information to be processed is received is obtained, and the predicted semantic template constraint model is input together with the predicted semantic template, and the predicted semantic template after constraint is output, and the semantic template constraint information is the real-time environment information related to the input information; in this way, the semantic template predicted by the real-time environment information constraint can be further guaranteed to be accurate. Then, according to the constrained semantic template, the input information to be processed is converted into pre-parsed data; in this way, the input information to be processed can be parsed based on the constrained semantic template to obtain pre-parsed data that meets the acceptance requirements of the acceptance object. Finally, according to the pre-parsed data, the semantic parsing result of the input information to be processed is obtained; and the result that can be directly accepted by the acceptance object is obtained. In this way, based on the preset machine learning model, the predicted semantic template is parsed according to various input information, thereby effectively ensuring the accuracy and efficiency of semantic parsing.
[0049] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 A flowchart of a semantic parsing method based on machine learning is schematically shown.
[0052] Figure 2 A flow chart of a method for obtaining pre-input information is schematically shown.
[0053] Figure 3 A flow chart of a method for obtaining input information supplementary instructions is schematically shown.
[0054] Figure 4 A block diagram of a semantic parsing device based on machine learning is schematically shown.
[0055] Figure 5An example block diagram of an electronic device for implementing the above-mentioned semantic parsing method based on machine learning is schematically shown.
[0056] Figure 6 A computer-readable storage medium for implementing the above-mentioned semantic parsing method based on machine learning is schematically shown. DETAILED DESCRIPTION
[0057] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present application will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present application.
[0058] In addition, the accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0059] In this exemplary embodiment, a semantic parsing method based on machine learning is first provided. The semantic parsing method based on machine learning can be run on a server, a server cluster, a cloud server, etc. Of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the semantic parsing method based on machine learning may include the following steps:
[0060] Step S110, when receiving input information to be processed, converting the input information to be processed into pre-input information;
[0061] Step S120, inputting the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed;
[0062] Step S130, obtaining semantic template constraint information when receiving input information to be processed, and inputting the semantic template constraint information together with the predicted semantic template into a predicted semantic template constraint model, and outputting the constrained predicted semantic template, wherein the semantic template constraint information is real-time environment information related to the input information;
[0063] Step S140, converting the input information to be processed into pre-parsed data according to the constrained semantic template;
[0064] Step S150: obtaining a semantic parsing result of the input information to be processed according to the pre-parsing data.
[0065] In the above-mentioned semantic parsing method based on machine learning, first, when the input information to be processed is received, the input information to be processed is converted into pre-input information; in this way, various forms of input information to be processed can be converted into pre-input information that can be input into the machine learning model. Then, the pre-input information is input into the pre-trained machine learning model, and the predicted semantic template corresponding to the input information to be processed can be accurately and efficiently obtained. Secondly, the semantic template constraint information when the input information to be processed is received is obtained, and the predicted semantic template constraint model is input together with the predicted semantic template, and the predicted semantic template after constraint is output, and the semantic template constraint information is the real-time environment information related to the input information; in this way, the semantic template predicted by the real-time environment information constraint can be further guaranteed. Then, according to the constrained semantic template, the input information to be processed is converted into pre-parsed data; in this way, the input information to be processed can be parsed based on the constrained semantic template to obtain pre-parsed data that meets the acceptance requirements of the acceptance object. Finally, according to the pre-parsed data, the semantic parsing result of the input information to be processed is obtained; and the result that can be directly accepted by the acceptance object is obtained. In this way, based on the preset machine learning model, the predicted semantic template is parsed according to various input information, thereby effectively ensuring the accuracy and efficiency of semantic parsing.
[0066] Below, each step in the semantic parsing method based on machine learning in this example implementation will be explained and illustrated in detail with reference to the accompanying drawings.
[0067] In step S110, when input information to be processed is received, the input information to be processed is converted into pre-input information.
[0068] In the implementation of this example, the input information to be processed is the information in which the user expresses his inner thoughts in a certain application environment. However, when this information is used in a specific application, it is necessary to parse the inner thoughts contained therein according to the current input information, and at the same time parse the inner thoughts into parsing results that can be implemented in a specific application environment, that is, semantic parsing results. For example, when it is necessary to purchase an insurance product, in the application for purchasing insurance, the user inputs: "I want to know about Insurance Package A". At this time, "I want to know about Insurance Package A" is the input information to be processed. At this time, it is necessary to parse the input information to be processed into a semantic parsing result that can be recognized by the insurance app, for example: "get-the Insurancea package-data". After receiving the input information to be processed, it is necessary to perform semantic parsing in the subsequent steps to convert the input information to be processed into pre-input information. On the basis of ensuring that the input information to be processed is accurately represented, it is convenient to calculate and parse in the subsequent steps to improve efficiency. Among them, the pre-input information can be obtained, for example, by converting the input information to be processed into a vector form.
[0069] In one implementation of this example, when the input information to be processed is in text form, upon receiving the input information to be processed, converting the input information to be processed into pre-input information includes:
[0070] According to the text of the input information to be processed, searching a word vector dictionary to obtain a word vector for each word in the text;
[0071] The word vectors are concatenated into a word vector string as the pre-input information.
[0072] The word vector dictionary stores vectors corresponding to various words. It can look up the word vector of each word corresponding to the text of each input information to be processed, and concatenate the word vectors into a word vector string as pre-input information for calculation by machine learning models.
[0073] In one implementation of this example, the word vectors are concatenated into a word vector string as the pre-input information, including:
[0074] According to the order of the words corresponding to the word vectors in the text, the word vectors are concatenated into a word vector string as the pre-input information.
[0075] In one implementation of this example, the word vectors are concatenated into a word vector string as the pre-input information, including:
[0076] The word vectors are serially connected in random order to form a word vector string as the pre-input information.
[0077] In one implementation of this example, when the input information to be processed is in text form, upon receiving the input information to be processed, converting the input information to be processed into pre-input information includes:
[0078] Segmenting the text of the input information to be processed to obtain each character and word constituting the text;
[0079] From a word vector dictionary, find the word vector of each word and the word vector of each word constituting the text;
[0080] The character vector of each character and the word vector of the word are concatenated into a vector string as the pre-input information.
[0081] Text segmentation is to use existing text segmentation to decompose "I want to know about children's insurance" into "I", "want", "know", "children", "insurance". Then, from the word vector dictionary, the word vector of each word and the word vector of each word that constitutes the text can be found, which can effectively ensure the initial semantic connotation of the input information to be processed.
[0082] In one implementation of this example, refer to Figure 2 As shown, if the received input information to be processed is in non-text form,
[0083] When receiving the input information to be processed, converting the input information to be processed into pre-input information includes:
[0084] Step S210, converting the input information to be processed in the non-text form into a text form;
[0085] Step S220: converting the input information to be processed in text form into pre-input information.
[0086] The input information to be processed in non-text form is, for example, voice information input by a user. Voice information can be converted into input information to be processed in text form through voice recognition, and then the input information to be processed in non-text form in voice form can be processed.
[0087] In step S120, the pre-input information is input into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed.
[0088] In the implementation of this example, the prediction semantic template is a prediction semantic template corresponding to the input information to be processed in various application environments, including the implementation elements required to implement the inherent ideas expressed by each input information to be processed. In an application environment, the prediction semantic template can be, for example: "obtain" + "insurance package A" + "information"; where "obtain" is the implementation action element, "insurance package A" is the implementation object element, and "information" is the implementation object attribute element.
[0089] In an application environment, when users express the same idea, the input information to be processed can be expressed in many personalized ways. In the related art, the method of matching the input information to be processed input by the user with the preset prediction semantic template by using the preset prediction semantic template to parse the inner idea of the input information to be processed is very limited by the user's input information. For example, when the user inputs "I'm so hot, do you know about air conditioning?", matching through the preset prediction semantic template will only parse out the implementation object element "air conditioning", which cannot achieve the purpose of accurate parsing.
[0090] In this embodiment, by converting the input information to be processed into pre-input information, and inputting a large amount of input information to be processed in various expressions as a sample trained machine learning model, the prediction semantic template corresponding to the input information to be processed can be automatically and accurately obtained with high accuracy and efficiency. For example, after inputting the feature vector data of "I'm so hot, do you know about air conditioning?" into machine learning, the prediction semantic template of "turn on" + "air conditioning" can be accurately obtained. Through the pre-trained machine learning model, the efficiency and accuracy of obtaining the prediction semantic template can be effectively guaranteed.
[0091] In one implementation of this example, the training method of the machine learning model is:
[0092] Collecting a set of input information samples to be processed, wherein the input information samples to be processed are pre-calibrated with corresponding prediction semantic templates;
[0093] Convert each of the input information samples to be processed into pre-input information;
[0094] Inputting the pre-input information obtained by transforming each of the input information samples to be processed into a machine learning model to obtain a prediction semantic template corresponding to each of the input information samples to be processed;
[0095] If there is a prediction semantic template output by the machine learning model for the input information sample to be processed that is inconsistent with the prediction semantic template calibrated in advance for the sample, adjust the coefficient of the machine learning model until the prediction semantic template output by the machine learning model for the input information sample to be processed is consistent with the prediction semantic template calibrated in advance for the sample;
[0096] If the prediction semantic template output by the machine learning model for all the input information samples to be processed is consistent with the prediction semantic template pre-calibrated for each of the samples, the training is completed.
[0097] In one implementation of this example, according to the application environment type of each input information to be processed, a machine learning model applicable to each application environment type is trained, and the pre-input information is input into the pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed, including:
[0098] Obtaining the application environment type corresponding to the pre-input information;
[0099] According to the application environment type, searching for a machine learning model corresponding to the application environment type;
[0100] The pre-input information is input into a machine learning model corresponding to the application environment type to obtain a prediction semantic template corresponding to the input information to be processed.
[0101] The application environment type is the acceptance environment of the input information to be processed, for example, the acceptance environment is various environments such as air-conditioning terminals, mobile phones, and televisions. The machine learning model suitable for each application environment type can be trained according to needs to ensure the accuracy of the prediction semantic template corresponding to the input information to be processed.
[0102] In one implementation of this example, according to the application environment types of all the input information to be processed, a machine learning model applicable to all the application environment types is trained, and the pre-input information is input into the pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed, including:
[0103] The pre-input information is input into the machine learning model applicable to all the application environment types to obtain a prediction semantic template corresponding to the input information to be processed.
[0104] In step S130, the semantic template constraint information is obtained when the input information to be processed is received, and is input into the predicted semantic template constraint model together with the predicted semantic template to output the constrained predicted semantic template, wherein the semantic template constraint information is real-time environment information related to the input information.
[0105] The semantic template constraint information is the real-time environment information related to the input information, including at least one of the following three levels of related environment information: the first level: the user's voice voiceprint information (the voice audio information when the user inputs information by voice, etc.), the second level: the use environment information of the receiving device associated with the input information (such as counter machine, portable terminal, home machine, etc.), and the third level: weather related information when the input information is received (such as real-time temperature, whether it is raining, etc.). The above three levels of information can be easily obtained through networking or direct reception. Among them, the more the three levels of information are obtained, the better the constraint effect on the semantic template. For example, when the predicted semantic template is: "Get" + "Insurance Package A" + "Information"; the semantic template after constraint is: <Paging> "Get" + "Insurance Package A" + <Transmittable> "Information"; or, when the predicted semantic template is: "Open" + "Air Conditioning", the semantic template after constraint is: <Immediately> <Dry> "Open" + "Air Conditioning".
[0106] In this way, based on the prediction of the received input information, the predicted semantic template can be further constrained to a constrained semantic template that is compatible with the real-time environment, thereby improving the flexibility of semantic parsing.
[0107] In one implementation of this example, the training method of the prediction semantic template constraint model is:
[0108] Collect semantic template constraint information and predict a semantic template sample set, where each sample is pre-calibrated with a corresponding semantic constraint template;
[0109] Inputting the sample into a machine learning model to obtain a prediction semantic constraint template corresponding to the sample;
[0110] If there is a predicted semantic constraint template output by the machine learning model for the sample that is inconsistent with the semantic constraint template calibrated in advance for the sample, adjust the coefficients of the machine learning model until the predicted semantic constraint template output by the machine learning model for the sample is consistent with the semantic constraint template calibrated in advance for the sample;
[0111] If the predicted semantic constraint template output by the machine learning model for all the samples is consistent with the semantic constraint template pre-calibrated for each of the samples, the training is completed.
[0112] In step S140, the input information to be processed is converted into pre-parsed data according to the constrained semantic template.
[0113] In the implementation of this example, the data received by the device that receives the input information to be processed usually has many forms. For example, the data received by one receiving device is in the form of "implementation object attribute-implementation object-implementation action", while the data received by another receiving device is in the form of "implementation action@implementation object-implementation object attribute".
[0114] Generating pre-parsed data means obtaining pre-parsed data of the corresponding form in advance according to the form of the received data of the device that accepts the input information to be processed. In the subsequent steps, only language mode conversion is required to accurately obtain the semantic parsing results of the device suitable for the input information to be processed.
[0115] In one implementation of this example, converting the input information to be processed into pre-parsed data according to the constrained semantic template includes:
[0116] Acquire data receiving requirements corresponding to the application environment type of the input information to be processed;
[0117] According to the data receiving requirement and based on the constrained semantic template, the input information to be processed is converted into pre-parsed data.
[0118] The data receiving requirements corresponding to the application environment type are, for example, the data receiving form of a receiving device is: Implementing Object Properties - Target <c> Implement action", and the data receiving form of another receiving device is:< / c> Implement action@implementation object - <c>Implement object attributes". This embodiment can accurately convert the input information to be processed into pre-parsed data according to different application environment types.
[0119] In step S150, a semantic parsing result of the input information to be processed is obtained according to the pre-parsing data.
[0120] In the implementation of this example, the semantic parsing result is data that can be recognized by the device that accepts the input information to be processed, such as machine language. Pre-parsed data is data that has been converted into the corresponding format requirements. The semantic parsing result of the input information to be processed can be obtained by performing a simple language instruction conversion on the pre-parsed data. For example, "<Pagination> Get @Insurance A Package-<Transferable Type> Information" is converted into data that can be recognized by the insurance purchase app, that is, the semantic parsing result is pre-prepared according to the data format requirements of the app instructions, such as "(fy)Gain@insur-a(ts)pk". The method for obtaining the semantic parsing result of the input information to be processed can be to pre-save the parsed data blocks and corresponding parsing results in various pre-parsed data in a database according to the corresponding relationship, and the corresponding parsing results can be queried based on the parsed data blocks, and then the semantic parsing result of the entire input information to be processed can be formed. Among them, if the pre-parsed data is "<Paging> Get@Insurance A Package-<Transferable Type> Data", the parsed data block is <Paging> "Get", "Insurance A Package", <Transferable Type> "Data", and the corresponding parsing results are (fy) "Gain", "insur-a" and (ts) "pk".
[0121] In one implementation of this example, obtaining a semantic parsing result of the input information to be processed according to the pre-parsed data includes:
[0122] Acquire each sub-pre-parsed data constituting the pre-parsed data;
[0123] Searching for the sub-semantic parsing result corresponding to each sub-pre-parsed data from the database;
[0124] The sub-semantic parsing results are combined into a semantic parsing result of the input information to be processed.
[0125] For example, if the pre-parsed data is "<page>Get@Insurance A Package-<Transferable Type>Data", the sub-pre-parsed data are <page>"Get", "Insurance A Package", <Transferable Type>"Data", and the corresponding sub-semantic parsing results are (fy)"Gain", "insur-a" and (ts)"pk".
[0126] In one implementation of this example, refer to< / c> Figure 3 As shown, after the pre-input information is input into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed, the method further includes:
[0127] Step S310, obtaining semantic blocks constituting the predicted semantic template;
[0128] Step S320, determining whether the semantic blocks constituting the predicted semantic template lack necessary semantic blocks;
[0129] Step S330: If a necessary semantic block is missing, a necessary to-be-processed input information supplementation instruction is issued to the user to supplement the necessary to-be-processed input information corresponding to the type of the missing necessary semantic block.
[0130] If the predicted semantic template is "get" + "insurance package A" + "information", then the semantic blocks are "get", "insurance package A" and
[0131] "Information". The necessary semantic block is an indispensable semantic block for the prediction semantic template to express the inner idea of the input information to be processed. For example, if the semantic block "Insurance Package A" is missing from the prediction semantic template "Get" + "Insurance Package A" + "Information", the implementation object of the input information to be processed corresponding to the prediction semantic template is unknown. In this embodiment, the prediction semantic template output by the machine learning model lacks the necessary semantic block, indicating that the input information to be processed that is initially input lacks the necessary input information itself, and the necessary input information can be accurately obtained through supplementary instructions. This ensures the integrity and practicality of the semantic parsing results.
[0132] In one implementation of this example, after issuing a supplementary instruction to the user to supplement the necessary input information to be processed corresponding to the type of the missing necessary semantic block if the necessary semantic block is missing, the method further includes:
[0133] When necessary input information to be processed corresponding to the type of the missing necessary semantic block is received, the necessary input information to be processed and the previous input information to be processed are converted into pre-input information;
[0134] Inputting the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the necessary input information to be processed and the previous input information to be processed;
[0135] According to the prediction semantic template, converting the necessary input information to be processed and the previous input information to be processed into pre-parsed data;
[0136] According to the pre-parsed data, a semantic parsing result of the input information to be processed is obtained.
[0137] This application also provides a semantic parsing device based on machine learning. Figure 4 As shown, the semantic parsing device based on machine learning may include a preprocessing module 410, a template parsing module 420, a template constraint module 430, a conversion module 440 and an acquisition module 450. Among them:
[0138] The pre-processing module 410 may be used to convert the input information to be processed into pre-input information when receiving the input information to be processed;
[0139] The template parsing module 420 may be used to input the pre-input information into a pre-trained machine learning model to obtain a prediction semantic template corresponding to the input information to be processed;
[0140] The template constraint module 430 may be used to obtain semantic template constraint information when receiving input information to be processed, and input the semantic template constraint information together with the predicted semantic template into a predicted semantic template constraint model, and output the constrained predicted semantic template, wherein the semantic template constraint information is real-time environment information related to the input information;
[0141] The conversion module 440 may be used to convert the input information to be processed into pre-parsed data according to the constrained semantic template;
[0142] The acquisition module 450 may be configured to acquire the semantic analysis result of the input information to be processed according to the pre-analysis data.
[0143] The specific details of each module in the above-mentioned semantic parsing device based on machine learning have been described in detail in the corresponding semantic parsing method based on machine learning, so they will not be repeated here.
[0144] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0145] In addition, although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0146] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0147] In an exemplary embodiment of the present application, an electronic device capable of implementing the above method is also provided.
[0148] Those skilled in the art will appreciate that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0149] Refer to the following Figure 5 The electronic device 500 according to this embodiment of the present invention is described. Figure 5 The electronic device 500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0150] like Figure 5 As shown, the electronic device 500 is in the form of a general computing device. The components of the electronic device 500 may include but are not limited to: at least one processing unit 510, at least one storage unit 520, and a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510).
[0151] The storage unit stores program codes, which can be executed by the processing unit 510, so that the processing unit 510 performs the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit 510 can perform the following steps: Figure 1 Step S110 shown in: when receiving input information to be processed, converting the input information to be processed into pre-input information; S120: inputting the pre-input information into a pre-trained machine learning model to obtain a predictive semantic template corresponding to the input information to be processed; step S130: according to the predictive semantic template, converting the input information to be processed into pre-parsed data; step S140: obtaining the semantic template constraint information when the input information to be processed is received, and inputting the predictive semantic template constraint model together with the predictive semantic template, and outputting the constrained predictive semantic template, wherein the semantic template constraint information is real-time environmental information related to the input information; step S150: according to the pre-parsed data, obtaining the semantic parsing result of the input information to be processed.
[0152] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202 , and may further include a read-only storage unit (ROM) 5203 .
[0153] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0154] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0155] The electronic device 500 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a client to interact with the electronic device 500, and / or any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 550, which may include a display unit 540 connected to the input / output (I / O) interface 550. Furthermore, the electronic device 500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 560. As shown, the network adapter 560 communicates with other modules of the electronic device 500 via a bus 530. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0156] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0157] In an exemplary embodiment of the present application, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0158] refer to Figure 6 As shown, a program product 600 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0159] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0160] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0161] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0162] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the client computing device, partially on the client device, as a separate software package, partially on the client computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the client computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0163] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0164] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present application are indicated by the claims.
Claims
1. A semantic parsing method based on machine learning, It is characterized in that include: When receiving input information to be processed, converting the input information to be processed into pre-input information; According to the application environment type of each input information to be processed, training a machine learning model applicable to each application environment type; Obtaining the application environment type corresponding to the pre-input information; According to the application environment type, searching for a machine learning model corresponding to the application environment type; Inputting the pre-input information into a machine learning model corresponding to the application environment type to obtain a prediction semantic template corresponding to the input information to be processed; Acquire semantic blocks constituting the predicted semantic template; Determining whether the semantic blocks constituting the prediction semantic template lack necessary semantic blocks, wherein the necessary semantic blocks refer to semantic blocks that are indispensable for the prediction semantic template to express the inner idea of the input information to be processed; If a necessary semantic block is missing, a necessary to-be-processed input information supplementation instruction corresponding to the type of the missing necessary semantic block is issued to the user; When necessary input information to be processed corresponding to the type of the missing necessary semantic block is received, the necessary input information to be processed and the previous input information to be processed are converted into pre-input information; Inputting the pre-input information into a pre-trained machine learning model to obtain a new prediction semantic template corresponding to the necessary input information to be processed and the previous input information to be processed; According to the new prediction semantic template, the necessary input information to be processed and the previous input information to be processed are converted into pre-parsed data; According to the pre-parsed data, a semantic parsing result of the input information to be processed is obtained.
2. The method according to claim 1, It is characterized in that When receiving the input information to be processed, converting the input information to be processed into pre-input information includes: When receiving input information to be processed, and the input information to be processed is in text form, searching a word vector dictionary according to the text of the input information to be processed to obtain a word vector for each word in the text; The word vectors are concatenated into a word vector string as pre-input information.
3. The method according to claim 1, It is characterized in that If the received input information to be processed is in non-text form, When receiving the input information to be processed, converting the input information to be processed into pre-input information includes: Converting the non-textual input information to be processed into textual form; The input information to be processed in text form is converted into pre-input information.
4. The method according to claim 1, It is characterized in that The training method of the machine learning model is: Collecting a set of input information samples to be processed, wherein the input information samples to be processed are pre-labeled with corresponding semantic templates; Convert each of the input information samples to be processed into pre-input information; Inputting the pre-input information obtained by transforming each of the input information samples to be processed into a machine learning model to obtain a semantic template corresponding to each of the input information samples to be processed; If there is a semantic template output by the machine learning model for the input information sample to be processed that is inconsistent with the semantic template calibrated in advance for the sample, adjust the coefficient of the machine learning model until the semantic template output by the machine learning model for the input information sample to be processed is consistent with the semantic template calibrated in advance for the sample; If the semantic template output by the machine learning model for all the input information samples to be processed is consistent with the semantic template pre-calibrated for each of the samples, the training is completed.
5. A computer-readable storage medium having a semantic parsing program based on machine learning stored thereon, It is characterized in that The semantic parsing program based on machine learning, when executed by a processor, implements the method described in any one of claims 1-4.
6. An electronic device, It is characterized in that include: processor; as well as A memory for storing a machine learning-based semantic parsing program of the processor; wherein the processor is configured to execute the method described in any one of claims 1-4 by executing the machine learning-based semantic parsing program.
