Agricultural knowledge question and answer method and device, storage medium and computer equipment
By deeply text processing of agricultural knowledge questions and extracting key features, the problem of insufficient correlation of agricultural problem search results in the existing technology is solved, and more efficient and accurate matching of agricultural knowledge questions and answers is achieved.
Patent Information
- Application Number
- CN202410305324.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-12-27
AI Technical Summary
When the existing agricultural Q&A community deals with complex or regional agricultural issues, the relevance and accuracy of the search results are insufficient and fails to fully meet the personalized needs of farmers.
By discontinuing words, word segmentation, and word disassembly processing of agricultural knowledge question text, text vectors are constructed, and spatial and timing features are extracted using convolutional attention calculation and bidirectional long and short-term memory networks to calculate text similarity to match question and answer text.
The accuracy and intelligence level of the agricultural knowledge question and answer system have been improved, and it can better meet users' query needs for agricultural professional knowledge and achieve efficient retrieval and intelligent recommendation.
Smart Images

Figure CN119202147A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an agricultural knowledge question-answering method and device, a storage medium, and a computer device. Background Art
[0002] At present, the "China Agricultural Technology Extension" agricultural question-and-answer community has accumulated a very large database of short text questions and answers in the agricultural field. These data cover practical knowledge and experience sharing in various agricultural sub-sectors such as planting, breeding, pest control, agricultural product processing, and agricultural machinery operation. Farmers can browse the rich database in depth on this platform, find solutions to various problems they encounter in agricultural production practice, and achieve convenient and efficient information acquisition.
[0003] At the same time, the community also encourages farmers to actively participate in the interaction. They can raise questions or confusions they encounter in the agricultural production process anytime and anywhere. Based on the massive question and answer data it has accumulated, the platform uses intelligent matching technology to quickly search and provide possible answers. However, despite this, the current platform's search function still has a lot of room for improvement. For some complex, professional or regional agricultural issues, the relevance and accuracy of the search results are not satisfactory, and fail to fully meet the personalized needs of the majority of farmers.
[0004] Therefore, it is particularly urgent and important to optimize and improve the search algorithms and functions of the "China Agricultural Technology Extension" agricultural question-and-answer community, further improve the search results, accurately locate and match the actual needs of farmers, and thus better serve the development of my country's modern agriculture and farmers' actual production activities. Summary of the invention
[0005] In view of this, the embodiments of the present application provide an agricultural knowledge question and answer method and device, a storage medium, and a computer device, which help to improve the accuracy of obtaining question and answer texts.
[0006] According to one aspect of the present application, there is provided an agricultural knowledge question-answering method, the method comprising:
[0007] Receiving an agricultural knowledge question text on an agricultural knowledge question-answering platform, removing stop words from the agricultural knowledge question text, and then performing word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text;
[0008] Decomposing the single word to obtain a decomposed character shape, determining a character vector of the single word based on the decomposed character shape and the four-corner number of the single word, and constructing a text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the character vector;
[0009] Based on the preset convolution kernels of multiple scales, convolution attention calculation is performed on the text vector to obtain convolution kernel outputs of multiple scales corresponding to the text vector, and fusion calculation is performed on the convolution kernel outputs of multiple scales to obtain the spatial fusion feature corresponding to the text vector;
[0010] The text vector is calculated by a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, and the forward features and the backward features are fused to obtain a time series fusion feature corresponding to the text vector;
[0011] Determine the target text feature corresponding to the text vector according to the spatial fusion feature and the temporal fusion feature;
[0012] The preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform are obtained, and the target similarities between each of the preset text features and the target text features are respectively calculated, and the matching question and answer texts in the existing question and answer texts are determined based on the target similarities for output.
[0013] Optionally, determining the word vector of the single word based on the decomposed character shape and the four-corner number of the single word includes:
[0014] Deduplication of the decomposed character shapes is performed based on the single word, the deduplication of the decomposed character shapes is vectorized, and the four-corner codes of the repeated character shapes between the single word and the decomposed character shapes are vectorized;
[0015] The vectorization conversion result of the deduplicated split character shape and the vectorization conversion result of the repeated character shape are combined to determine the character vector of the single word.
[0016] Optionally, before constructing the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the word vector, the method further includes:
[0017] Taking the intersection of the phrase and the single word to determine the repeated word, performing vectorization conversion on the remaining words in the phrase except the repeated word, and performing vectorization conversion on the four-corner number of the repeated word;
[0018] Based on the vectorized conversion results of the remaining characters and the vectorized conversion results of the repeated characters, a phrase vector corresponding to the phrase is determined.
[0019] Optionally, the multiple scales include two; the convolution kernel output includes a first convolution kernel output and a second convolution kernel output;
[0020] The fusion calculation of the convolution kernel outputs of multiple scales to obtain the spatial fusion features corresponding to the text vector includes:
[0021] Concatenate the first convolution kernel output and the second convolution kernel output to obtain a third convolution kernel output;
[0022] The first convolution kernel output, the second convolution kernel output and the third convolution kernel output are calculated through a preset attention channel weighted network to obtain a spatial fusion feature corresponding to the text vector;
[0023] Among them, the attention channel weighted network includes a local attention channel, a global attention channel, an activation layer and a fusion layer. The local attention channel and the global attention channel are used to perform attention calculation on the third convolution kernel output respectively. The activation layer calculates the local attention calculation results and the global attention calculation results to obtain an activation result. The fusion layer calculates the first tensor product between the activation result and the first convolution kernel output, calculates the difference between a preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output, and fuses the first tensor product and the second tensor product to obtain the spatial fusion feature.
[0024] Optionally, the determining, based on the target similarity, to output a matching question and answer text in the existing question and answer text includes:
[0025] Based on the descending sort order of the target similarity, the existing question and answer text is output.
[0026] Optionally, before obtaining the preset text features corresponding to the existing question texts in each existing question and answer text in the agricultural knowledge question and answer platform, the method further includes:
[0027] Calculate the similarity between the existing question texts based on the preset text features, and determine the existing question and answer text group that meets the preset similarity condition; generate a unified text feature corresponding to the existing question text group based on the preset text features corresponding to each existing question text in the existing question and answer text group;
[0028] Calling a large language model to fuse each existing answer text in the existing question and answer text group to obtain a unified answer text corresponding to the existing question and answer text group, and calling a large language model to fuse each existing question text in the existing question and answer text group to obtain a unified question text corresponding to the existing question text group, and generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text;
[0029] Each existing question and answer text in the existing question and answer text group is replaced with the unified question and answer text.
[0030] Optionally, after calculating the similarity between the existing question texts based on the preset text features and determining the existing question and answer text group that meets the preset similarity condition, the method further includes:
[0031] Outputting the existing question-and-answer text group to a manual review terminal, and receiving a first review result of the existing question-and-answer text group by the manual review terminal;
[0032] Based on the first review result, determining the confirmed existing question and answer texts in the existing question and answer text group, and updating the existing question and answer text group;
[0033] After generating the unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text, the method further includes:
[0034] Outputting the unified question and answer text to the manual review terminal, and receiving a second review result of the unified question and answer text by the manual review terminal;
[0035] If the second review result indicates that the unified question and answer text has passed the review, then replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text is performed;
[0036] If the second review result indicates that the unified question and answer text has not passed the review, the large language model is called to regenerate the unified question and answer text based on the failure reason in the second review result, the existing question texts in the existing question and answer text group, and the unified question and answer text, and transmit it to the manual review terminal until the generated unified question and answer text passes the review.
[0037] According to another aspect of the present application, an agricultural knowledge question-answering device is provided, the device comprising:
[0038] A question word segmentation module is used to receive agricultural knowledge question text on the agricultural knowledge question-answering platform, remove stop words from the agricultural knowledge question text, and then perform word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text;
[0039] A feature extraction module is used to perform character decomposition processing on the single word to obtain the decomposition character shape, determine the character vector of the single word based on the decomposition character shape and the four-corner number of the single word, and construct the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the character vector;
[0040] A feature enhancement module is used to perform convolution attention calculation on the text vector based on convolution kernels of preset multiple scales, obtain convolution kernel outputs of multiple scales corresponding to the text vector, perform fusion calculation on the convolution kernel outputs of multiple scales, and obtain spatial fusion features corresponding to the text vector; calculate the text vector through a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, perform fusion calculation on the forward features and the backward features, and obtain temporal fusion features corresponding to the text vector;
[0041] A feature fusion module, used to determine the target text feature corresponding to the text vector according to the spatial fusion feature and the temporal fusion feature;
[0042] The answer matching module is used to obtain the preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform, and respectively calculate the target similarity between each of the preset text features and the target text features, and determine the matching question and answer texts in the existing question and answer texts based on the target similarity for output.
[0043] Optionally, the feature extraction module is used to:
[0044] Deduplication of the decomposed character shapes is performed based on the single word, the deduplication of the decomposed character shapes is vectorized, and the four-corner codes of the repeated character shapes between the single word and the decomposed character shapes are vectorized;
[0045] The vectorization conversion result of the deduplicated split character shape and the vectorization conversion result of the repeated character shape are combined to determine the character vector of the single word.
[0046] Optionally, the feature extraction module is used to:
[0047] Taking the intersection of the phrase and the single word to determine the repeated word, performing vectorization conversion on the remaining words in the phrase except the repeated word, and performing vectorization conversion on the four-corner number of the repeated word;
[0048] Based on the vectorized conversion results of the remaining characters and the vectorized conversion results of the repeated characters, a phrase vector corresponding to the phrase is determined.
[0049] Optionally, the multiple scales include two; the convolution kernel output includes a first convolution kernel output and a second convolution kernel output;
[0050] The feature enhancement module is used to:
[0051] Concatenate the first convolution kernel output and the second convolution kernel output to obtain a third convolution kernel output;
[0052] The first convolution kernel output, the second convolution kernel output and the third convolution kernel output are calculated through a preset attention channel weighted network to obtain a spatial fusion feature corresponding to the text vector;
[0053] Among them, the attention channel weighted network includes a local attention channel, a global attention channel, an activation layer and a fusion layer. The local attention channel and the global attention channel are used to perform attention calculation on the third convolution kernel output respectively. The activation layer calculates the local attention calculation results and the global attention calculation results to obtain an activation result. The fusion layer calculates the first tensor product between the activation result and the first convolution kernel output, calculates the difference between a preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output, and fuses the first tensor product and the second tensor product to obtain the spatial fusion feature.
[0054] Optionally, the answer matching module is used to:
[0055] Based on the descending sort order of the target similarity, the existing question and answer text is output.
[0056] Optionally, the device further comprises: a text unification module, configured to:
[0057] Calculate the similarity between the existing question texts based on the preset text features, and determine an existing question and answer text group that meets the preset similarity condition; generate a unified text feature corresponding to the existing question text group based on the preset text features corresponding to each existing question text in the existing question and answer text group;
[0058] Calling a large language model to fuse each existing answer text in the existing question and answer text group to obtain a unified answer text corresponding to the existing question and answer text group, and calling a large language model to fuse each existing question text in the existing question and answer text group to obtain a unified question text corresponding to the existing question text group, and generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text;
[0059] Each existing question and answer text in the existing question and answer text group is replaced with the unified question and answer text.
[0060] Optionally, the text unification module is further used to:
[0061] Outputting the existing question and answer text group to a manual review terminal, and receiving a first review result of the existing question and answer text group by the manual review terminal; based on the first review result, determining the confirmed existing question and answer text in the existing question and answer text group, and updating the existing question and answer text group;
[0062] The text unification module is also used for:
[0063] Outputting the unified question and answer text to the manual review terminal, and receiving a second review result of the unified question and answer text by the manual review terminal;
[0064] If the second review result indicates that the unified question and answer text has passed the review, then replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text is performed;
[0065] If the second review result indicates that the unified question and answer text has not passed the review, the large language model is called to regenerate the unified question and answer text based on the failure reason in the second review result, the existing question texts in the existing question and answer text group, and the unified question and answer text, and transmit it to the manual review terminal until the generated unified question and answer text passes the review.
[0066] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned agricultural knowledge question and answer method is implemented.
[0067] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned agricultural knowledge question and answer method when executing the program.
[0068] By means of the above technical scheme, an agricultural knowledge question-and-answer method and device, storage medium, and computer equipment provided in the embodiment of the present application, by removing stop words and segmenting the question text on the agricultural knowledge question-and-answer platform, extracting key phrases and single-word information, not only retaining effective vocabulary, but also using word splitting technology to obtain a deeper level of semantic understanding, and constructing a comprehensive text vector expression through word vectors and phrase vectors, thereby improving the refinement of agricultural knowledge questions and answers. Convolutional attention calculations are performed on text vectors using preset multiple-scale convolution kernels to obtain feature representations of the text at different granularities. By fusing these features of different scales, spatial fusion features of the text are formed, which enhances the model's ability to understand complex agricultural knowledge structures. A bidirectional long short-term memory network is used to capture the forward and backward dependencies of text vectors, forming forward features and backward features, and obtaining temporal fusion features through fusion calculations, which helps the model understand and reason about time series correlations in agricultural knowledge questions. The target text features constructed based on the spatial fusion features and the temporal fusion features are compared and calculated with the preset text features in the existing question and answer texts to obtain the target similarity, thereby accurately finding the agricultural knowledge question and answer that best matches the user input question, and realizing efficient retrieval and intelligent recommendation functions. Therefore, the embodiment of the present application greatly improves the accuracy, intelligence level and user experience of the agricultural knowledge question and answer system through a series of deep text processing and feature extraction technologies, and can better meet the user's needs for agricultural professional knowledge query.
[0069] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0071] Figure 1 A schematic diagram of a flow chart of an agricultural knowledge question-answering method provided in an embodiment of the present application is shown;
[0072] Figure 2 A schematic diagram of the structure of an agricultural knowledge question-and-answer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0073] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0074] In this embodiment, an agricultural knowledge question-answering method is provided. Figure 1 As shown, the method includes:
[0075] Step 101, receiving agricultural knowledge question text on the agricultural knowledge question and answer platform, removing stop words from the agricultural knowledge question text, and then performing word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text.
[0076] In the embodiment of the present application, when farmers and other users want to learn about agricultural knowledge, they can enter corresponding questions on the agricultural knowledge question-answering platform, and the received questions are used as agricultural knowledge question texts. Stop words are first removed from the agricultural knowledge question texts, which reduces their impact on the text semantics and improves the subsequent processing efficiency. Then, the agricultural knowledge question texts after the stop words are removed are segmented using the agricultural knowledge word segmentation library to determine the phrases in the agricultural knowledge word segmentation library that belong to the word segmentation and the single words that do not belong to the word segmentation in the agricultural knowledge question texts.
[0077] Step 102, decomposing the single word to obtain the decomposed glyph, determining the word vector of the single word based on the decomposed glyph and the four-corner number of the single word, and constructing the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the word vector.
[0078] In the embodiment of the present application, for the phrases and single words obtained after word segmentation, vectorization conversion can be performed in different ways. Among them, generally speaking, the phrase is segmented based on the agricultural knowledge word segmentation library, and the content in the agricultural knowledge word segmentation library is hit, usually with a certain meaning expression ability, and the single word does not hit the agricultural knowledge word segmentation library, which may be due to input errors, cognitive errors or other factors that cannot accurately express the user's true intentions. Therefore, for the single word part, the embodiment of the present application performs word splitting processing on the single word, so as to split the single word into a glyph that helps to expand the expression ability of the single word by splitting the word, and determine the word vector of the single word based on the word splitting glyph and the four-corner number of the single word, so as to improve the meaning expression ability of the single word. Thereby, the phrase vector corresponding to the phrase and the word vector corresponding to the single word are constructed as the text vector of the complete agricultural knowledge question text.
[0079] Optionally, the determining the word vector of the single word based on the split character shape and the four-corner code of the single word includes: deduplicating the split character shape based on the single word, vectorizing the deduplicated split character shapes, and vectorizing the four-corner codes of repeated characters between the single word and the split character shape; merging the vectorization conversion results of the deduplicated split character shapes and the vectorization conversion results of the repeated characters to determine the word vector of the single word.
[0080] In this embodiment, in order to avoid the duplication of the meaning of a single word affecting the subsequent feature calculation efficiency and feature quality, the decomposed glyphs are first deduplicated based on the single word, and the parts of the decomposed glyphs that are not repeated with the single word are vectorized, and the parts of the decomposed glyphs that are repeated with the single word, i.e., repeated glyphs, are vectorized because they are complete characters that cannot be decomposed and have unique meanings. Therefore, the four-corner numbers of the repeated glyphs can be vectorized to obtain a feature vector of the four-corner numbers of the repeated glyphs that represents unique features. Finally, the vectorized conversion results of the deduplicated decomposed glyphs and the vectorized conversion results corresponding to the repeated glyphs are merged to obtain the word vector of the single word.
[0081] Optionally, determining the phrase vector of a phrase includes: taking the intersection of the phrase and the single word to determine the repeated word, performing vectorization conversion on the remaining words in the phrase except the repeated word, and performing vectorization conversion on the four-corner numbers of the repeated word; based on the vectorization conversion results of the remaining words and the vectorization conversion results of the repeated word, determining the phrase vector corresponding to the phrase.
[0082] In this embodiment, for the phrase vector, the repeated words between the phrase and the single word can be determined first, and the remaining words in the phrase except the repeated words can be vectorized. For the repeated words, the four-corner numbers of the repeated words can be vectorized, so as to determine the phrase vector based on the vectorization conversion results of these two parts.
[0083] Step 103: Perform convolution attention calculation on the text vector based on convolution kernels of multiple preset scales to obtain convolution kernel outputs of multiple scales corresponding to the text vector, perform fusion calculation on the convolution kernel outputs of multiple scales to obtain spatial fusion features corresponding to the text vector; calculate the text vector through a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, perform fusion calculation on the forward features and the backward features to obtain temporal fusion features corresponding to the text vector; determine the target text features corresponding to the text vector according to the spatial fusion features and the temporal fusion features.
[0084] In an embodiment of the present application, after obtaining a text vector to express the text features, the text vector is enhanced based on both space and time, and the two enhanced features are fused to obtain the final target text features. Among them, the text vector can be enhanced at multiple scales through a multi-scale attention calculation model to obtain a text vector enhancement result based on multiple convolution kernel scales, i.e., a convolution kernel output, to obtain a feature enhancement result based on a feature space position, and the multi-scale convolution kernel output is fused to obtain the spatial fusion features of the text vector. In addition, the text vector can be forward calculated and backward calculated through a bidirectional difference degree periodic memory network to obtain forward features and backward features, and the two are fused to obtain the temporal fusion features of the text vector. Finally, the spatial fusion features and the temporal fusion features are combined into the final target text features to improve the expression accuracy and richness of the text features.
[0085] Optionally, the multiple scales include two; the convolution kernel output includes a first convolution kernel output and a second convolution kernel output; the convolution kernel outputs of multiple scales are fused and calculated to obtain the spatial fusion feature corresponding to the text vector, including: splicing the first convolution kernel output and the second convolution kernel output to obtain a third convolution kernel output; calculating the first convolution kernel output, the second convolution kernel output and the third convolution kernel output through a preset attention channel weighted network to obtain the spatial fusion feature corresponding to the text vector; wherein the attention channel weighted network includes a local attention channel, a global attention channel, an activation layer and a fusion layer, the local attention channel and the global attention channel are used to perform attention calculation on the third convolution kernel output respectively, the local attention calculation result and the global attention calculation result are calculated through the activation layer to obtain an activation result, the first tensor product between the activation result and the first convolution kernel output is calculated through the fusion layer, the difference between the preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output is calculated, and the first tensor product and the second tensor product are fused to obtain the spatial fusion feature.
[0086] In this embodiment, taking the convolution attention calculation based on two-scale convolution kernels as an example, the first convolution kernel output and the second convolution kernel output are obtained through calculation. First, the first convolution kernel output and the second convolution kernel output are spliced to obtain the third convolution kernel output, and then the first, second, and third convolution kernel outputs are input into the attention channel weighted network, and the third convolution kernel output is respectively calculated through the local attention channel and the global attention channel. The local attention calculation result and the global attention calculation result are calculated through the activation layer to obtain the activation result, and the first tensor product between the activation result and the first convolution kernel output is calculated through the fusion layer, and the difference between the preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output, and the first tensor product and the second tensor product are fused to obtain the spatial fusion feature.
[0087] Step 104, obtain the preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform, and calculate the target similarity between each of the preset text features and the target text features respectively, and determine the matching question and answer texts in the existing question and answer texts based on the target similarity for output.
[0088] In the embodiment of the present application, after determining the target text features corresponding to the agricultural knowledge question text input by the user. First, extract the question part (question text) in each question and answer record from the existing agricultural knowledge question and answer library, as well as the preset text features of the existing question texts obtained by processing the agricultural knowledge question text in advance in the above-mentioned manner, and then compare the similarity between the target text features and all the extracted question text features one by one, and calculate the target similarity value between the agricultural knowledge question text and each existing question text. According to the target similarity calculated above, find the existing question and answer pairs that are most similar to the target question, that is, the one or more with the highest target similarity, and then return these matching question and answer texts to the user as results. Through automated text analysis and matching technology, help users quickly find the most relevant and matching answers to the questions they asked in the massive agricultural knowledge question and answer resources. Wherein, the existing question and answer text is output based on the descending sort order of the target similarity.
[0089] By applying the technical solution of this embodiment, the text of the question on the agricultural knowledge question and answer platform is processed by removing stop words and segmenting words, extracting key phrases and single word information, not only retaining effective vocabulary, but also using the word splitting technology to obtain a deeper semantic understanding, and constructing a comprehensive text vector expression through word vectors and phrase vectors, thereby improving the refinement of agricultural knowledge questions and answers. The text vector is convolutionally calculated by applying preset multiple scale convolution kernels to obtain feature representations of the text at different granularities. By fusing these different scale features, the spatial fusion features of the text are formed, and the model's ability to understand complex agricultural knowledge structures is enhanced. A bidirectional long short-term memory network is used to capture the front and back dependencies of the text vector, forming forward features and backward features, and obtaining temporal fusion features through fusion calculation, which helps the model understand and reason about the time series correlation in agricultural knowledge questions. The target text features constructed based on the spatial fusion features and the temporal fusion features are compared and calculated with the preset text features in the existing question and answer text to obtain the target similarity, thereby accurately finding the agricultural knowledge question and answer that best matches the user input question, and realizing efficient retrieval and intelligent recommendation functions. Therefore, the embodiment of the present application greatly improves the accuracy, intelligence level and user experience of the agricultural knowledge question and answer system through a series of deep text processing and feature extraction technologies, and can better meet the user's needs for agricultural professional knowledge query.
[0090] In the embodiment of the present application, since there may be a large number of similar question and answer texts on the agricultural knowledge question and answer platform, when matching the question and answer texts, these texts that are very similar in themselves are all subjected to similarity calculations. Not only is the amount of calculation huge, but for users, constantly seeing similar answers is not conducive to quickly and effectively acquiring the desired knowledge. The platform storing a large number of similar question and answer texts will also lead to bloated storage space. Optionally, before obtaining the preset text features corresponding to the existing question texts in each existing question and answer text in the agricultural knowledge question and answer platform, the method also includes: calculating the similarity between each existing question text based on the preset text features, and determining an existing question and answer text group that meets the preset similarity condition; generating a unified text feature corresponding to the existing question text group based on the preset text features corresponding to each existing question text in the existing question and answer text group; calling a large language model to fuse each existing answer text in the existing question and answer text group to obtain a unified answer text corresponding to the existing question and answer text group, and calling a large language model to fuse each existing question text in the existing question and answer text group to obtain a unified question text corresponding to the existing question text group, and generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text; replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text.
[0091] In this embodiment, the existing question and answer texts of a large amount of agricultural knowledge stored in the platform can also be pre-processed to merge similar contents. Specifically, first, the system uses the preset text features to calculate the similarity between all existing question texts, screens out the question and answer text sets that meet the preset similarity conditions, and forms an existing question and answer text group. These texts may be around the same topic or have a high semantic similarity. For each question in the question and answer text group, the system constructs a unified text feature representing the common characteristics of this group of questions according to their respective preset text features, so that the core issues of this group of questions can be extracted. The large language model is used to fuse the different answer texts in the existing question and answer text group, summarize the essence of each answer, and generate a unified answer text that can cover all the key answer points of the group of questions. Similarly, all the questions in this group are fused through the large language model, and the commonality is extracted to generate a unified question text that can accurately reflect the essence of this type of problem. Finally, based on the obtained unified question text and unified answer text, a new, highly summarized and content-rich unified question and answer text is created, which can answer a group of similar questions at the same time and provide a more comprehensive answer. The original question and answer texts that meet the similarity conditions are replaced with the newly generated unified question and answer text on the question and answer platform. This not only saves space, but also improves the efficiency and accuracy of information acquisition when users query.
[0092] Further, optionally, after calculating the similarity between the existing question texts based on the preset text features and determining the existing question and answer text group that meets the preset similarity condition, the method further includes: outputting the existing question and answer text group to a manual review terminal, and receiving a first review result of the existing question and answer text group by the manual review terminal; based on the first review result, determining the confirmed existing question and answer text in the existing question and answer text group, and updating the existing question and answer text group;
[0093] After generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text, the method further includes: outputting the unified question and answer text to the manual review terminal, and receiving a second review result of the unified question and answer text by the manual review terminal; if the second review result indicates that the unified question and answer text has passed the review, replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text; if the second review result indicates that the unified question and answer text has not passed the review, calling a large language model, and based on the failure reason in the second review result, each existing question text in the existing question and answer text group, and the unified question and answer text, regenerate the unified question and answer text and transmit it to the manual review terminal until the generated unified question and answer text passes the review.
[0094] In this embodiment, the system sends the existing question and answer text group that has been analyzed and fused to the manual review terminal. The reviewer will conduct a first round of review on this question and answer text group and give a first review result, which the system will receive. Based on the first review result of the manual review, the system identifies those question and answer texts that are confirmed to be valid in the existing question and answer text group, and updates the content of the question and answer text group accordingly, eliminating invalid or inaccurate parts. The generated unified question and answer text will also be submitted to the manual review terminal for a second round of review, and the second review result on the unified question and answer text will be received. If the unified question and answer text passes the manual review (that is, the second review result shows that its quality is qualified), the question and answer texts in the original question and answer text group will be replaced with the unified question and answer text that has been reviewed and passed. If the unified question and answer text fails to pass the manual review, the system will, based on the reasons for failure provided in the second review result, combine the original question texts in the existing question and answer text group and the previously generated unified question and answer text, and re-call the large language model to generate a new unified question and answer text. This process will continue until the generated unified question and answer text is finally reviewed manually to ensure that the output question and answer content meets high quality standards.
[0095] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides an agricultural knowledge question-answering device, such as Figure 2 As shown, the device comprises:
[0096] A question word segmentation module is used to receive agricultural knowledge question text on the agricultural knowledge question-answering platform, remove stop words from the agricultural knowledge question text, and then perform word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text;
[0097] A feature extraction module is used to perform character decomposition processing on the single word to obtain the decomposition character shape, determine the character vector of the single word based on the decomposition character shape and the four-corner number of the single word, and construct the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the character vector;
[0098] A feature enhancement module is used to perform convolution attention calculation on the text vector based on convolution kernels of preset multiple scales, obtain convolution kernel outputs of multiple scales corresponding to the text vector, perform fusion calculation on the convolution kernel outputs of multiple scales, and obtain spatial fusion features corresponding to the text vector; calculate the text vector through a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, perform fusion calculation on the forward features and the backward features, and obtain temporal fusion features corresponding to the text vector;
[0099] A feature fusion module, used to determine the target text feature corresponding to the text vector according to the spatial fusion feature and the temporal fusion feature;
[0100] The answer matching module is used to obtain the preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform, and respectively calculate the target similarity between each of the preset text features and the target text features, and determine the matching question and answer texts in the existing question and answer texts based on the target similarity for output.
[0101] Optionally, the feature extraction module is used to:
[0102] Deduplication of the decomposed character shapes is performed based on the single word, the deduplication of the decomposed character shapes is vectorized, and the four-corner codes of the repeated character shapes between the single word and the decomposed character shapes are vectorized;
[0103] The vectorization conversion result of the deduplicated split character shape and the vectorization conversion result of the repeated character shape are combined to determine the character vector of the single word.
[0104] Optionally, the feature extraction module is used to:
[0105] Taking the intersection of the phrase and the single word to determine the repeated word, performing vectorization conversion on the remaining words in the phrase except the repeated word, and performing vectorization conversion on the four-corner number of the repeated word;
[0106] Based on the vectorized conversion results of the remaining characters and the vectorized conversion results of the repeated characters, a phrase vector corresponding to the phrase is determined.
[0107] Optionally, the multiple scales include two; the convolution kernel output includes a first convolution kernel output and a second convolution kernel output;
[0108] The feature enhancement module is used to:
[0109] Concatenate the first convolution kernel output and the second convolution kernel output to obtain a third convolution kernel output;
[0110] The first convolution kernel output, the second convolution kernel output and the third convolution kernel output are calculated through a preset attention channel weighted network to obtain a spatial fusion feature corresponding to the text vector;
[0111] Among them, the attention channel weighted network includes a local attention channel, a global attention channel, an activation layer and a fusion layer. The local attention channel and the global attention channel are used to perform attention calculation on the third convolution kernel output respectively. The activation layer calculates the local attention calculation results and the global attention calculation results to obtain an activation result. The fusion layer calculates the first tensor product between the activation result and the first convolution kernel output, calculates the difference between a preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output, and fuses the first tensor product and the second tensor product to obtain the spatial fusion feature.
[0112] Optionally, the answer matching module is used to:
[0113] Based on the descending sort order of the target similarity, the existing question and answer text is output.
[0114] Optionally, the device further comprises: a text unification module, configured to:
[0115] Calculate the similarity between the existing question texts based on the preset text features, and determine the existing question and answer text group that meets the preset similarity condition; generate a unified text feature corresponding to the existing question text group based on the preset text features corresponding to each existing question text in the existing question and answer text group;
[0116] Calling a large language model to fuse each existing answer text in the existing question and answer text group to obtain a unified answer text corresponding to the existing question and answer text group, and calling a large language model to fuse each existing question text in the existing question and answer text group to obtain a unified question text corresponding to the existing question text group, and generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text;
[0117] Each existing question and answer text in the existing question and answer text group is replaced with the unified question and answer text.
[0118] Optionally, the text unification module is further used to:
[0119] Outputting the existing question and answer text group to a manual review terminal, and receiving a first review result of the existing question and answer text group by the manual review terminal; based on the first review result, determining the confirmed existing question and answer text in the existing question and answer text group, and updating the existing question and answer text group;
[0120] The text unification module is also used for:
[0121] Outputting the unified question and answer text to the manual review terminal, and receiving a second review result of the unified question and answer text by the manual review terminal;
[0122] If the second review result indicates that the unified question and answer text has passed the review, then replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text is performed;
[0123] If the second review result indicates that the unified question and answer text has not passed the review, the large language model is called to regenerate the unified question and answer text based on the failure reason in the second review result, the existing question texts in the existing question and answer text group, and the unified question and answer text, and transmit it to the manual review terminal until the generated unified question and answer text passes the review.
[0124] It should be noted that for other corresponding descriptions of the functional units involved in the agricultural knowledge question-answering device provided in the embodiment of the present application, reference can be made to Figure 1 to Figure 2 The corresponding description in the method will not be repeated here.
[0125] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0126] Those skilled in the art will appreciate that the structure of the above-mentioned computer device is only a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have a different arrangement of components.
[0127] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0128] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0129] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0130] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0131] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0132] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An agricultural knowledge question-answering method, characterized in that: The method comprises: Receiving an agricultural knowledge question text on an agricultural knowledge question-answering platform, removing stop words from the agricultural knowledge question text, and then performing word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text; Decomposing the single word to obtain a decomposed character shape, determining a character vector of the single word based on the decomposed character shape and the four-corner number of the single word, and constructing a text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the character vector; Based on the preset convolution kernels of multiple scales, convolution attention calculation is performed on the text vector to obtain convolution kernel outputs of multiple scales corresponding to the text vector, and fusion calculation is performed on the convolution kernel outputs of multiple scales to obtain the spatial fusion feature corresponding to the text vector; The text vector is calculated by a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, and the forward features and the backward features are fused to obtain a time series fusion feature corresponding to the text vector; Determine the target text feature corresponding to the text vector according to the spatial fusion feature and the temporal fusion feature; The preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform are obtained, and the target similarities between each of the preset text features and the target text features are respectively calculated, and the matching question and answer texts in the existing question and answer texts are determined based on the target similarities for output.
2. The method according to claim 1, characterized in that The step of determining the word vector of the single word based on the split character shape and the four-corner number of the single word comprises: Deduplication of the decomposed character shapes is performed based on the single word, the deduplication of the decomposed character shapes is vectorized, and the four-corner codes of the repeated character shapes between the single word and the decomposed character shapes are vectorized; The vectorization conversion result of the deduplicated split character shape and the vectorization conversion result of the repeated character shape are combined to determine the character vector of the single word.
3. The method according to claim 1, characterized in that Before constructing the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the word vector, the method further includes: Taking the intersection of the phrase and the single word to determine the repeated word, performing vectorization conversion on the remaining words in the phrase except the repeated word, and performing vectorization conversion on the four-corner number of the repeated word; Based on the vectorized conversion results of the remaining characters and the vectorized conversion results of the repeated characters, a phrase vector corresponding to the phrase is determined.
4. The method according to claim 1, characterized in that The multiple scales include two; the convolution kernel output includes a first convolution kernel output and a second convolution kernel output; The fusion calculation of the convolution kernel outputs of multiple scales to obtain the spatial fusion features corresponding to the text vector includes: Concatenate the first convolution kernel output and the second convolution kernel output to obtain a third convolution kernel output; The first convolution kernel output, the second convolution kernel output and the third convolution kernel output are calculated through a preset attention channel weighted network to obtain a spatial fusion feature corresponding to the text vector; Among them, the attention channel weighted network includes a local attention channel, a global attention channel, an activation layer and a fusion layer. The local attention channel and the global attention channel are used to perform attention calculation on the third convolution kernel output respectively. The activation layer calculates the local attention calculation results and the global attention calculation results to obtain an activation result. The fusion layer calculates the first tensor product between the activation result and the first convolution kernel output, calculates the difference between a preset standard value and the activation result, the second tensor product between the difference and the second convolution kernel output, and fuses the first tensor product and the second tensor product to obtain the spatial fusion feature.
5. The method according to any one of claims 1 to 4, characterized in that The step of determining, based on the target similarity, a matching question and answer text in the existing question and answer text for output includes: Based on the descending sort order of the target similarity, the existing question and answer text is output.
6. The method according to any one of claims 1 to 4, characterized in that Before obtaining the preset text features corresponding to the existing question texts in each existing question and answer text in the agricultural knowledge question and answer platform, the method further includes: Calculate the similarity between the existing question texts based on the preset text features, and determine an existing question and answer text group that meets the preset similarity condition; generate a unified text feature corresponding to the existing question text group based on the preset text features corresponding to each existing question text in the existing question and answer text group; Calling a large language model to fuse each existing answer text in the existing question and answer text group to obtain a unified answer text corresponding to the existing question and answer text group, and calling a large language model to fuse each existing question text in the existing question and answer text group to obtain a unified question text corresponding to the existing question text group, and generating a unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text; Each existing question and answer text in the existing question and answer text group is replaced with the unified question and answer text.
7. The method according to claim 6, characterized in that After calculating the similarity between the existing question texts based on the preset text features and determining the existing question and answer text group that meets the preset similarity condition, the method further includes: Outputting the existing question-and-answer text group to a manual review terminal, and receiving a first review result of the existing question-and-answer text group by the manual review terminal; Based on the first review result, determining the confirmed existing question and answer texts in the existing question and answer text group, and updating the existing question and answer text group; After generating the unified question and answer text corresponding to the existing question and answer text group based on the unified question text and the unified answer text, the method further includes: Outputting the unified question and answer text to the manual review terminal, and receiving a second review result of the unified question and answer text by the manual review terminal; If the second review result indicates that the unified question and answer text has passed the review, then replacing each existing question and answer text in the existing question and answer text group with the unified question and answer text is performed; If the second review result indicates that the unified question and answer text has not passed the review, the large language model is called to regenerate the unified question and answer text based on the failure reason in the second review result, the existing question texts in the existing question and answer text group, and the unified question and answer text, and transmit it to the manual review terminal until the generated unified question and answer text passes the review.
8. An agricultural knowledge question-answering device, characterized in that: The device comprises: A question word segmentation module is used to receive agricultural knowledge question text on the agricultural knowledge question-answering platform, remove stop words from the agricultural knowledge question text, and then perform word segmentation on the agricultural knowledge question text based on a preset agricultural knowledge word segmentation library to obtain phrases and single words in the agricultural knowledge question text; A feature extraction module is used to perform character decomposition processing on the single word to obtain the decomposition character shape, determine the character vector of the single word based on the decomposition character shape and the four-corner number of the single word, and construct the text vector of the agricultural knowledge question text according to the phrase vector corresponding to the phrase and the character vector; A feature enhancement module is used to perform convolution attention calculation on the text vector based on convolution kernels of preset multiple scales, obtain convolution kernel outputs of multiple scales corresponding to the text vector, perform fusion calculation on the convolution kernel outputs of multiple scales, and obtain spatial fusion features corresponding to the text vector; calculate the text vector through a bidirectional long short-term memory network to obtain forward features and backward features of the text vector, perform fusion calculation on the forward features and the backward features, and obtain temporal fusion features corresponding to the text vector; A feature fusion module, used to determine the target text feature corresponding to the text vector according to the spatial fusion feature and the temporal fusion feature; The answer matching module is used to obtain the preset text features corresponding to the existing question texts in the existing question and answer texts in the agricultural knowledge question and answer platform, and respectively calculate the target similarity between each of the preset text features and the target text features, and determine the matching question and answer texts in the existing question and answer texts based on the target similarity for output.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Text classification method and device, computer device and storage medium
CN109857860A
Wheat cold resistance identification method based on hybrid neural network fused with Attention mechanism
CN111651980A
Text sentiment analysis method based on multi-channel neural network
CN111881262A
FAQ library matching method and system based on twin network
CN112800196A
Pre-training model acquisition and application method and device, equipment, medium and product
CN114444691A