A method and system for generating aggregated answers to AI questions
By constructing a grammatical structure diagram and generating a three-dimensional matrix of user word position, combined with the convolutional neural network to extract features, the problem of inaccurate detection when generating intelligent question-and-answer in the existing technology is solved, and a more accurate question-and-answer generation is achieved.
Patent Information
- Application Number
- CN202410936702.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-07-12
AI Technical Summary
When generating intelligent question-and-answer answers, the prior art fails to effectively combine the part-of-speech, part-of-speech structure and word meaning in the sentence, resulting in inaccurate detection.
By obtaining user questioning sentences and storing part-of-speech categories, using segmented part-of-speech networks to segment statements into words and determine their part-of-speech categories, constructing a grammatical structure diagram and generating a three-dimensional matrix of user word positions, combining two-dimensional and three-dimensional convolution kernels to extract features, and finally through Classified network generates user answers.
It realizes the accurate extraction of the part of speech, structure and meaning in user question sentences, and generates more accurate question answers.
Smart Images

Figure CN118708696B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and system for generating aggregated answers to AI questions. Background Art
[0002] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields. It uses a combination of deep learning and big data to train a network that can intelligently answer questions based on labeled answers to generate answers to questions. The effect of the network depends largely on the structural design of the network and the method used during training.
[0003] At present, the network that generally generates intelligent question answers does not perform a combined detection of the part of speech, the structure of the part of speech, and the meaning of the words in the sentence to accurately extract the meaning of the sentence, which leads to inaccurate detection. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for generating aggregated answers to AI questions, so as to solve the above-mentioned problems existing in the prior art.
[0005] In a first aspect, an embodiment of the present invention provides a method for generating an aggregated answer to an AI question, including:
[0006] Obtaining a user question statement and a plurality of stored part-of-speech categories; the stored part-of-speech categories represent the part-of-speech categories of all words stored in the database;
[0007] By segmenting the part-of-speech network, based on the user question sentence, a plurality of user segmented words and corresponding user segmented part-of-speech categories are obtained;
[0008] Based on a plurality of stored part-of-speech categories, two stored part-of-speech categories are connected according to a grammatical relationship to obtain a grammatical structure diagram; the grammatical structure diagram represents a graph structure in a data structure;
[0009] Based on a plurality of user segmented words and corresponding user segmented part-of-speech categories, a three-dimensional matrix of user word positions is obtained according to the grammatical structure diagram;
[0010] According to the values corresponding to the user segmented words, the values of the corresponding positions in the three-dimensional matrix of user word positions are modified to obtain the three-dimensional matrix of user segmented words;
[0011] Based on the user segmented text three-dimensional matrix, the semantics is judged to obtain the user's answer.
[0012] Optionally, the step of segmenting the three-dimensional matrix of text based on the user, determining semantics, and obtaining a user answer includes:
[0013] Using a two-dimensional convolution kernel, two-dimensionally convolve multiple pages of the three-dimensional matrix of user segmented text respectively, extract the features of partial sentences composed of partial words, and obtain multiple two-dimensional features of user word positions;
[0014] Superimposing the plurality of user word position two-dimensional features to obtain a first user word position three-dimensional feature;
[0015] The user word position three-dimensional feature is convolved with a corresponding value using a three-dimensional convolution kernel of the same size to extract the features of the entire sentence including the repeated part, thereby obtaining a second user word position three-dimensional feature;
[0016] Passing the second user word position three-dimensional feature through the first classification network to obtain question keywords;
[0017] According to the question keywords, extract features through a keyword feature extraction network to obtain keyword features;
[0018] According to the user's segmented text features and keyword features, the user's answer is obtained through the second classification network.
[0019] Optionally, the training method of the keyword feature extraction network, the first classification network and the second classification network includes:
[0020] Obtain training keywords, three-dimensional features of training word positions and annotated answers; the training keywords represent keywords in a string of sentences; the annotated answers represent answers in a string of sentences; the three-dimensional features of training word positions are features of sentences corresponding to the training keywords;
[0021] Passing the three-dimensional features of the training word positions through a first classification network to obtain predicted question keywords;
[0022] Using the predicted question keyword as a tag keyword;
[0023] Calculate the loss between the marked keyword and the predicted question keyword to train the first classification network;
[0024] According to the predicted question keywords, a predicted keyword feature is obtained through a keyword feature extraction network;
[0025] According to the training user segmentation text features and predicted keyword features, the predicted answer is obtained through the second classification network;
[0026] The loss is calculated by comparing the predicted answer with the labeled answer, and the second classification network, the keyword feature extraction network and the first classification network are trained to obtain the trained second classification network, the keyword feature extraction network and the first classification network.
[0027] Optionally, the three-dimensional matrix of user word positions is obtained based on the plurality of user segmented words and the corresponding user segmented part-of-speech categories according to the grammatical structure diagram, including:
[0028] According to the order corresponding to the multiple user segmented words, the multiple user segmented part-of-speech categories are constructed into a user segmented part-of-speech category set;
[0029] Segment the part-of-speech categories based on multiple users, and obtain a user grammar graph according to the grammar structure graph;
[0030] Based on the user segmented part-of-speech category set, the connectivity status of the user segmented part-of-speech category in the user grammar graph is extracted, multiple sentence two-dimensional matrices are constructed, and a three-dimensional matrix of word positions is obtained.
[0031] Optionally, the step of connecting two part-of-speech categories based on a plurality of stored part-of-speech categories according to a grammatical relationship to obtain a grammatical structure diagram includes:
[0032] Randomly extract two stored part-of-speech categories from the n stored part-of-speech categories as the i-th part-of-speech category and the j-th part-of-speech category;
[0033] According to the grammatical relationship, determine whether the j-th part-of-speech category is the next stored part-of-speech category adjacent to the i-th part-of-speech category and whether the sentence is fluent;
[0034] If the jth part-of-speech category is the next stored part-of-speech category adjacent to the ith part-of-speech category, the ith part-of-speech category is marked as being simply connected to the jth part-of-speech category, and a connected set is obtained;
[0035] i and j are natural numbers greater than 0 and less than and equal to n;
[0036] The n stored part-of-speech categories are added to a point set, and the connected set is added to an edge set to obtain a grammatical structure diagram.
[0037] Optionally, the method extracts the connectivity states of the user-segmented part-of-speech categories in the user grammar graph based on the user-segmented part-of-speech category set, constructs multiple sentence two-dimensional matrices, and obtains a three-dimensional matrix of word positions, including:
[0038] Constructing a sentence two-dimensional matrix; the initial values in the sentence two-dimensional matrix are all 0; the number of rows in the sentence two-dimensional matrix is equal to the number of columns and the number of values in the user segmented part-of-speech category set;
[0039] Based on the user segmented part-of-speech category set, segmentation is performed according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets;
[0040] In the user grammar graph, the connectivity states corresponding to the multiple user word category sets included in the user word category set are copied to the sentence two-dimensional matrix; and multiple sentence two-dimensional matrices are obtained corresponding to the multiple user word category sets;
[0041] The plurality of sentence two-dimensional matrices are arranged in the order corresponding to the part-of-speech category sets segmented by the user to obtain a word position three-dimensional matrix.
[0042] Optionally, the number of channels of the three-dimensional convolution kernel is equal to the product of the number of channels of the two-dimensional convolution kernel multiplied by 2; the number of channels of the three-dimensional convolution kernel is less than the number of pages of the three-dimensional matrix for segmenting text by the user; the number of rows of the three-dimensional convolution kernel is less than the number of rows of the three-dimensional matrix for segmenting text by the user; and the number of columns of the three-dimensional convolution kernel is less than the number of columns of the three-dimensional matrix for segmenting text by the user.
[0043] Optionally, the segmenting of the part-of-speech category set based on the user is performed according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets, including:
[0044] sequentially detecting the values in the user segmentation part-of-speech category set, and if a user segmentation part-of-speech category that is the same as the multiple user segmentation part-of-speech categories that have been detected appears, obtaining a first user segmentation part-of-speech category;
[0045] The detected multiple user segmented part-of-speech categories in the user segmented part-of-speech category set except the first user segmented part-of-speech category are used as the first user part-of-speech category set;
[0046] The plurality of user segmented part-of-speech categories that have not been detected in the user segmented part-of-speech category set and the first user segmented part-of-speech category are used as a second user part-of-speech category set;
[0047] sequentially detecting the values in the second user segmented part-of-speech category set, and if a user segmented part-of-speech category that is the same as the multiple user segmented part-of-speech categories that have been detected appears, obtaining the second user segmented part-of-speech category;
[0048] The detected multiple user segmented part-of-speech categories other than the second user segmented part-of-speech category in the second user segmented part-of-speech category set are used as a third user part-of-speech category set;
[0049] The plurality of user segmented part-of-speech categories that have not been detected in the second user segmented part-of-speech category set and the second user segmented part-of-speech category are used as a fourth user part-of-speech category set;
[0050] The user segmented part-of-speech category set corresponds to obtaining multiple user part-of-speech category sets.
[0051] Optionally, the segmenting of part-of-speech categories based on multiple users and obtaining a user grammar diagram according to the grammar structure diagram include:
[0052] Add multiple user segmented part-of-speech categories to the point set of the user grammar graph;
[0053] Finding edges corresponding to the point set of the user grammar graph in the edge set of the grammar structure graph to obtain multiple user grammar edges;
[0054] Add multiple user grammar edges to the edge set of the user grammar graph to obtain the user grammar graph.
[0055] In a second aspect, an embodiment of the present invention provides an aggregation generation system for AI question answers, including:
[0056] Acquisition module: obtains a user question statement and a plurality of stored part-of-speech categories; the stored part-of-speech categories represent the part-of-speech categories of all words stored in the database;
[0057] Segmentation module: obtains a plurality of user segmented words and corresponding user segmented part-of-speech categories based on the user question sentence by segmenting the part-of-speech network;
[0058] Graph structure building module: based on multiple stored part-of-speech categories, two stored part-of-speech categories are connected according to grammatical relations to obtain a grammatical structure graph; the grammatical structure graph represents the graph structure in the data structure;
[0059] Three-dimensional construction module: based on multiple user segmentation words and corresponding user segmentation part-of-speech categories, according to the grammatical structure diagram, a three-dimensional matrix of user word positions is obtained;
[0060] User segmentation word feature adding module: according to the value corresponding to the user segmentation word, modify the value of the corresponding position in the user word position three-dimensional matrix to obtain the user segmentation text three-dimensional matrix;
[0061] Detection and answer module: based on the user segmented text three-dimensional matrix, judge the semantics and get the user's answer.
[0062] Compared with the prior art, the embodiments of the present invention achieve the following beneficial effects:
[0063] An embodiment of the present invention also provides a method and system for aggregate generation of AI question answers, the method comprising: obtaining a user question statement and a plurality of stored part-of-speech categories; the stored part-of-speech categories represent the part-of-speech categories of all words stored in a database; obtaining a plurality of user segmented words and corresponding user segmented part-of-speech categories based on the user question statement by segmenting the part-of-speech network; connecting two stored part-of-speech categories according to grammatical relationships based on the plurality of stored part-of-speech categories to obtain a grammatical structure diagram; the grammatical structure diagram represents a graph structure in a data structure; obtaining a three-dimensional matrix of user word positions based on the plurality of user segmented words and the corresponding user segmented part-of-speech categories according to the grammatical structure diagram; modifying the values of corresponding positions in the three-dimensional matrix of user word positions according to the values corresponding to the user segmented words to obtain a three-dimensional matrix of user segmented text; judging semantics based on the three-dimensional matrix of user segmented text to obtain a user answer.
[0064] The present invention divides the user question sentence into words and finds the part of speech of the divided words. According to the training company knowledge base, the part of speech categories contained in all the sentences in the training company knowledge base are obtained as the stored part of speech categories. According to the grammatical relationship, the stored part of speech categories are constructed into a grammatical structure diagram, and the simply connected relationship of the stored part of speech categories that can constitute a normal sentence can be obtained. Therefore, according to the user question sentence, the simply connected relationship of the corresponding user segmented part of speech category is found in the grammatical structure diagram. According to the simply connected relationship of the user segmented part of speech category, the simply connected relationship corresponding to all the words contained in the user question sentence is found, and it is projected into a three-dimensional matrix to obtain the connectivity features of the user segmented part of speech category unique to the user question sentence, and obtain the user word position three-dimensional matrix. The features of the user segmented words are added to the user word position three-dimensional matrix to obtain the user segmented text three-dimensional matrix containing the part of speech, the structure of the part of speech, and the meaning of the word of the user question sentence. According to the user word position three-dimensional matrix, prediction is performed to achieve the technical effect of accurately extracting the meaning in the sentence and generating more accurate questions and answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 This is a flow chart of a method for aggregate generation of AI question answers provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0066] The present invention will be described in detail below in conjunction with the accompanying drawings.
[0067] Example 1
[0068] like Figure 1 As shown, an embodiment of the present invention provides a method for generating an aggregated answer to an AI question, the method comprising:
[0069] S101: Obtain a user question sentence and a plurality of stored part-of-speech categories; the stored part-of-speech categories represent the part-of-speech categories of all words stored in a database.
[0070] Among them, in this embodiment, the database is a training company knowledge base.
[0071] The stored part-of-speech categories include nouns, verbs, predicates, adjectives, numerals, quantifiers, pronouns, adverbs, prepositions, etc.
[0072] S102: obtaining a plurality of user segmented words and corresponding user segmented part-of-speech categories based on the user question sentence by segmenting the part-of-speech network.
[0073] In this embodiment, the part-of-speech segmentation network is a convolutional neural network (CNN), and the part-of-speech segmentation network is trained according to the words stored in the database, so that the part-of-speech segmentation network can segment a sentence into multiple words.
[0074] The user segmented words represent multiple words after segmenting the user question sentence. For example, if the user question sentence is "Do you know the structure of a neural network?", the user segmented words are "you", "know", "neural network", "of", "structure", "?". The user segmented part-of-speech category corresponding to "you" is a noun, the user segmented part-of-speech category corresponding to "know" is a verb, the user segmented part-of-speech category corresponding to "neural network" is a noun, the user segmented part-of-speech category corresponding to "of" is a structural particle, the user segmented part-of-speech category corresponding to "structure" is a noun, and the user segmented part-of-speech category corresponding to "?" is an modal particle.
[0075] S103: Based on a plurality of stored part-of-speech categories, two stored part-of-speech categories are connected according to a grammatical relationship to obtain a grammatical structure diagram; the grammatical structure diagram represents a graph structure in the data structure.
[0076] The grammatical relationship is that one stored part-of-speech category can be connected with another stored part-of-speech category to form a coherent sentence.
[0077] The grammatical structure diagram uses a connectivity matrix to represent connectivity states of multiple stored part-of-speech categories.
[0078] S104: Based on a plurality of user segmented words and corresponding user segmented part-of-speech categories, a three-dimensional matrix of user word positions is obtained according to the grammatical structure diagram.
[0079] S105: According to the values corresponding to the user segmented words, the values of the corresponding positions in the three-dimensional matrix of user word positions are modified to obtain the three-dimensional matrix of user segmented text.
[0080] The user segmentation words are converted into decimal values, such as in this embodiment, "you" is converted into "092371". For example, if the user segmentation word corresponding to the user segmentation part-of-speech category corresponding to the first row, first column, and first page of the user word position three-dimensional matrix is "you", then the "1" corresponding to the user segmentation part-of-speech category corresponding to the first row, first column, and first page of the user word position three-dimensional matrix is modified to "092371". The "1" corresponding to the user segmentation part-of-speech category indicates simple connectivity.
[0081] S106: Based on the user segmented text three-dimensional matrix, determine the semantics and obtain the user's answer.
[0082] Optionally, the step of segmenting the three-dimensional matrix of text based on the user, determining semantics, and obtaining a user answer includes:
[0083] A two-dimensional convolution kernel is used to perform two-dimensional convolution on multiple pages of the three-dimensional matrix of user segmented text, extract features of partial sentences composed of partial words, and obtain multiple two-dimensional features of user word positions.
[0084] Each page of the three-dimensional matrix of user-segmented text is extracted as a two-dimensional matrix of user-segmented text; the two-dimensional matrix of user-segmented text is convolved with a two-dimensional convolution kernel with a step size of 1 to obtain a two-dimensional feature of the user word position.
[0085] The multiple user word position two-dimensional features are superimposed to obtain a first user word position three-dimensional feature.
[0086] Among them, according to the order corresponding to the multiple user segmented words, the two-dimensional features of the multiple user word positions are superimposed.
[0087] The user word position three-dimensional feature is convolved with a corresponding value using a three-dimensional convolution kernel of the same size to extract the features of the entire sentence including the repeated part, thereby obtaining a second user word position three-dimensional feature;
[0088] The second user word position three-dimensional feature is passed through the first classification network to obtain the question keyword.
[0089] Among them, in this embodiment, the first classification network is a convolutional neural network (Convolutional Neural Networks, CNN).
[0090] According to the question keywords, features are extracted through a keyword feature extraction network to obtain keyword features.
[0091] Among them, in this embodiment, the keyword feature extraction network is a fully connected neural network (FullConnect Neural Network).
[0092] According to the user's segmented text features and keyword features, the user's answer is obtained through the second classification network.
[0093] In this embodiment, the second classification network is a fully connected neural network. The number of neurons in the keyword feature extraction network and the second classification network is different.
[0094] Optionally, the training method of the keyword feature extraction network, the first classification network and the second classification network includes:
[0095] Obtain training keywords, three-dimensional features of training word positions and annotated answers; the training keywords represent keywords in a string of sentences; the annotated answers represent answers in a string of sentences; the three-dimensional features of training word positions are features of sentences corresponding to the training keywords.
[0096] The sentence is a sentence with a known answer used to predict the keyword feature extraction network, the first classification network and the second classification network.
[0097] Passing the three-dimensional features of the training word positions through a first classification network to obtain predicted question keywords;
[0098] Using the predicted question keyword as a tag keyword;
[0099] The loss is calculated by comparing the marked keyword with the predicted question keyword to train the first classification network.
[0100] Among them, the cross entropy loss function is used to calculate the loss.
[0101] Based on the predicted question keyword answer key-value pair, according to the predicted question keyword, a predicted keyword feature is obtained through a keyword feature extraction network;
[0102] According to the training user segmentation text features and predicted keyword features, the predicted answer is obtained through the second classification network;
[0103] The loss is calculated by comparing the predicted answer with the labeled answer, and the second classification network, the keyword feature extraction network and the first classification network are trained to obtain the trained second classification network, the keyword feature extraction network and the first classification network.
[0104] Among them, the cross entropy loss function is used to calculate the loss.
[0105] Optionally, the three-dimensional matrix of user word positions is obtained based on the plurality of user segmented words and the corresponding user segmented part-of-speech categories according to the grammatical structure diagram, including:
[0106] According to the order corresponding to the multiple user segmented words, the multiple user segmented part-of-speech categories are combined to construct a user segmented part-of-speech category set.
[0107] The multiple user-segmented part-of-speech categories are arranged in the order corresponding to the multiple user-segmented words, and the arranged user-segmented part-of-speech categories are sequentially added to the user-segmented part-of-speech category set.
[0108] Based on multiple user segmentation part-of-speech categories, a user grammar graph is obtained according to the grammar structure graph.
[0109] The user grammar graph is a part that only includes the user segmented part-of-speech categories corresponding to the user segmented words in the grammar structure graph.
[0110] Based on the user segmented part-of-speech category set, the connectivity status of the user segmented part-of-speech category in the user grammar graph is extracted, multiple sentence two-dimensional matrices are constructed, and a three-dimensional matrix of word positions is obtained.
[0111] Optionally, the step of connecting two part-of-speech categories based on a plurality of stored part-of-speech categories according to a grammatical relationship to obtain a grammatical structure diagram includes:
[0112] Two stored part-of-speech categories are randomly extracted from the n stored part-of-speech categories as the i-th part-of-speech category and the j-th part-of-speech category.
[0113] Wherein, n is a natural number greater than 0.
[0114] According to the grammatical relationship, it is determined whether the j-th part-of-speech category is the next stored part-of-speech category adjacent to the ith part-of-speech category and whether the sentence is fluent.
[0115] If the word type of a word is a predicate, and the word type of its neighbor is also a predicate, then the sentence is not fluent. For example, "He said he saw the scenery" and "said" and "see" are both predicates, so the sentence is not fluent.
[0116] If the j-th part-of-speech category is the next stored part-of-speech category adjacent to the ith part-of-speech category in a coherent sentence, mark the ith part-of-speech category as being simply connected to the j-th part-of-speech category to obtain a connected set.
[0117] i and j are natural numbers greater than 0 and less than and equal to n.
[0118] The n stored part-of-speech categories are added to a point set, and the connected set is added to an edge set to obtain a grammatical structure diagram.
[0119] Optionally, the method extracts the connectivity states of the user-segmented part-of-speech categories in the user grammar graph based on the user-segmented part-of-speech category set, constructs multiple sentence two-dimensional matrices, and obtains a three-dimensional matrix of word positions, including:
[0120] Constructing a sentence two-dimensional matrix; the initial values in the sentence two-dimensional matrix are all 0; the number of rows in the sentence two-dimensional matrix is equal to the number of columns and the number of values in the user segmented part-of-speech category set;
[0121] Based on the user segmented part-of-speech category set, segmentation is performed according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets;
[0122] In the user grammar graph, the connectivity states corresponding to the multiple user word category sets included in the user word category set are copied to the sentence two-dimensional matrix; and multiple sentence two-dimensional matrices are obtained corresponding to the multiple user word category sets.
[0123] Among them, the 1-connected state corresponding to the connectivity matrix corresponding to the user syntax graph is copied to the sentence two-dimensional matrix.
[0124] The plurality of sentence two-dimensional matrices are arranged in the order corresponding to the part-of-speech category sets segmented by the user to obtain a word position three-dimensional matrix.
[0125] Optionally, the number of channels of the three-dimensional convolution kernel is equal to the product of the number of channels of the two-dimensional convolution kernel multiplied by 2; the number of channels of the three-dimensional convolution kernel is less than the number of pages of the three-dimensional matrix for segmenting text by the user; the number of rows of the three-dimensional convolution kernel is less than the number of rows of the three-dimensional matrix for segmenting text by the user; and the number of columns of the three-dimensional convolution kernel is less than the number of columns of the three-dimensional matrix for segmenting text by the user.
[0126] Optionally, the segmenting of the part-of-speech category set based on the user is performed according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets, including:
[0127] sequentially detecting the values in the user segmentation part-of-speech category set, and if a user segmentation part-of-speech category that is the same as the multiple user segmentation part-of-speech categories that have been detected appears, obtaining a first user segmentation part-of-speech category;
[0128] The detected multiple user segmented part-of-speech categories in the user segmented part-of-speech category set except the first user segmented part-of-speech category are used as the first user part-of-speech category set;
[0129] The plurality of user segmented part-of-speech categories that have not been detected in the user segmented part-of-speech category set and the first user segmented part-of-speech category are used as a second user part-of-speech category set;
[0130] sequentially detecting the values in the second user segmented part-of-speech category set, and if a user segmented part-of-speech category that is the same as the multiple user segmented part-of-speech categories that have been detected appears, obtaining the second user segmented part-of-speech category;
[0131] The detected multiple user segmented part-of-speech categories other than the second user segmented part-of-speech category in the second user segmented part-of-speech category set are used as a third user part-of-speech category set;
[0132] The plurality of user segmented part-of-speech categories that have not been detected in the second user segmented part-of-speech category set and the second user segmented part-of-speech category are taken as a fourth user part-of-speech category set.
[0133] Among them, if the user's question sentence is "Do you know the structure of the neural network?", the user segmentation part-of-speech category corresponding to "neural network" is noun, the first user segments the part-of-speech category into noun, and divides the first part-of-speech category set into {noun, verb}, the noun corresponds to "you", and the verb corresponds to "know", and the second part-of-speech category set is divided into {noun, structural particle, noun, modal particle}, the structural particle corresponds to "of", the "structure" corresponds to noun, and the modal particle corresponds to "?", the second user segments the part-of-speech category into noun, and divides the third part-of-speech category set into {noun, structural particle}, and the fourth part-of-speech category set is divided into {noun, modal particle}.
[0134] The user segmented part-of-speech category set corresponds to obtaining multiple user part-of-speech category sets.
[0135] Optionally, the segmenting of part-of-speech categories based on multiple users and obtaining a user grammar diagram according to the grammar structure diagram include:
[0136] Add multiple user segmented part-of-speech categories to the point set of the user grammar graph;
[0137] The edges corresponding to the point set of the user grammar graph are found in the edge set of the grammar structure graph to obtain a plurality of user grammar edges.
[0138] Add multiple user grammar edges to the edge set of the user grammar graph to obtain the user grammar graph.
[0139] Among them, the edge is represented by a connectivity matrix, and the value corresponding to the point set of the user syntax graph in the connectivity matrix is found. If the value is 1, it means that the point corresponding to the row number is simply connected to the point corresponding to the column number. If it is 0, it means that the point corresponding to the row number is not connected to the point corresponding to the column number.
[0140] Among them, the connectivity states of the points and edges corresponding to the multiple user-segmented part-of-speech categories in the grammatical structure diagram are retained as the user grammar diagram.
[0141] Example 2
[0142] Based on the above-mentioned method for aggregate generation of AI question answers, an embodiment of the present invention also provides a system for aggregate generation of AI question answers, the system comprising an acquisition module, a segmentation module, a graph structure construction module, a three-dimensional construction module, a user segmentation word feature adding module and a detection and answering module.
[0143] The acquisition module is used to obtain the user's question sentence and multiple stored part-of-speech categories; the stored part-of-speech categories represent the part-of-speech categories of all words stored in the database.
[0144] The segmentation module is used to obtain a plurality of user segmented words and corresponding user segmented part-of-speech categories based on the user question sentence by segmenting the part-of-speech network.
[0145] The graph structure building module is used to connect two stored part-of-speech categories based on multiple stored part-of-speech categories according to grammatical relations to obtain a grammatical structure graph; the grammatical structure graph represents the graph structure in the data structure.
[0146] The three-dimensional construction module is used to obtain a three-dimensional matrix of user word positions based on multiple user segmented words and corresponding user segmented part-of-speech categories according to the grammatical structure diagram.
[0147] The user segmentation word feature adding module is used to modify the value of the corresponding position in the user word position three-dimensional matrix according to the value corresponding to the user segmentation word, so as to obtain the user segmentation text three-dimensional matrix.
[0148] The detection and answering module is used to determine the semantics and obtain the user's answer based on the user's segmented text three-dimensional matrix.
Claims
1. A method for generating aggregated answers to AI questions, characterized in that: include: Obtaining a user's question sentence and multiple stored part-of-speech categories; The stored part-of-speech categories represent the categories of the parts of speech of all words stored in the database; By segmenting the part-of-speech network, based on the user question sentence, a plurality of user segmented words and corresponding user segmented part-of-speech categories are obtained; Based on a plurality of stored part-of-speech categories, two stored part-of-speech categories are connected according to a grammatical relationship to obtain a grammatical structure diagram; the grammatical structure diagram represents a graph structure in a data structure; Based on a plurality of user segmented words and corresponding user segmented part-of-speech categories, a three-dimensional matrix of user word positions is obtained according to the grammatical structure diagram; According to the values corresponding to the user segmented words, the values of the corresponding positions in the three-dimensional matrix of user word positions are modified to obtain the three-dimensional matrix of user segmented words; Based on the user segmented text three-dimensional matrix, the semantics is judged to obtain the user's answer; The method of segmenting the text three-dimensional matrix based on the user, judging the semantics, and obtaining the user's answer includes: Using a two-dimensional convolution kernel, two-dimensionally convolve multiple pages of the three-dimensional matrix of user segmented text respectively, extract the features of partial sentences composed of partial words, and obtain multiple two-dimensional features of user word positions; Superimposing the plurality of user word position two-dimensional features to obtain a first user word position three-dimensional feature; The user word position three-dimensional feature is convolved with a corresponding value using a three-dimensional convolution kernel of the same size to extract the features of the entire sentence including the repeated part, thereby obtaining a second user word position three-dimensional feature; Passing the second user word position three-dimensional feature through the first classification network to obtain the question keyword; According to the question keywords, extract features through a keyword feature extraction network to obtain keyword features; According to the user segmentation text features and keyword features, the user answer is obtained through the second classification network; based on the multiple user segmentation words and the corresponding user segmentation part-of-speech categories, according to the grammatical structure diagram, a three-dimensional matrix of user word positions is obtained, including: According to the order corresponding to the multiple user segmented words, the multiple user segmented part-of-speech categories are constructed into a user segmented part-of-speech category set; Segment the part-of-speech categories based on multiple users, and obtain a user grammar graph according to the grammar structure graph; Based on the user segmented part-of-speech category set, the connectivity state of the user segmented part-of-speech category in the user grammar graph is extracted, multiple sentence two-dimensional matrices are constructed, and a three-dimensional matrix of word positions is obtained; The method connects two part-of-speech categories based on a plurality of stored part-of-speech categories according to a grammatical relationship to obtain a grammatical structure diagram, including: Randomly extract two stored part-of-speech categories from the n stored part-of-speech categories as the i-th part-of-speech category and the j-th part-of-speech category; According to the grammatical relationship, determine whether the j-th part-of-speech category is the next stored part-of-speech category adjacent to the i-th part-of-speech category and whether the sentence is fluent; If the jth part-of-speech category is the next stored part-of-speech category adjacent to the ith part-of-speech category, the ith part-of-speech category is marked as being simply connected to the jth part-of-speech category, and a connected set is obtained; i and j are natural numbers greater than 0 and less than and equal to n; The n stored part-of-speech categories are added to a point set, and the connected set is added to an edge set to obtain a grammatical structure diagram.
2. The method for generating aggregated answers to AI questions according to claim 1, characterized in that: The training method of the keyword feature extraction network, the first classification network and the second classification network comprises: Obtain training keywords, three-dimensional features of training word positions and annotated answers; the training keywords represent keywords in a string of sentences; the annotated answers represent answers in a string of sentences; the three-dimensional features of training word positions are features of sentences corresponding to the training keywords; Passing the three-dimensional features of the training word positions through a first classification network to obtain predicted question keywords; Using the predicted question keyword as a tag keyword; Calculate the loss between the marked keyword and the predicted question keyword to train the first classification network; According to the predicted question keywords, a predicted keyword feature is obtained through a keyword feature extraction network; According to the training user segmentation text features and predicted keyword features, the predicted answer is obtained through the second classification network; The loss is calculated by comparing the predicted answer with the labeled answer, and the second classification network, the keyword feature extraction network and the first classification network are trained to obtain the trained second classification network, the keyword feature extraction network and the first classification network.
3. The method for generating aggregated answers to AI questions according to claim 1, characterized in that: The method extracts the connectivity status of the user-segmented part-of-speech categories in the user grammar graph based on the user-segmented part-of-speech category set, constructs multiple sentence two-dimensional matrices, and obtains a word position three-dimensional matrix, including: Constructing a sentence two-dimensional matrix; the initial values in the sentence two-dimensional matrix are all 0; the number of rows in the sentence two-dimensional matrix is equal to the number of columns and the number of values in the user segmented part-of-speech category set; Based on the user segmented part-of-speech category set, segmentation is performed according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets; In the user grammar graph, the connectivity states corresponding to the multiple user word category sets included in the user word category set are copied to the sentence two-dimensional matrix; and multiple sentence two-dimensional matrices are obtained corresponding to the multiple user word category sets; The plurality of sentence two-dimensional matrices are arranged in the order corresponding to the part-of-speech category sets segmented by the user to obtain a word position three-dimensional matrix.
4. The method for generating aggregated answers to AI questions according to claim 1, characterized in that: The number of channels of the three-dimensional convolution kernel is equal to the product of the number of channels of the two-dimensional convolution kernel multiplied by 2; the number of channels of the three-dimensional convolution kernel is less than the number of pages of the three-dimensional matrix of the user's segmented text; the number of rows of the three-dimensional convolution kernel is less than the number of rows of the three-dimensional matrix of the user's segmented text; the number of columns of the three-dimensional convolution kernel is less than the number of columns of the three-dimensional matrix of the user's segmented text.
5. The method for generating aggregated answers to AI questions according to claim 3, characterized in that: The part-of-speech category set is segmented based on the user, and segmented according to repeated stored part-of-speech categories to obtain multiple user part-of-speech category sets, including: sequentially detecting the values in the user segmentation part-of-speech category set, and if a user segmentation part-of-speech category that is the same as the multiple user segmentation part-of-speech categories that have been detected appears, obtaining a first user segmentation part-of-speech category; The detected multiple user segmented part-of-speech categories in the user segmented part-of-speech category set except the first user segmented part-of-speech category are used as the first user part-of-speech category set; The plurality of user segmented part-of-speech categories that are not detected in the user segmented part-of-speech category set and the first user segmented part-of-speech category are used as a second user part-of-speech category set; sequentially detecting the values in the second user segmented part-of-speech category set, and if a user segmented part-of-speech category that is the same as the multiple user segmented part-of-speech categories that have been detected appears, obtaining the second user segmented part-of-speech category; The detected multiple user segmented part-of-speech categories other than the second user segmented part-of-speech category in the second user segmented part-of-speech category set are used as a third user part-of-speech category set; taking the undetected multiple user segmented part-of-speech categories in the second user segmented part-of-speech category set and the second user segmented part-of-speech category as a fourth user part-of-speech category set; The user segmented part-of-speech category set corresponds to obtaining multiple user part-of-speech category sets.
6. The method for generating aggregated answers to AI questions according to claim 1, characterized in that: The method of segmenting the part-of-speech categories based on multiple users and obtaining a user grammar diagram according to the grammar structure diagram includes: Add multiple user segmented part-of-speech categories to the point set of the user grammar graph; Finding edges corresponding to the point set of the user grammar graph in the edge set of the grammar structure graph to obtain multiple user grammar edges; Add multiple user grammar edges to the edge set of the user grammar graph to obtain the user grammar graph.
7. An AI question and answer aggregation generation system, characterized in that: include: Acquisition module: obtains user question sentences and multiple stored part-of-speech categories; The stored part-of-speech categories represent the categories of the parts of speech of all words stored in the database; Segmentation module: obtains a plurality of user segmented words and corresponding user segmented part-of-speech categories based on the user question sentence by segmenting the part-of-speech network; Graph structure building module: based on multiple stored part-of-speech categories, two stored part-of-speech categories are connected according to grammatical relations to obtain a grammatical structure graph; the grammatical structure graph represents the graph structure in the data structure; Three-dimensional construction module: based on multiple user segmentation words and corresponding user segmentation part-of-speech categories, according to the grammatical structure diagram, a three-dimensional matrix of user word positions is obtained; User segmentation word feature adding module: according to the value corresponding to the user segmentation word, modify the value of the corresponding position in the user word position three-dimensional matrix to obtain the user segmentation text three-dimensional matrix; Detection and answer module: based on the user segmented text three-dimensional matrix, judge the semantics and obtain the user's answer; The method of segmenting the text three-dimensional matrix based on the user, judging the semantics, and obtaining the user's answer includes: Using a two-dimensional convolution kernel, two-dimensionally convolve multiple pages of the three-dimensional matrix of user segmented text respectively, extract the features of partial sentences composed of partial words, and obtain multiple two-dimensional features of user word positions; Superimposing the plurality of user word position two-dimensional features to obtain a first user word position three-dimensional feature; The user word position three-dimensional feature is convolved with a corresponding value using a three-dimensional convolution kernel of the same size to extract the features of the entire sentence including the repeated part, thereby obtaining a second user word position three-dimensional feature; Passing the second user word position three-dimensional feature through the first classification network to obtain the question keyword; According to the question keywords, extract features through a keyword feature extraction network to obtain keyword features; According to the user segmentation text features and keyword features, the user answer is obtained through the second classification network; based on the multiple user segmentation words and the corresponding user segmentation part-of-speech categories, according to the grammatical structure diagram, a three-dimensional matrix of user word positions is obtained, including: According to the order corresponding to the multiple user segmented words, the multiple user segmented part-of-speech categories are constructed into a user segmented part-of-speech category set; Segment the part-of-speech categories based on multiple users, and obtain a user grammar graph according to the grammar structure graph; Based on the user segmented part-of-speech category set, the connectivity state of the user segmented part-of-speech category in the user grammar graph is extracted, multiple sentence two-dimensional matrices are constructed, and a three-dimensional matrix of word positions is obtained; The method connects two part-of-speech categories based on a plurality of stored part-of-speech categories according to a grammatical relationship to obtain a grammatical structure diagram, including: Randomly extract two stored part-of-speech categories from the n stored part-of-speech categories as the i-th part-of-speech category and the j-th part-of-speech category; According to the grammatical relationship, determine whether the j-th part-of-speech category is the next stored part-of-speech category adjacent to the i-th part-of-speech category and whether the sentence is fluent; If the jth part-of-speech category is the next stored part-of-speech category adjacent to the ith part-of-speech category, the ith part-of-speech category is marked as being simply connected to the jth part-of-speech category, and a connected set is obtained; i and j are natural numbers greater than 0 and less than and equal to n; The n stored part-of-speech categories are added to a point set, and the connected set is added to an edge set to obtain a grammatical structure diagram.
Citation Information
Patent Citations
Question and answer implementation method and device based on knowledge graph
CN114691820A
Extraction-generation type answer generation model and method based on pre-training
CN117932066A