Natural language processing method, device, equipment, medium and program product
Through the combination of neural network model and preset arbitration list, the target analysis results in natural language processing are screened, and the problems of large amount of calculation and low recognition efficiency based on grammatical rule matching are solved, and more efficient natural language processing is achieved.
Patent Information
- Application Number
- CN202210189244.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2042-02-28
AI Technical Summary
The existing natural language processing method based on grammatical rule matching has large calculations, high resource consumption and low recognition efficiency.
The neural network model is used to perform initial parsing of the parsed text, determine the syntax tree, and filter out the target parsing results from the initial parsing results and the secondary parsing results through the preset arbitration list, reducing the calculation amount and resource consumption.
It improves the recognition efficiency of natural language processing, reduces the calculation amount and resource consumption, and enhances the accuracy of recognition.
Smart Images

Figure CN114548093B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a natural language processing method, apparatus, device, medium and program product. Background Art
[0002] Natural language recognition based on grammatical rule matching is one of the commonly used recognition methods in natural language processing.
[0003] The grammar rule matching method generally first segment the text through a dictionary or thesaurus, and then use a preset grammar tree to parse the semantic intent corresponding to the segmentation sequence. The grammar tree organizes the semantic intent corresponding to various word symbols in a tree structure. The more complex the grammar tree, the larger the semantic range it can recognize, and the more accurately it can identify the true intent in natural language.
[0004] However, this has resulted in the syntax tree becoming extremely large and complex in the process of continuous improvement. Each time natural language parsing is performed, the entire syntax tree needs to be traversed. Although accurate recognition results are obtained, the recognition process becomes longer and longer, and the amount of calculation increases dramatically, which seriously restricts the efficiency and development of natural language processing.
[0005] Therefore, the existing natural language processing methods based on grammatical rule matching have technical problems such as large computational complexity, high resource consumption, and low recognition efficiency. Summary of the invention
[0006] The present application provides a natural language processing method, apparatus, device, medium and program product to solve the technical problems of large computational complexity, high resource consumption and low recognition efficiency in the existing natural language processing method based on grammatical rule matching.
[0007] In a first aspect, the present application provides a natural language processing method, comprising:
[0008] Acquire a text to be parsed, and use a neural network model to initially parse the text to be parsed, so as to determine at least one syntax tree according to the initial parsing result, wherein the text to be parsed corresponds to the natural language input by the user;
[0009] Parse the grammar rules of the text to be parsed according to the grammar tree to determine the secondary parsing result;
[0010] Filtering target analysis results from the initial analysis results and the secondary analysis results through a preset arbitration list;
[0011] Determine and execute target business based on target analysis results.
[0012] In a possible design, the preset arbitration list includes a plurality of mapping relationships determined by three dimensions of vertical domains, a plurality of intents corresponding to the vertical domains, and entities, and a first semantic range corresponding to the vertical domain is greater than a second semantic range corresponding to the intent;
[0013] Correspondingly, the target analysis results are screened out from the initial analysis results and the secondary analysis results through the preset arbitration list, including:
[0014] Filtering at least one to-be-selected analysis result from the initial analysis result and the secondary analysis result according to the multiple mapping relationships, and determining the confidence level corresponding to the to-be-selected analysis result according to the preset entity database;
[0015] According to the preset confidence requirement and confidence level, a target analysis result is determined from at least one candidate analysis result.
[0016] In a possible design, the initial parsing result includes one or more first intentions corresponding to the grammatical rules and one or more first entities corresponding to the first intentions, and the secondary parsing result includes one or more second intentions and one or more second entities corresponding to the second intentions;
[0017] Correspondingly, at least one to-be-selected parsing result is selected from the initial parsing result and the secondary parsing result according to the multiple mapping relationships, including:
[0018] Combining each first intention with one or more first entities corresponding to the first intention for multiple times respectively to determine multiple first combination results;
[0019] Combining each second intent with one or more second entities corresponding to the second intent for multiple times respectively to determine multiple second combination results;
[0020] At least one to-be-selected parsing result is determined according to the multiple first combination results, the multiple second combination results, and the multiple preset mapping relationships.
[0021] In a possible design, the confidence level corresponding to the candidate parsing result is determined according to the preset entity database, including:
[0022] Determine whether the first entity or the second entity in the to-be-selected parsing result appears in a preset entity database;
[0023] If yes, add the first value to the confidence level corresponding to the analysis result to be selected;
[0024] If not, a second value is added to the confidence level corresponding to the analysis result to be selected, and the first value is greater than the second value.
[0025] In a possible design, determining at least one to-be-selected parsing result according to a plurality of first combination results, a plurality of second combination results, and a plurality of preset mapping relationships includes:
[0026] Respectively comparing each first combination result and each second combination result with each mapping relationship;
[0027] When the first combination result or the second combination result corresponds to the mapping relationship, the first combination result or the second combination result is determined as the parsing result to be selected.
[0028] In a possible design, a neural network model is used to initially parse the text to be parsed to determine at least one syntax tree, including:
[0029] Performing an initial analysis of the text to be analyzed using a neural network model to determine one or more first intents and one or more first entities corresponding to the first intents, wherein the initial analysis result includes: part or all of the first intents and the corresponding first entities;
[0030] One or more syntax trees are constructed according to each first intent in the initial parsing, each syntax tree corresponds to the vertical domain corresponding to the first intent, and the leaf nodes in the syntax tree are the word segmentation results in the intent.
[0031] In a possible design, the text to be parsed is parsed according to the syntax tree to determine the secondary parsing result, including:
[0032] Perform word segmentation analysis on the text to be parsed to determine a word segmentation sequence consisting of multiple word segmentation results;
[0033] According to a preset dictionary, the word segmentation sequence is processed to determine one or more word segmentation units;
[0034] Each of the word segmentation units is searched in the syntax tree to determine one or more second intentions and one or more second entities corresponding to the second intentions, and the secondary parsing result includes: part or all of the second intentions and the corresponding second entities.
[0035] In a second aspect, the present application provides a natural language processing device, comprising:
[0036] An acquisition module is used to acquire the text to be parsed, where the text to be parsed corresponds to the natural language input by the user;
[0037] Processing modules for:
[0038] Performing an initial analysis on the text to be analyzed using a neural network model to determine at least one syntax tree according to the initial analysis result;
[0039] Parse the grammar rules of the text to be parsed according to the grammar tree to determine the secondary parsing result;
[0040] Filtering target analysis results from the initial analysis results and the secondary analysis results through a preset arbitration list;
[0041] Determine and execute target business based on target analysis results.
[0042] In a possible design, the preset arbitration list includes a plurality of mapping relationships determined by three dimensions of vertical domains, a plurality of intents corresponding to the vertical domains, and entities, and a first semantic range corresponding to the vertical domain is greater than a second semantic range corresponding to the intent;
[0043] Correspondingly, the processing module is used to:
[0044] Filtering at least one to-be-selected analysis result from the initial analysis result and the secondary analysis result according to the multiple mapping relationships, and determining the confidence level corresponding to the to-be-selected analysis result according to the preset entity database;
[0045] According to the preset confidence requirement and confidence level, a target analysis result is determined from at least one candidate analysis result.
[0046] In a possible design, the initial parsing result includes one or more first intentions corresponding to the grammatical rules and one or more first entities corresponding to the first intentions, and the secondary parsing result includes one or more second intentions and one or more second entities corresponding to the second intentions;
[0047] Correspondingly, the processing module is used to:
[0048] Combining each first intention with one or more first entities corresponding to the first intention for multiple times respectively to determine multiple first combination results;
[0049] Combining each second intent with one or more second entities corresponding to the second intent for multiple times respectively to determine multiple second combination results;
[0050] At least one to-be-selected parsing result is determined according to the multiple first combination results, the multiple second combination results, and the multiple preset mapping relationships.
[0051] In one possible design, the processing module is used to:
[0052] Determine whether the first entity or the second entity in the to-be-selected parsing result appears in a preset entity database;
[0053] If yes, add the first value to the confidence level corresponding to the analysis result to be selected;
[0054] If not, a second value is added to the confidence level corresponding to the analysis result to be selected, and the first value is greater than the second value.
[0055] In one possible design, the processing module is used to:
[0056] Respectively comparing each first combination result and each second combination result with each mapping relationship;
[0057] When the first combination result or the second combination result corresponds to the mapping relationship, the first combination result or the second combination result is determined as the parsing result to be selected.
[0058] In one possible design, the processing module is used to:
[0059] Performing an initial analysis of the text to be analyzed using a neural network model to determine one or more first intents and one or more first entities corresponding to the first intents, wherein the initial analysis result includes: part or all of the first intents and the corresponding first entities;
[0060] One or more syntax trees are constructed according to each first intent in the initial parsing, each syntax tree corresponds to the vertical domain corresponding to the first intent, and the leaf nodes in the syntax tree are the word segmentation results in the intent.
[0061] In one possible design, the processing module is used to:
[0062] Perform word segmentation analysis on the text to be parsed to determine a word segmentation sequence consisting of multiple word segmentation results;
[0063] According to a preset dictionary, the word segmentation sequence is processed to determine one or more word segmentation units;
[0064] Each of the word segmentation units is searched in the syntax tree to determine one or more second intentions and one or more second entities corresponding to the second intentions, and the secondary parsing result includes: part or all of the second intentions and the corresponding second entities.
[0065] In a third aspect, the present application provides an electronic device, including:
[0066] A memory for storing program instructions;
[0067] The processor is used to call and execute the program instructions in the memory to perform any possible natural language processing method provided by the first aspect.
[0068] In a fourth aspect, the present application provides a vehicle-mounted terminal, comprising any possible electronic device provided in the third aspect.
[0069] In a fifth aspect, the present application provides a vehicle, comprising any possible vehicle-mounted terminal provided in the fourth aspect.
[0070] In a sixth aspect, the present application provides a storage medium, in which a computer program is stored. The computer program is used to execute any possible natural language processing method provided in the first aspect.
[0071] In a seventh aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements any possible natural language processing system method provided in the first aspect.
[0072] The present application provides a natural language processing method, apparatus, device, medium and program product, which obtains the text to be parsed and uses a neural network model to perform an initial analysis on the text to be parsed to determine at least one syntax tree, wherein the text to be parsed corresponds to the natural language input by the user; performs grammar rule analysis on the text to be parsed according to the syntax tree to determine the secondary analysis result; selects the target analysis result from the initial analysis result and the secondary analysis result through a preset arbitration list; determines and executes the target business according to the target analysis result. The technical problems of the existing natural language processing method based on grammar rule matching, such as large amount of calculation, high resource consumption and low recognition efficiency, are solved. The technical effect of reducing the amount of calculation and improving the recognition efficiency of natural language processing when matching grammar rules is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0074] Figure 1 A logical schematic diagram for matching grammatical rules of natural language provided for this application;
[0075] Figure 2 A flowchart of a natural language processing method provided in an embodiment of the present application;
[0076] Figure 3 A flowchart of another natural language processing method provided for the implementation of this application;
[0077] Figure 4 A schematic diagram of the recognition principle of an intent recognition model provided in an embodiment of the present application;
[0078] Figure 5 A schematic diagram of the recognition principle of a named entity recognition model based on bidirectional LSTM+CRF provided in an embodiment of the present application;
[0079] Figure 6A schematic diagram of a syntax tree constructed according to the first intention provided in an embodiment of the present application;
[0080] Figure 7 A schematic diagram of the structure of a natural language processing device provided in an embodiment of the present application;
[0081] Figure 8 A schematic diagram of the structure of an electronic device provided in this application.
[0082] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0083] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work, including but not limited to the combination of multiple embodiments, belong to the scope of protection of this application.
[0084] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0085] Figure 1 A logical diagram for matching grammatical rules of natural language provided in this application. Figure 1As shown, the natural language input by the user is preprocessed into text: "Play a song of AA's XYZ". Then the text is subjected to lexical analysis through the dictionary, also known as word segmentation processing, such as obtaining the following word segmentation sequence: "Play a song", "AA", "of", "XYZ". Next, the above word segmentation sequence is subjected to grammatical analysis using a pre-established syntax tree. The syntax tree is a multi-layer tree structure, which can generally include three layers. The root node is the first-level vertical domain, that is, the largest classification, the middle node is the second-level intention, that is, the second-level classification, and the leaf node is the third-level entity, that is, the object in the natural language, including: various nouns, names, song titles, items, etc. The so-called grammatical analysis is to determine whether each word in the word segmentation sequence can successfully match the entity of the leaf node in the syntax tree. After the match is completed, it can be traced back to the intention, and further traced back to the vertical domain, thereby completing the grammatical analysis and obtaining the "intention" and "entity" corresponding to the natural language input by the user.
[0086] In summary, the syntax tree plays a role in identifying the user's intention in the process of matching and identifying grammatical rules of natural language, and the recognition accuracy depends on the logical completeness of the syntax tree, which makes the development of natural language recognition technology move towards the direction of continuously enriching the syntax tree. However, this also makes the syntax tree gradually become larger and more complicated. The continuous increase in nodes makes the matching process consume more and more computing resources and the efficiency becomes low. Therefore, how to reduce the matching calculation amount of natural language processing based on grammatical rule matching, reduce resource consumption, and improve recognition efficiency has become a technical problem that needs to be solved urgently.
[0087] In order to solve the above technical problems, the invention concept of this application is:
[0088] A complete syntax tree is divided into several regions, or several subtrees, and matching is performed only in these subtrees, thereby reducing the amount of matching calculations. How to divide the regions or how to construct the subtrees becomes the breakthrough point for realizing the invention concept.
[0089] After in-depth analysis and research, the inventor of this application found that the essence of subtree construction is to pre-screen several intentions or vertical domains with higher probability. Then, the trained neural network model can be used to pre-recognize natural language and obtain several initial intentions, so that the grammar subtree can be constructed according to these initial intentions.
[0090] Therefore, the natural language processing method provided in this application organically integrates neural network model recognition and recognition based on grammatical rules. The requirements for the neural network model are lower than those when the neural network model is used alone for recognition, and the recognition calculation amount of the neural network model is also reduced. After the grammar subtree is constructed, the calculation amount based on grammar rule matching is also reduced, and the intents and entities obtained by the two recognition methods can be further screened, making full use of the recognition results of the neural network model and improving the accuracy of recognition. Thereby reducing the amount of calculation, improving efficiency, and improving the accuracy of recognition in general.
[0091] Figure 2 A flow chart of a natural language processing method provided in an embodiment of the present application. Figure 2 As shown, the specific steps of the natural language processing method include:
[0092] S201, obtaining a text to be parsed, and performing an initial parsing on the text to be parsed using a neural network model, so as to determine at least one syntax tree according to the initial parsing result.
[0093] In this step, the natural language input by the user is obtained and preprocessed to determine the text to be parsed. For example, the voice spoken by the user is detected by a microphone pickup, and then preprocessed by a speech-to-text conversion algorithm to obtain the text to be parsed.
[0094] Next, the neural network model is used to perform the initial analysis on the text to be analyzed. The neural network model in the initial analysis can be composed of two sub-models, one is the NLP (Natural Language Processing) intent recognition model, and the other is the NER (Named Entity Recognition) model.
[0095] The intent recognition model recognizes the text to be parsed and obtains multiple first intents, while the named entity recognition model can obtain one or more first entities.
[0096] That is, a neural network model is used to perform initial parsing on the text to be parsed to determine one or more first intentions corresponding to the grammatical rules and one or more first entities corresponding to the first intentions. The initial parsing result includes: part or all of the first intentions and the corresponding first entities.
[0097] It should be noted that the first intention corresponds to the grammatical rules. The functions of the first intention include: it contains a part of the natural language recognition rules. Through the first intention, the text to be parsed can be preliminarily screened and recognized, laying the foundation for the subsequent reduction of natural language rule matching.
[0098] After obtaining multiple first intentions, at least one syntax tree can be constructed according to each first intention, and the leaf nodes in the syntax tree are the word segmentation results in the intention.
[0099] It is worth noting that the syntax tree is the concretization of the natural language recognition rules corresponding to the first intention, or the natural language recognition rules described in a tree structure.
[0100] It should also be noted that the syntax tree in this step is not a complete syntax tree in the prior art, but a syntax subtree that only contains part of the intent or vertical domain. That is, the syntax tree in this step can be constructed by selecting a part of the branches from the complete syntax tree in the database.
[0101] In one possible design, when multiple first intentions are obtained during the initial parsing, the first intentions are arranged according to their confidence, and then only the first intentions with confidence ranking in the top N, such as the top 3, are selected to construct 1 to 3 syntax trees. This can further reduce the amount of computation for subsequent syntax rule matching.
[0102] S202: parse the text to be parsed according to the syntax tree to determine a secondary parsing result.
[0103] In this step, at least one candidate analysis result is selected from the initial analysis result and the secondary analysis result according to the multiple mapping relationships, and the confidence level corresponding to the candidate analysis result is determined according to the preset entity database;
[0104] According to the preset confidence requirement and confidence level, a target analysis result is determined from at least one candidate analysis result.
[0105] Specifically, the text to be parsed is first parsed using a preset dictionary, also known as word segmentation, to obtain a word segmentation sequence consisting of multiple word segments with a certain order relationship. Then, the syntax tree constructed in the previous step is used to match each word in the word segmentation sequence based on grammatical rules to obtain one or more second intents and corresponding one or more second entities.
[0106] S203: Filter out target analysis results from the initial analysis results and the secondary analysis results through a preset arbitration list.
[0107] In this step, the preset arbitration list is used to store the intents that are used more frequently in the current application scenario. And the first intent and the first entity in S201 are fully utilized, that is, the initial parsing result is also included in the final screening range, which is more conducive to improving the accuracy of recognition and the possibility of expansion, so that the semantic recognition is no longer mechanical, and more recognition possibilities are expanded, which is more intelligent.
[0108] In this embodiment, the preset arbitration list includes multiple mapping relationships determined by three dimensions: vertical domain, intent, and entity, and the first semantic scope corresponding to the vertical domain is larger than the second semantic scope corresponding to the intent.
[0109] For example, the natural language processing method of this embodiment can be applied to a vehicle-mounted terminal. At this time, when the user speaks natural language, such as "I want to listen to AA's XYZ", the vehicle-mounted terminal can use the natural language processing method provided by this embodiment to perform initial parsing of the neural network model and obtain multiple first intentions, thereby constructing multiple syntax trees based on the first intentions, and then use the dictionary to perform lexical parsing on the above-mentioned text to be parsed "I want to listen to AA's XYZ" to obtain a word segmentation sequence of "I want to listen", "AA", "of", and "XYZ", and then perform matching operations in each syntax tree to determine multiple second intentions and second entities.
[0110] Assuming that the preset arbitration list is as shown in Table 1, then after two analyses, the first intent and the first entity, the second intent and the second entity can be combined into multiple combinations, but only the combination shown in Table 1 is in line with the current application scenario, that is, the combination of the vehicle scenario. Therefore, the combination that meets Table 1, that is, the preset arbitration list, can be screened out as the candidate analysis result.
[0111]
[0112] Table 1
[0113] It should be noted that, since the amount of data or possibilities corresponding to the entities is relatively large, a preset entity database is needed to specifically determine whether the first entity or the second entity is an accurately identified entity or whether it actually exists. Specifically, a query is performed to determine whether each first entity and the second entity are in the preset entity database. If found, the first entity or the second entity is considered to exist. At this time, the confidence of the corresponding intent can be set to a higher value such as 2. Conversely, if no query is found, the confidence of the corresponding intent can be set to a lower value, such as 1 or 0. If an intent corresponds to multiple entities, and no entity is found, the confidence values can be superimposed. After completing the query of all entities, the intent and entity with the highest confidence are selected as the final recognition result, that is, the target parsing result.
[0114] For example, in the above example, the target analysis result is that the user needs to listen to music, the singer is AA, and the song title is XYZ.
[0115] S204: Determine and execute the target business according to the target analysis result.
[0116] In this step, according to the target intent and target entity in the target analysis result, the execution instruction of the corresponding execution terminal is determined, and then the execution of the target business begins.
[0117] For example, if a user needs to listen to music, the singer is AA, and the song title is XYZ, then the music playing service is started to play the song XYZ by singer AA.
[0118] In summary, the present embodiment includes the following improvements:
[0119] (1) clustering the rule-based grammar according to intents in advance, where one intent includes a part of the rules, i.e., the first intent obtained by performing initial parsing on the text to be parsed in S201;
[0120] (2) Use a neural network-based model to infer the top N best intentions;
[0121] (3) When matching the grammatical rules of S202 and S203, only the rules corresponding to the N first intentions obtained in S201 are searched.
[0122] The effect of the above improvements is: greatly reducing the workload of rule matching.
[0123] This embodiment provides a natural language processing system method, which obtains a text to be parsed and uses a neural network model to perform an initial analysis on the text to be parsed, so as to determine at least one syntax tree according to the initial analysis result, and the text to be parsed corresponds to the natural language input by the user; performs grammar rule analysis on the text to be parsed according to the syntax tree to determine the secondary analysis result; selects the target analysis result from the initial analysis result and the secondary analysis result through a preset arbitration list; and determines and executes the target business according to the target analysis result. The technical problems of the existing natural language processing method based on grammar rule matching, such as large amount of calculation, high resource consumption, and low recognition efficiency, are solved. The technical effect of reducing the amount of calculation and improving the recognition efficiency of natural language processing when matching grammar rules is achieved.
[0124] For ease of understanding, a more detailed explanation is given below using the natural language processing method provided in this application on a vehicle-mounted terminal as an example.
[0125] Figure 3 A flowchart of another natural language processing method provided for the implementation of this application. Figure 3 As shown, the natural language processing method is applied to a vehicle-mounted terminal, and the specific steps include:
[0126] S301, obtaining the text to be parsed.
[0127] In this embodiment, the vehicle-mounted terminal on the vehicle obtains the voice information spoken by the user through a pickup such as a microphone, and then filters out some meaningless sound information through filtering, and then uses a speech-to-text conversion model to convert it into text to be parsed.
[0128] S302: Perform an initial analysis on the text to be analyzed using a neural network model to determine one or more first intents and one or more first entities corresponding to the first intents.
[0129] In this step, the neural network model is composed of at least two types of models, including: an intent recognition model and a named entity recognition model.
[0130] The following is an introduction to the recognition process of the intent recognition model:
[0131] Figure 4 The following is a schematic diagram of the recognition principle of an intent recognition model provided in an embodiment of the present application. Figure 4 As shown:
[0132] Input layer 401 (also called one-hot conversion layer): The string of the user input sentence, i.e. the text to be parsed, is converted into the index number of each word after passing through the input layer. A sentence becomes an array of index numbers, which can be agreed to be up to 70 words at most. The part exceeding the limit is truncated and discarded, because people usually speak less than 70 words at a time. Therefore, the output of the input layer is an array of up to 70 elements, and the value of the array element is an integer value, representing the index of the word.
[0133] Word embedding layer 402 (used to construct word vectors): Word embedding is to use a multi-dimensional floating point data to represent the meaning of each word, such as 128 dimensions, so that each word is represented by a one-dimensional array of 128 elements. Word embedding is obtained during training and used directly during inference. The word index array output by the input layer is converted into a multi-dimensional word vector through the word embedding layer, so the index of the first 70 words becomes a [70,128] matrix, each element of which is a floating point number.
[0134] Convolutional layer 403: The function of the convolutional layer is to ignore most features, but to amplify and extract certain features. For example, in the NLP intent classification process, 3-, 4-, and 5-word feature extraction is used. Continuous 3, 4, and 5 words are taken as interesting features and extracted for later processing. In this way, 3 to 5 words can be treated as a whole. If they are words or phrases, they are considered as a whole. If they are all single words, their relationship is considered. The input of the convolutional layer is the output matrix of the previous word embedding layer, and the output is also a matrix. The size of the matrix is related to the size of the convolution kernel. For example, if the convolution kernel size is [3,128], the output matrix after convolution is [68,1]. 3-byte length feature extraction corresponds to the convolution kernel [3,128], 4-byte length feature extraction corresponds to the convolution kernel [4,128], and 5-byte length feature extraction corresponds to the convolution kernel [5,128]. There are multiple convolution kernels of each size, such as 128.
[0135] Pooling layer 404: The purpose of the pooling layer here is to ignore unimportant features in the features extracted by the convolution kernel and only look at the most important features. The means is "downsampling". The so-called "downsampling" is to find the largest value in the matrix and replace the entire matrix with the maximum value. Each convolution kernel is followed by a pooling layer, and the output of the pooling layer is a maximum value in the matrix representing the convolution result.
[0136] Fusion layer 405: The output data of multiple pooling layers are combined to form a large one-dimensional array. For example, 128 3-byte convolution poolings, 128 4-byte convolution poolings, and 128 5-byte convolution poolings, the 384 values obtained form a one-dimensional array, and each element in the array is a floating point number.
[0137] Fully connected layer 406: The fully connected layer receives the output from the fusion layer, which is a one-dimensional array of 384 elements. After passing through the fully connected layer, it becomes n floating point values, where n is equal to the preset classification category. For example, if there are 20 user intentions, then n is equal to 20. Here, the size of each value in the n floating point numbers represents the size of the possibility of the category. The more likely the classification is, the larger the corresponding value is. Normalization is generally required. Normalization means scaling down proportionally so that the sum of all n values is 1.
[0138] Output layer 407: Receives the output (n values) of the previous layer (fully connected layer 406), which is equivalent to a one-dimensional array with n elements. The subscript of each element of the array represents a classification number. The output layer converts the classification number into user-recognizable intent, such as classification type 1 represents the "singer" category, and classification type 2 represents the "song name" category. The classification number and category name are pre-defined by the user.
[0139] Next, we introduce the recognition process of the named entity recognition model:
[0140] The named entity recognition model is used to identify word slots (word slot type, position) in a sentence, such as "I want to listen to XYZ of ABC". The recognition results can be shown in Table 2:
[0141] Character Label I O want O listen O A B-Name B I-Name C L-name of O X B-Song Title Y I-Song Title Z L-Song Title
[0142] Table 2
[0143] It should be noted that the definitions of the labels in Table 2 are shown in Table 3:
[0144] Label definition B(Begin) Slot Start I (Internal) Middle of word slot L(Last) End of word slot U (Unique) Single word slot O(Other) Non-word slot
[0145] Table 3
[0146] Figure 5 A schematic diagram of the recognition principle of a named entity recognition model based on bidirectional LSTM+CRF provided in an embodiment of the present application. Among them, LSTM (Long Short-Term Memory) and CRF (conditional random fields) are as follows: Figure 5 As shown:
[0147] Input layer 501 (also called one-hot conversion layer): The string of the user input sentence is converted into the index number of each word through the input layer. A sentence becomes an array of index numbers. The maximum length can be 70 words. The excess part is truncated and discarded because people usually speak less than 70 words at a time. Therefore, the output of input layer 501 is an array with a maximum length of 70 elements. The value of the array element is an integer value, representing the index of the word.
[0148] Word embedding layer 502: Word embedding is to use a multi-dimensional floating point data to represent the meaning of each word, such as 128 dimensions, so that each word is represented by a one-dimensional array of 128 elements. Word embedding is obtained during training and used directly during inference. The word index array output by the input layer 501 is converted into a multi-dimensional word vector through the word embedding layer, so the index of the first 70 words becomes a [70,128] matrix, and each element of the matrix is a floating point number.
[0149] Bidirectional LSTM layer 503: Named entity recognition is generally implemented using LSTM (Long Short-Term Memory). LSTM is a neural network model that considers every word in a sentence instead of just the most recent word or words when processing a sentence. For example, when using a bidirectional LSTM network for named entity recognition, when processing the sentence "I want to listen to XYZ by ABC", the last word is "XYZ", preceded by "I want to listen" and "ABC". When recognizing "XYZ", the LSTM long-short network considers the preceding "I want to listen", "ABC", etc., and combines the context, so it can more accurately determine that "XYZ" may be the name of a song. If only one-way LSTM is used, the information about the order of words in the sentence will be lost. For example, the meanings of "I love you" and "you love me" cannot be distinguished. Therefore, the model uses a bidirectional LSTM, a forward LSTM processes "I love you", and a reverse LSTM processes "you love me". The results of the two LSTM processes are combined, so that the model knows the order relationship of each word in the sentence.
[0150] The input of the bidirectional LSTM layer 503 is the output of the word embedding layer 502, which is a 70*128 matrix. The output is also a matrix with a size of [70,2*HIDDENUNIT], where 70 refers to 70 words, the forward LSTM plus the reverse LSTM is 140, and HIDDENUNIT is a preset length, such as 128. Each element of the matrix is also a floating point number.
[0151] Fully connected layer 504: The matrix [70,2*HIDDENUNIT] output by the bidirectional LSTM layer 503 is converted into a new matrix [70,OUTPUTDIM] through the fully connected layer, where 70 represents a maximum of 70 characters, and OUTPUTDIM represents the number of NER tags, such as song titles and singers. Each character generates OUTPUTDIM possible tags, and each tag is represented by a floating point number. The larger the value, the greater the possibility.
[0152] Viterbi decoding layer 505 (CRF Viterbi decode): The previous fully connected layer 504 outputs the label value of each word. The matrix format is [70, OUTPUTDIM]. However, each word can only have one label in the end. 70 words means 70 labels. The output format is a one-dimensional array of 70 elements. The conversion from matrix to one-dimensional array is the function of Viterbi decoding. Viterbi decoding will add the value of each link and add the transfer matrix to finally get the value of the entire link. The largest one is the most likely label path. The transfer matrix is generated during training and is stored in memory during runtime for use by Viterbi decoding.
[0153] Output layer 506: outputs the array obtained by the previous layer as labeled data in a specific format.
[0154] S303: Construct one or more syntax trees according to each first intention in the initial parsing.
[0155] In this step, each syntax tree corresponds to the vertical domain corresponding to the first intent, and the leaf nodes in the syntax tree are the word segmentation results in the intent.
[0156] Specifically, according to the syntax tree construction rules and / or syntax tree database, each first intention is used to construct a corresponding syntax tree. For example, the first intention is generalized to its corresponding vertical domain, and the entire vertical domain is used as the syntax tree, or the syntax tree branch corresponding to the first intention in the syntax tree database is directly used as a new syntax tree. It is also possible to recombine syntax tree branches corresponding to multiple first intentions into a new syntax tree.
[0157] Figure 6 A schematic diagram of a syntax tree constructed according to the first intention provided in an embodiment of the present application. Figure 6 As shown, assume that there are two first intentions, namely: "Music singer song title" and "Music singer". Since these two first intentions are in the music vertical domain, these two intentions can be merged together to construct a grammar tree.
[0158] S304: Perform word segmentation analysis on the text to be parsed to determine a word segmentation sequence consisting of multiple word segmentation results.
[0159] In this step, word segmentation parsing is to divide the sentences of the text to be parsed by using a preset dictionary to obtain multiple word segmentation results, and then arrange these word segmentation results in the order of the text to be parsed to obtain a word segmentation sequence. Because the order of word segmentation may affect the determination of intent, it is necessary to search in the syntax tree in the order of the word segmentation sequence.
[0160] Specifically, lexical analysis, as a pre-step of syntax analysis, matches keywords according to the most basic rules to reduce the workload of subsequent syntax analysis. Generally, it matches the following:
[0161] (1) Match identifiers. For example, when a user designs the C++ programming language, “printf”, “==”, etc. are all keywords.
[0162] (2) 0 matches numbers, such as integers and floating-point numbers.
[0163] (3) Match string constants, such as prefixes, suffixes, connectors, etc.
[0164] (4) Spaces, comments, etc., which are not necessary to worry about during the syntax analysis phase.
[0165] For example, it is defined in the grammar rules that:
[0166] Music prefix: "Play a song" | "Play a song for me" | "Please play a song for me";
[0167] Music suffix: "of the song" | "music" | "of the songs";
[0168] Connector: "of" | "to";
[0169] Stop words: ("ah" | "ne" | "ba" | "en")*;
[0170] ID_ZH: [\u4e00-\u9fa5]*; Represents characters; etc.
[0171] If the user says "I want to listen to XYZ of ABC", after lexical analysis, the result is as follows:
[0172] Music prefix: I want to listen to; ID_ZH: ABC; Connector: of; ID_ZH: XYZ.
[0173] S305. According to the syntax tree and the preset entity database, parse the word segmentation sequence to extract one or more second intentions and one or more second entities corresponding to the second intentions.
[0174] In this step, according to the preset dictionary, perform word segmentation processing on the word segmentation sequence to determine one or more word segmentation units; search for each word segmentation unit in the syntax tree to determine one or more second intentions and one or more second entities corresponding to the second intentions.
[0175] Traverse and query in each node of the syntax tree according to the arrangement order of each word segmentation result in the word segmentation sequence. For each word segmentation result, if it is found in the syntax tree, select the corresponding intention in the syntax tree as the candidate intention, and assign the confidence of the candidate intention as m. If k word segmentation results are found in the candidate intention, the confidence can be assigned as km. For some word segmentation results, the corresponding entities may have a relatively large amount of data, such as singers, song names, etc., and a preset entity database is required to store them specifically. Similarly, if the word segmentation result can be found in the preset entity database, the confidence of the corresponding candidate intention is increased by n.
[0176] After screening all the word segmentation results in the word segmentation sequence in the syntax tree and the preset entity database in the above manner, multiple candidate intentions can be obtained, and then these candidate intentions are arranged according to the confidence, and the top N candidate intentions are selected as the second intentions, and the corresponding entities are the second entities.
[0177] It should be noted that grammatical analysis refers to the analysis of the specific meanings expressed by a series of word symbols. In grammar and language applications, the word order and the dependency relationship between words are abstracted into the following four types:
[0178] Token sequence: a series of elements, such as an array initialization list in a programming language. Another example is the continuous matching of multiple string constants in natural language processing.
[0179] Selection: Making a choice between multiple alternatives, such as if, else if statements in programming languages.
[0180] Lexical symbol dependency: A lexical symbol needs to be paired with another lexical symbol somewhere, such as the matching of left and right brackets in programming languages.
[0181] Nested structure: A self-similar language structure, such as nested computational expressions or nested statement blocks in a programming language.
[0182] The grammatical rules in natural language processing are relatively simple. For example, the rules of S304 use Figure 6 The syntax tree shown matches the "music singer song title" intent, "music singer" intent, and "music song title" intent respectively, all three of which are second intents.
[0183] S306: Combine each first intent with one or more first entities corresponding to the first intent for multiple times to determine multiple first combination results.
[0184] S307: Combine each second intent with one or more second entities corresponding to the second intent for multiple times to determine multiple second combination results.
[0185] The combination of steps S306 and S307 can be described by the following example:
[0186] For example, for an intent of "music singer song title", the corresponding grammatical rule is: music prefix, ID_ZH, connector, ID_ZH. The music prefix can be composed of different participles, such as "I", "I listen", "want", "I want to listen". Similarly, ID_ZH can be replaced by different participles, so that there are multiple combinations of intents and entities.
[0187] Similarly, the intent itself can also be combined by word segmentation. For example, after combining the two intents "music singer" and "singer song title date", a new intent is obtained: "music singer song title date". Combining according to the above principle will produce a variety of combination results.
[0188] S308: Compare each first combination result and each second combination result with each mapping relationship in a preset arbitration list.
[0189] In this step, the preset arbitration list includes multiple mapping relationships determined by three dimensions: vertical domain, intent and entity. The first semantic range corresponding to the vertical domain is larger than the second semantic range corresponding to the intent, and the second semantic range is larger than the third semantic range corresponding to the entity.
[0190] As shown in the preset arbitration list in Table 1, all the combinations obtained in S306 and S307 are only in line with the current application scenario, such as the usage scenario of the vehicle terminal, if they correspond to those in Table 1.
[0191] S309: When the first combination result or the second combination result corresponds to the mapping relationship, determine the first combination result or the second combination result as a to-be-selected parsing result.
[0192] S310: Determine the confidence level of the candidate parsing result according to whether the first entity or the second entity in the candidate parsing result appears in a preset entity database.
[0193] This step specifically includes:
[0194] Determine whether the first entity or the second entity in the to-be-selected parsing result appears in a preset entity database;
[0195] If yes, add the first value to the confidence level corresponding to the analysis result to be selected;
[0196] If not, a second value is added to the confidence level corresponding to the analysis result to be selected, and the first value is greater than the second value.
[0197] In this embodiment, there are too many singers and song titles, and a database is needed to verify whether the singers and song titles exist. If the verification passes, the confidence value of this sentence is relatively high, such as set to 2. Otherwise, the confidence is average or the value is relatively low, such as set to 1 or 0.
[0198] S311. Determine a target parsing result from at least one candidate parsing result according to a preset confidence requirement and confidence level.
[0199] This step outputs a unique intent, entity, and confidence. If there is no intent and entity combination that meets the preset arbitration list, the output intent and entity are empty.
[0200] If there are multiple intent and entity combinations that meet the preset arbitration list, the intent and entity with the highest confidence are selected as the target parsing result.
[0201] S312: Determine and execute the target business according to the target analysis result.
[0202] This embodiment provides a natural language processing system method, which obtains a text to be parsed and uses a neural network model to perform an initial analysis on the text to be parsed, so as to determine at least one syntax tree according to the initial analysis result, and the text to be parsed corresponds to the natural language input by the user; performs grammar rule analysis on the text to be parsed according to the syntax tree to determine the secondary analysis result; selects the target analysis result from the initial analysis result and the secondary analysis result through a preset arbitration list; and determines and executes the target business according to the target analysis result. The technical problems of the existing natural language processing method based on grammar rule matching, such as large amount of calculation, high resource consumption, and low recognition efficiency, are solved. The technical effect of reducing the amount of calculation and improving the recognition efficiency of natural language processing when matching grammar rules is achieved.
[0203] Figure 7 This is a schematic diagram of the structure of a natural language processing device provided in an embodiment of the present application. The natural language processing device 700 can be implemented by software, hardware, or a combination of both.
[0204] like Figure 7 As shown, the natural language processing device 700 is applied to a wearable device, and one or more contact arrays are provided on the wearable device, and the contact units in the contact array are arranged into a preset pattern in a preset arrangement form. The natural language processing device 700 includes:
[0205] The acquisition module 701 is used to acquire the text to be parsed, where the text to be parsed corresponds to the natural language input by the user;
[0206] The processing module 702 is used to:
[0207] Performing an initial analysis on the text to be analyzed using a neural network model to determine at least one syntax tree according to the initial analysis result;
[0208] Parse the grammar rules of the text to be parsed according to the grammar tree to determine the secondary parsing result;
[0209] Filtering target analysis results from the initial analysis results and the secondary analysis results through a preset arbitration list;
[0210] Determine and execute target business based on target analysis results.
[0211] In a possible design, the preset arbitration list includes a plurality of mapping relationships determined by three dimensions of vertical domains, a plurality of intents corresponding to the vertical domains, and entities, and a first semantic range corresponding to the vertical domain is greater than a second semantic range corresponding to the intent;
[0212] Correspondingly, the processing module 702 is used to:
[0213] Filtering at least one to-be-selected analysis result from the initial analysis result and the secondary analysis result according to the multiple mapping relationships, and determining the confidence level corresponding to the to-be-selected analysis result according to the preset entity database;
[0214] According to the preset confidence requirement and confidence level, a target analysis result is determined from at least one candidate analysis result.
[0215] In a possible design, the initial parsing result includes one or more first intentions corresponding to the grammatical rules and one or more first entities corresponding to the first intentions, and the secondary parsing result includes one or more second intentions and one or more second entities corresponding to the second intentions;
[0216] Correspondingly, the processing module 702 is used to:
[0217] Combining each first intention with one or more first entities corresponding to the first intention for multiple times respectively to determine multiple first combination results;
[0218] Combining each second intent with one or more second entities corresponding to the second intent for multiple times respectively to determine multiple second combination results;
[0219] At least one to-be-selected parsing result is determined according to the multiple first combination results, the multiple second combination results, and the multiple preset mapping relationships.
[0220] In one possible design, the processing module 702 is configured to:
[0221] Determine whether the first entity or the second entity in the to-be-selected parsing result appears in a preset entity database;
[0222] If yes, add the first value to the confidence level corresponding to the analysis result to be selected;
[0223] If not, a second value is added to the confidence level corresponding to the analysis result to be selected, and the first value is greater than the second value.
[0224] In one possible design, the processing module 702 is configured to:
[0225] Respectively comparing each first combination result and each second combination result with each mapping relationship;
[0226] When the first combination result or the second combination result corresponds to the mapping relationship, the first combination result or the second combination result is determined as the parsing result to be selected.
[0227] In one possible design, the processing module 702 is configured to:
[0228] Performing an initial analysis of the text to be analyzed using a neural network model to determine one or more first intents and one or more first entities corresponding to the first intents, wherein the initial analysis result includes: part or all of the first intents and the corresponding first entities;
[0229] One or more syntax trees are constructed according to each first intent in the initial parsing, each syntax tree corresponds to the vertical domain corresponding to the first intent, and the leaf nodes in the syntax tree are the word segmentation results in the intent.
[0230] In one possible design, the processing module 702 is configured to:
[0231] Perform word segmentation analysis on the text to be parsed to determine a word segmentation sequence consisting of multiple word segmentation results;
[0232] According to a preset dictionary, the word segmentation sequence is processed to determine one or more word segmentation units;
[0233] Each of the word segmentation units is searched in the syntax tree to determine one or more second intentions and one or more second entities corresponding to the second intentions, and the secondary parsing result includes: part or all of the second intentions and the corresponding second entities.
[0234] It is worth mentioning that Figure 7 The device provided in the illustrated embodiment can execute the method provided in any of the above method embodiments. Its specific implementation principles, technical features, professional terminology explanations and technical effects are similar and will not be repeated here.
[0235] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 800 may include: at least one processor 801 and a memory 802 . Figure 8 An electronic device is shown using a processor as an example.
[0236] The memory 802 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer operation instructions.
[0237] The memory 802 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0238] The processor 801 is used to execute the computer-executable instructions stored in the memory 802 to implement the methods described in the above method embodiments.
[0239] The processor 801 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0240] Optionally, the memory 802 may be independent or integrated with the processor 801. When the memory 802 is a device independent of the processor 801, the electronic device 800 may further include:
[0241] The bus 803 is used to connect the processor 801 and the memory 802. The bus may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0242] Optionally, in a specific implementation, if the memory 802 and the processor 801 are integrated on a chip, the memory 802 and the processor 801 can communicate through an internal interface.
[0243] The present application also provides a vehicle-mounted terminal, comprising: Figure 8 Any of the possible electronic devices shown.
[0244] An embodiment of the present application also provides a vehicle, comprising the above-mentioned vehicle-mounted terminal.
[0245] An embodiment of the present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the methods in the above-mentioned method embodiments.
[0246] An embodiment of the present application further provides a computer program product, including a computer program, which implements the methods in the above-mentioned method embodiments when executed by a processor.
[0247] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0248] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A natural language processing method, characterized in that: include: Acquire a text to be parsed, and perform an initial parsing on the text to be parsed using a neural network model to determine at least one syntax tree according to the initial parsing result, wherein the text to be parsed corresponds to a natural language input by a user; Performing grammatical rule parsing on the text to be parsed according to the grammar tree to determine a secondary parsing result; A target parsing result is screened out from the initial parsing result and the secondary parsing result through a preset arbitration list, wherein the preset arbitration list includes: a plurality of mapping relationships determined by three dimensions of a vertical domain and a plurality of intents and entities corresponding to the vertical domain, wherein a first semantic range corresponding to the vertical domain is greater than a second semantic range corresponding to the intent; Determine and execute the target business according to the target analysis result; The neural network model includes an intention recognition model and a named entity recognition model. The neural network model is used to initially parse the text to be parsed to determine at least one syntax tree according to the initial parsing result, including: Performing an initial analysis on the text to be analyzed using a neural network model to determine one or more first intentions, wherein the initial analysis result includes: part or all of the first intentions; One or more syntax trees are constructed according to each of the first intentions in the initial parsing, wherein when the initial parsing determines multiple first intentions, the syntax trees are constructed according to the multiple first intentions; the syntax trees are constructed according to the multiple first intentions, including: arranging the multiple first intentions according to confidence, determining the first intentions with confidence ranked in the top N positions, and constructing one or more syntax trees according to the first intentions with confidence ranked in the top N positions, each syntax tree corresponding to the vertical domain corresponding to the first intention, and the leaf nodes in the syntax tree are the individual word segmentation results in the intention.
2. The natural language processing method according to claim 1, characterized in that: The step of selecting a target parsing result from the initial parsing result and the secondary parsing result by using a preset arbitration list includes: Filtering at least one to-be-selected analysis result from the initial analysis result and the secondary analysis result according to the plurality of mapping relationships, and determining a confidence level corresponding to the to-be-selected analysis result according to a preset entity database; The target parsing result is determined from at least one of the candidate parsing results according to a preset confidence requirement and the confidence.
3. The natural language processing method according to claim 2, characterized in that: The initial parsing result includes one or more first intentions corresponding to the grammatical rule and one or more first entities corresponding to the first intention, and the secondary parsing result includes one or more second intentions and one or more second entities corresponding to the second intention; Correspondingly, the selecting at least one to-be-selected parsing result from the initial parsing result and the secondary parsing result according to the plurality of mapping relationships includes: Combining each of the first intents with one or more of the first entities corresponding to the first intent for multiple times, respectively, to determine multiple first combination results; Combining each of the second intents with one or more of the second entities corresponding to the second intent for multiple times, respectively, to determine multiple second combination results; At least one of the to-be-selected parsing results is determined according to a plurality of the first combination results, a plurality of the second combination results, and a plurality of the mapping relationships.
4. The natural language processing method according to claim 3, characterized in that: The step of determining the confidence level corresponding to the candidate analysis result according to the preset entity database includes: Determine whether the first entity or the second entity in the to-be-selected parsing result appears in the preset entity database; If yes, then adding a first value to the confidence level corresponding to the candidate analysis result; If not, a second value is added to the confidence corresponding to the candidate analysis result, and the first value is greater than the second value.
5. The natural language processing method according to claim 3, characterized in that: The determining at least one of the to-be-selected parsing results according to the plurality of the first combination results, the plurality of the second combination results, and the plurality of the mapping relationships comprises: Respectively comparing each of the first combination results and each of the second combination results with each of the mapping relationships; When the first combination result or the second combination result corresponds to the mapping relationship, the first combination result or the second combination result is determined as the to-be-selected parsing result.
6. The natural language processing method according to any one of claims 1 to 5, characterized in that: The performing grammatical rule parsing on the text to be parsed according to the grammar tree to determine a secondary parsing result includes: Performing word segmentation analysis on the text to be analyzed to determine a word segmentation sequence consisting of multiple word segmentation results; According to a preset dictionary, the word segmentation sequence is processed to determine one or more word segmentation units; Each of the word segmentation units is searched in the syntax tree to determine one or more second intentions and one or more second entities corresponding to the second intentions, and the secondary parsing result includes: part or all of the second intentions and the corresponding second entities.
7. A natural language processing device, characterized in that: include: An acquisition module, used for acquiring a text to be parsed, wherein the text to be parsed corresponds to a natural language input by a user; Processing modules for: Performing an initial analysis on the text to be analyzed using a neural network model to determine at least one syntax tree according to the initial analysis result; Performing grammatical rule parsing on the text to be parsed according to the grammar tree to determine a secondary parsing result; A target parsing result is screened out from the initial parsing result and the secondary parsing result through a preset arbitration list, wherein the preset arbitration list includes: a plurality of mapping relationships determined by three dimensions of a vertical domain and a plurality of intents and entities corresponding to the vertical domain, wherein a first semantic range corresponding to the vertical domain is greater than a second semantic range corresponding to the intent; Determine and execute the target business according to the target analysis result; The neural network model includes an intention recognition model and a named entity recognition model. When the neural network model is used to initially parse the text to be parsed to determine at least one syntax tree according to the initial parsing result, the processing module is specifically used to: Performing an initial analysis on the text to be analyzed using a neural network model to determine one or more first intentions, wherein the initial analysis result includes: part or all of the first intentions; One or more syntax trees are constructed according to each of the first intentions in the initial parsing, wherein when the initial parsing determines multiple first intentions, the syntax trees are constructed according to the multiple first intentions; the syntax trees are constructed according to the multiple first intentions, including: arranging the multiple first intentions according to confidence, determining the first intentions with confidence ranked in the top N positions, and constructing one or more syntax trees according to the first intentions with confidence ranked in the top N positions, each syntax tree corresponding to the vertical domain corresponding to the first intention, and the leaf nodes in the syntax tree are the individual word segmentation results in the intention.
8. An electronic device, characterized in that: include: processor; as well as, a memory for storing a computer program for the processor; The processor is configured to perform the natural language processing method according to any one of claims 1 to 6 by executing the computer program.
9. A vehicle-mounted terminal, characterized in that: An electronic device comprising the electronic device described in claim 8.
10. A vehicle, characterized in that: Including the vehicle-mounted terminal as claimed in claim 9.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the natural language processing method according to any one of claims 1 to 6 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the natural language processing method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Log analysis method and system based on syntax tree, and computer readable medium
CN109726185A
Syntax tree extraction method of JSON data
CN111046630A