Text knowledge mining and dialogue generation method and device and medium

Text knowledge is converted into sentence vectors through semantic analysis and deep learning technology, and the chatglm model is fine-tuned for the industry, which solves the problem of low accuracy of general text processing models in specific industries and achieves more efficient text processing and answer generation.

CN118643122APending Publication Date: 2024-09-13INSPUR YUNZHOU (SHANDONG) IND INTERNET CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410838942.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

In specific industries, due to the particularity of industry terminology and professional knowledge, it is often difficult to achieve the desired effect by directly using a general text processing model, resulting in low output accuracy of the text processing model.

Method used

Divide text knowledge into short sentences through semantic analysis, use deep learning word vector generation technology to convert the short sentences into sentence vectors, and store the sentence vectors in the vector database; use industry text data to fine-tune the preset chatglm model to make the model Generate answer text to better adapt to industry terminology and context.

Benefits of technology

It improves the accuracy and efficiency of text processing, can more accurately capture text knowledge and user intentions in the industry, and generate more accurate and useful answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643122A
    Figure CN118643122A
Patent Text Reader

Abstract

The embodiment of the invention discloses a text knowledge mining and dialogue generation method and device and a medium. Belongs to the technical field of text mining and solves the problem of low output accuracy of a text processing model. Comprising the following steps: performing semantic analysis on obtained text knowledge, and dividing the text knowledge into a plurality of short sentences based on semantic association degree; based on a deep learning word vector generation technology, converting the plurality of short sentences into low-dimensional word vector data, and performing weighted average processing on the plurality of low-dimensional word vector data to obtain sentence vectors corresponding to the text knowledge; based on the mapping relation between the sentence vectors, storing the sentence vectors into a vector database; obtaining industry text data corresponding to the text knowledge, and performing fine tuning on a preset chatglm model based on the industry text data; and performing vectorization processing on the obtained question text, and generating an answer text based on the vectorized question, the vector database and the preset chatglm model after fine tuning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text mining technology, and in particular to a text knowledge mining and dialogue generation method, device and medium. Background Art

[0002] With the explosive growth of Internet information, the management and application of text knowledge are becoming increasingly important in today's society. Text is not only a carrier of information, but also a source of knowledge. Especially in specific industries, the professional knowledge and experience contained in text are invaluable. However, faced with massive amounts of text data, how to efficiently and accurately extract and apply the knowledge in it has become a problem that needs to be solved.

[0003] Traditional text search and recommendation methods are mostly based on keyword matching, which may be sufficient in the early stages of text processing, but is inadequate when faced with complex text knowledge and deep meanings. Keyword matching can often only capture the surface information of the text, but cannot deeply understand the semantic associations and logical relationships between texts. Especially in specific industries, due to the particularity of industry terminology and professional knowledge, it is often difficult to achieve the desired effect by directly using general text processing models, resulting in low output accuracy of text processing models. Summary of the invention

[0004] The embodiments of the present application provide a text knowledge mining and dialogue generation method, device and medium for solving the following technical problems: In a specific industry, due to the particularity of industry terminology and professional knowledge, it is often difficult to achieve the desired effect by directly using a general text processing model, resulting in low output accuracy of the text processing model.

[0005] The present application embodiment adopts the following technical solutions:

[0006] The embodiment of the present application provides a text knowledge mining and dialogue generation method. It includes: semantically analyzing the acquired text knowledge, and dividing the text knowledge into multiple short sentences based on semantic relevance; based on deep learning word vector generation technology, converting multiple short sentences into low-dimensional word vector data respectively, and performing weighted average processing on multiple low-dimensional word vector data to obtain sentence vectors corresponding to the text knowledge; based on the mapping relationship between sentence vectors, storing the sentence vectors in a vector database; acquiring the industry text data corresponding to the text knowledge, and fine-tuning the preset chatglm model based on the industry text data; vectorizing the acquired question text, and generating the answer text based on the vectorized question, the vector database and the fine-tuned preset chatglm model.

[0007] The embodiment of the present application divides the text into multiple short sentences by semantic relevance, which can more accurately capture the key information in the text and improve the efficiency and accuracy of subsequent processing. By performing weighted average processing on multiple word vectors, the sentence vector of the entire short sentence or text knowledge is obtained, which provides an effective feature representation for subsequent applications such as text comparison, search and recommendation. The preset chatGLM model is fine-tuned using industry text data to make the model better adapt to the professional terms and context in the industry. The fine-tuned model can more accurately understand the text knowledge in the industry, improve the application performance in specific industry fields, and can more accurately capture the intentions and needs in the questions, generating more accurate and useful answers.

[0008] In one implementation of the present application, the acquired text knowledge is subjected to semantic analysis, and the text knowledge is divided into multiple short sentences based on semantic relevance, specifically including: deleting irrelevant characters and performing word segmentation processing on the text knowledge; wherein the irrelevant characters include at least one of punctuation marks and stop words; performing semantic analysis on the processed text knowledge, and obtaining the relevance between different word segmentations, and dividing the text knowledge into multiple reference sentences based on the relevance; verifying the multiple reference sentences based on a preset dictionary, and using the qualified reference sentences as the multiple short sentences corresponding to the text knowledge.

[0009] In one implementation of the present application, based on deep learning word vector generation technology, multiple short sentences are respectively converted into low-dimensional word vector data, and the multiple low-dimensional word vector data are weighted averaged to obtain sentence vectors corresponding to the text knowledge, specifically including: inputting multiple short sentences into a preset word embedding model, and outputting corresponding word vectors through the preset word embedding model; based on the frequency of occurrence of each word in the text knowledge, a first weight is assigned to the word vector corresponding to each word in the short sentence; and, the position of each word in the short sentence is obtained, and a second weight is assigned based on different positions; weighted average processing is performed based on the first weight and the second weight, and the result of the weighted average is used as the sentence vector corresponding to the short sentence.

[0010] In one implementation of the present application, based on the mapping relationship between sentence vectors, the sentence vectors are stored in a vector database, specifically including: obtaining the question sentence vector and the answer sentence vector in the sentence vector; determining a plurality of answer sentence vectors corresponding to each question sentence vector, and sorting the plurality of answer sentence vectors based on the correlation between the plurality of answer sentence vectors and the question sentence vector; mapping the plurality of answer sentence vectors to the question sentence vector in turn based on the arrangement order, and storing the sentence vectors in the vector database based on the mapping relationship.

[0011] In one implementation of the present application, industry text data corresponding to the text knowledge is obtained, and a preset chatglm model is fine-tuned based on the industry text data, specifically including: text encoding the obtained industry text data to obtain encoded data suitable for the format of the preset chatglm model; dividing the encoded data into multiple sample sets; fine-tuning the preset chatglm model through the training set in the sample set, and determining the difference between the actual output value and the preset output value based on the actual output value obtained; fine-tuning the weight of the preset chatglm model based on the difference; when the difference meets the preset difference condition, the fine-tuned preset chatglm model is tested based on the validation set and the test set in the sample set, and the parameters corresponding to the preset chatglm model are fine-tuned based on the evaluation results until the preset chatglm model meets the preset usage conditions.

[0012] In one implementation of the present application, an answer text is obtained based on a vectorized question, a vector database, and a fine-tuned preset chatglm model, specifically including: inputting the vectorized question vector into a fine-tuned preset chatglm model to obtain a first reference answer text; performing similarity calculation in the vector database based on the vectorized question vector to determine a plurality of reference question texts that meet similarity conditions; determining in the vector database a second reference answer text corresponding to each reference question text based on a plurality of reference question texts; sorting a plurality of second reference answer texts based on the frequency of occurrence of the second reference answer texts; and comparing the first reference answer text with the sorted second reference answer text to determine the answer text based on the comparison result.

[0013] In one implementation of the present application, after determining the answer text based on the comparison results, the method also includes: obtaining current user information and historical conversation information corresponding to the current user to determine user feature data and construct a user portrait; based on the user portrait, determining the text template with the highest similarity in the text pattern database; based on the text template, updating the answer text.

[0014] In one implementation of the present application, after fine-tuning the preset chatglm model based on industry text data, the method also includes: obtaining user feedback information and associating the feedback information with the corresponding dialogue generation task; determining the sentence vector corresponding to the dialogue generation task, and assigning a first coefficient to the sentence vector based on the number of times the sentence vector is associated; and analyzing the feedback information to determine the feedback information score corresponding to the feedback information, and assigning a second coefficient to the sentence vector based on the feedback information score; determining the order to be adjusted corresponding to the sentence vector based on the first coefficient and the second coefficient, so as to adjust the sentence vector based on the order to be adjusted.

[0015] An embodiment of the present application provides a text knowledge mining and dialogue generation device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: perform semantic analysis on the acquired text knowledge, and divide the text knowledge into multiple short sentences based on semantic relevance; based on deep learning word vector generation technology, convert the multiple short sentences into low-dimensional word vector data respectively, perform weighted average processing on the multiple low-dimensional word vector data, and obtain sentence vectors corresponding to the text knowledge; based on the mapping relationship between the sentence vectors, store the sentence vectors in a vector database; acquire the industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data; vectorize the acquired question text, and generate an answer text based on the vectorized question, the vector database, and the fine-tuned preset chatglm model.

[0016] A non-volatile computer storage medium provided in an embodiment of the present application stores computer executable instructions, wherein the computer executable instructions are configured to: perform semantic analysis on acquired text knowledge, and divide the text knowledge into multiple short sentences based on semantic relevance; based on deep learning word vector generation technology, convert the multiple short sentences into low-dimensional word vector data respectively, perform weighted average processing on the multiple low-dimensional word vector data, and obtain sentence vectors corresponding to the text knowledge; based on the mapping relationship between sentence vectors, store the sentence vectors in a vector database; acquire industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data; vectorize the acquired question text, and generate an answer text based on the vectorized question, the vector database, and the fine-tuned preset chatglm model.

[0017] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: The embodiments of the present application divide the text into multiple short sentences by semantic relevance, which can more accurately capture the key information in the text and improve the efficiency and accuracy of subsequent processing. By performing weighted average processing on multiple word vectors, the sentence vector of the entire short sentence or text knowledge is obtained, which provides an effective feature representation for subsequent applications such as text comparison, search and recommendation. The preset chatGLM model is fine-tuned using industry text data to make the model better adapt to the professional terms and context in the industry. The fine-tuned model can more accurately understand the text knowledge in the industry, improve the application performance in specific industry fields, and can more accurately capture the intentions and needs in the questions, generating more accurate and useful answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:

[0019] Figure 1 A flow chart of a text knowledge mining and dialogue generation method provided in an embodiment of the present application;

[0020] Figure 2 A structural diagram of a text knowledge mining and dialogue generation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The embodiments of the present application provide a text knowledge mining and dialogue generation method, device and medium.

[0022] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0023] The technical solution proposed in the embodiment of the present invention is described in detail below with reference to the accompanying drawings.

[0024] Figure 1 A flow chart of a text knowledge mining and dialogue generation method provided in an embodiment of the present application, such as Figure 1 As shown, the text knowledge mining and dialogue generation method includes the following steps:

[0025] S101, performing semantic analysis on the acquired text knowledge, and dividing the text knowledge into multiple short sentences based on semantic relevance.

[0026] In one embodiment of the present application, irrelevant characters are deleted and word segmentation is performed on the text knowledge; wherein the irrelevant characters include at least one of punctuation marks and stop words. The processed text knowledge is semantically analyzed, and the correlation between different word segmentations is obtained, and the text knowledge is divided into multiple reference sentences based on the correlation. Multiple reference sentences are verified based on a preset dictionary, and the reference sentences that meet the conditions are used as multiple short sentences corresponding to the text knowledge.

[0027] Specifically, use regular expressions or string processing methods to identify and remove all punctuation marks in the text, establish a stop word list that contains common but meaningless words such as "de", "shi", "zai", etc. Traverse each word in the text, and if the word is in the stop word list, delete it. Use a pre-set dictionary to match the text with the words in the dictionary, thereby segmenting the text into word units. Use semantic role labeling to analyze the words and sentence structures in the text, determine their meanings and relationships, and based on the results of semantic analysis, calculate the association degrees between different word segments. The association degrees can be calculated based on indicators such as the co-occurrence frequency of words, semantic similarity, etc.

[0028] Furthermore, set an association degree threshold according to actual needs, traverse the segmented text, and combine the word segments with an association degree higher than the threshold into a reference sentence. Repeat this process until all word segments are assigned to the corresponding reference sentences. Compare each reference sentence with the pre-set dictionary to check whether the sentence contains words or phrases in the dictionary. If it does, it is considered that the reference sentence meets the conditions; otherwise, it is regarded as an invalid sentence and discarded.

[0029] S102. Based on the deep learning word vector generation technology, convert multiple short sentences into low-dimensional word vector data respectively, and perform weighted average processing on the multiple low-dimensional word vector data to obtain the sentence vector corresponding to the text knowledge.

[0030] In an embodiment of the present application, input multiple short sentences into a pre-set word embedding model respectively, and output corresponding word vectors through the pre-set word embedding model. Based on the frequency of each word appearing in the text knowledge, perform the first weight assignment on the word vectors corresponding to each word in the short sentence respectively. And obtain the position of each word in the short sentence, and perform the second weight assignment based on different positions. Perform weighted average processing based on the first weight and the second weight, and use the result after weighted average as the sentence vector corresponding to the short sentence.

[0031] Specifically, the pre-set word embedding model in the embodiment of the present application can convert words or phrases in the text into dense vectors of a fixed length, and these vectors can capture the semantic information of the words or phrases. Input each word in the multiple short sentences into the pre-set word embedding model respectively, and the model will output a corresponding word vector for each word.

[0032] Further, for each word in the short sentence, a weight is assigned to it according to the frequency of its occurrence in the entire text knowledge. The higher the frequency, the lower the weight may be, because common words may contain less semantic information, and vice versa. Secondly, in addition to the weight based on frequency, the embodiment of the present application also considers the position of the word in the short sentence. For example, the first word and the last word in the sentence may be more important, because they may be the subject or predicate, and the middle word may be less important. Based on this assumption, a weight can be assigned to each position in the short sentence.

[0033] Furthermore, the word vector of each word is multiplied by its weight based on frequency and position, and then these weighted word vectors are added together to obtain the preliminary sentence vector of the short sentence. Finally, this preliminary sentence vector is divided by the sum of all weights to obtain the standardized sentence vector.

[0034] S103. Based on the mapping relationship between the sentence vectors, the sentence vectors are stored in a vector database.

[0035] In one embodiment of the present application, a question sentence vector and an answer sentence vector are obtained from a sentence vector. Multiple answer sentence vectors corresponding to each question sentence vector are determined, and multiple answer sentence vectors are sorted based on the correlation between the multiple answer sentence vectors and the question sentence vectors. Based on the arrangement order, the multiple answer sentence vectors are sequentially mapped to the question sentence vector, and the sentence vectors are stored in a vector database based on the mapping relationship.

[0036] Specifically, the sentence vectors are classified to determine the question sentence vectors and the answer sentence vectors in the sentence vectors. The correlation between the question sentence vector and each answer sentence vector is calculated based on cosine similarity. The higher the correlation, the closer the semantics between the question and the answer. According to the correlation between the question sentence vector and the answer sentence vector, the answer sentence vectors are sorted in descending order to put the most relevant answers in front. According to the sorting result, each answer sentence vector is mapped to the question sentence vector, and these sentence vectors and mapping relationships are stored in a vector database for subsequent retrieval and query.

[0037] S104: Obtain industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data.

[0038] In one embodiment of the present application, the acquired industry text data is text encoded to obtain encoded data suitable for the preset chatglm model format. The encoded data is divided into multiple sample sets. The preset chatglm model is fine-tuned and trained through the training set in the sample set, and the difference between the actual output value and the preset output value is determined based on the actual output value acquired. The weight of the preset chatglm model is fine-tuned based on the difference. When the difference meets the preset difference condition, the fine-tuned preset chatglm model is tested based on the validation set and the test set in the sample set, and the parameters corresponding to the preset chatglm model are fine-tuned based on the evaluation results until the preset chatglm model meets the preset usage conditions.

[0039] Specifically, the industry text data is first converted into a format suitable for chatglm model input to convert the text data into a numerical vector that the model can understand, that is, to convert the text data into token IDs. The encoded data is divided into training set, validation set and test set. The training set is used to train the model, the validation set is used to evaluate the performance of the model during the training process, and the test set is used to evaluate the final performance of the model after the training is completed.

[0040] Furthermore, the preset chatglm model is fine-tuned using the training set. Fine-tuning is an iterative process in which the model tries to minimize the difference between the predicted output and the actual output by adjusting its weights. During the fine-tuning process, the performance of the model on the validation set needs to be monitored. If the difference between the predicted output and the actual output of the model is too large, that is, the performance of the model is poor, then the model needs to be fine-tuned. Otherwise, fine-tuning can be stopped and the test set can be used to evaluate the final performance of the model. Finally, if the performance of the model on the test set meets the preset usage conditions, for example, a certain accuracy or F1 score threshold is reached, the model can be used in actual tasks.

[0041] S105, vectorizing the obtained question text, and generating an answer text based on the vectorized question, the vector database, and the fine-tuned preset chatglm model.

[0042] In one embodiment of the present application, the vectorized question vector is input into a fine-tuned preset chatglm model to obtain a first reference answer text. Based on the vectorized question vector, similarity calculation is performed in a vector database to determine a plurality of reference question texts that meet similarity conditions. Based on the plurality of reference question texts, the second reference answer texts corresponding to each reference question text are determined in the vector database. Based on the frequency of occurrence of the second reference answer texts, the plurality of second reference answer texts are sorted. The first reference answer text is compared with the sorted second reference answer text to determine the answer text based on the comparison result.

[0043] Specifically, the vectorized question vector is input into the fine-tuned chatglm model. The chatglm model will generate the first reference answer text for the question based on the knowledge learned during training and the information learned for the specific task during fine-tuning. Using cosine similarity, the vectorized question vector is similarity calculated in the vector database to find a series of historical questions that are most similar to the current question, i.e., the reference question text. For each reference question text, its corresponding answer text, i.e., the second reference answer text, is retrieved from the vector database. For the retrieved multiple second reference answer texts, they can be sorted according to their frequency of appearance in the database. Answers with higher frequencies are more valuable for reference.

[0044] Furthermore, the first reference answer text generated by the chatglm model is compared with the sorted second reference answer text. The final answer can be determined by calculating the similarity between the texts, keyword matching, semantic analysis, and other methods. Specifically, the first reference answer text generated by the chatglm model is compared with the sorted second reference answer text. If multiple second reference answer texts are similar to the first reference answer text, or they complement each other in content, these answers can be combined to form the final answer text.

[0045] In one embodiment of the present application, the current user information and the historical conversation information corresponding to the current user are obtained to determine the user feature data and construct a user portrait. Based on the user portrait, the text template with the highest similarity is determined in the text pattern database. Based on the text template, the answer text is updated.

[0046] Specifically, first obtain the basic information of the current user, such as user name, user ID, geographic location, age, gender, occupation, etc. This information can be obtained from the data provided by the user when registering and the user profile page. Secondly, obtain and analyze the historical conversation records between the current user and the system. These records may include the topic of the conversation, the user's questioning method, preferred answer style, etc. By analyzing these historical conversation information, we can have a deeper understanding of the user's interests and needs. Based on the obtained user information and historical conversation information, extract user feature data, such as the user's interests, knowledge level, language habits, emotional state, etc. Then, use these feature data to build a user portrait to form a multi-dimensional user description.

[0047] Furthermore, the text pattern database in the embodiment of the present application includes a series of predefined text templates, which are designed according to different dialogue scenarios and user needs. After constructing the user portrait, the text pattern database is searched for the text template with the highest similarity to the user portrait. After determining the text template with the highest similarity, the template is used to update the answer text. This process includes replacing the placeholders in the template with specific user information or dialogue content to ensure that the answer text not only meets the user's needs, but also has a certain degree of personalization.

[0048] In one embodiment of the present application, user feedback information is obtained and the feedback information is associated with the corresponding dialogue generation task. A sentence vector corresponding to the dialogue generation task is determined, and a first coefficient is assigned to the sentence vector based on the number of times the sentence vector is associated. Also, the feedback information is analyzed to determine a feedback information score corresponding to the feedback information, and a second coefficient is assigned to the sentence vector based on the feedback information score. Based on the first coefficient and the second coefficient, an order to be adjusted corresponding to the sentence vector is determined, so as to adjust the sentence vector based on the order to be adjusted.

[0049] Specifically, user feedback information usually includes the user's evaluation, satisfaction, suggestions, etc. of the dialogue content generated by the system. This information can be obtained through an explicit scoring mechanism, a questionnaire survey, or implicit user behavior, such as click-through rate, dwell time, etc. By recording the dialogue history between the user and the system, each piece of user feedback information is associated with its corresponding dialogue generation task. The number of times each sentence vector is associated with user feedback information is counted. The more times it is associated, the more important or commonly used the sentence vector is in the dialogue generation task. According to the number of associations, the system can assign a first coefficient to each sentence vector, which reflects the importance or commonness of the sentence vector. Perform a scoring analysis on each piece of user feedback information to evaluate its quality or value, determine a score for each feedback information, and assign a second coefficient to each sentence vector based on the score. This second coefficient reflects the user's satisfaction or evaluation of the dialogue content represented by the sentence vector.

[0050] Further, a comprehensive score or priority is determined for each sentence vector by comprehensively considering the first coefficient and the second coefficient. Then, based on the comprehensive score or priority, the order of sentence vectors to be adjusted is determined. The sentence vectors are adjusted according to the order to be adjusted. For example, the representation of the sentence vector is updated, the dialogue generation strategy is modified, the model parameters are optimized, etc., to improve the quality of dialogue generation and user experience.

[0051] Figure 2 A schematic diagram of the structure of a text knowledge mining and dialogue generation device provided in an embodiment of the present application. Figure 2 As shown, the text knowledge mining and dialogue generation device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: perform semantic analysis on the acquired text knowledge, and divide the text knowledge into multiple short sentences based on semantic relevance; based on deep learning word vector generation technology, convert the multiple short sentences into low-dimensional word vector data respectively, perform weighted average processing on the multiple low-dimensional word vector data, and obtain sentence vectors corresponding to the text knowledge; based on the mapping relationship between the sentence vectors, store the sentence vectors in a vector database; acquire the industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data; vectorize the acquired question text, and generate the answer text based on the vectorized question, the vector database and the fine-tuned preset chatglm model.

[0052] A non-volatile computer storage medium provided in an embodiment of the present application stores computer executable instructions, wherein the computer executable instructions are configured to: perform semantic analysis on acquired text knowledge, and divide the text knowledge into multiple short sentences based on semantic relevance; based on deep learning word vector generation technology, convert the multiple short sentences into low-dimensional word vector data respectively, perform weighted average processing on the multiple low-dimensional word vector data, and obtain sentence vectors corresponding to the text knowledge; based on the mapping relationship between sentence vectors, store the sentence vectors in a vector database; acquire industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data; vectorize the acquired question text, and generate an answer text based on the vectorized question, the vector database, and the fine-tuned preset chatglm model.

[0053] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0054] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various changes and variations. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims

1. A text knowledge mining and dialogue generation method, It is characterized in that The method comprises: Performing semantic analysis on the acquired text knowledge, and dividing the text knowledge into multiple short sentences based on semantic relevance; Based on the deep learning word vector generation technology, the multiple short sentences are respectively converted into low-dimensional word vector data, and the multiple low-dimensional word vector data are weighted averaged to obtain the sentence vector corresponding to the text knowledge; Based on the mapping relationship between the sentence vectors, storing the sentence vectors in a vector database; Acquire industry text data corresponding to the text knowledge, and fine-tune the preset chatglm model based on the industry text data; The acquired question text is vectorized, and an answer text is generated based on the vectorized question, the vector database, and the fine-tuned preset chatglm model.

2. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that The acquired text knowledge is subjected to semantic analysis, and the text knowledge is divided into a plurality of short sentences based on semantic relevance, specifically including: Deleting irrelevant characters and performing word segmentation processing on the text knowledge; wherein the irrelevant characters include at least one of punctuation marks and stop words; Performing semantic analysis on the processed text knowledge, obtaining the correlation between different word segments, and dividing the text knowledge into a plurality of reference sentences based on the correlation; The plurality of reference sentences are verified based on a preset dictionary, and the reference sentences that meet the conditions are used as a plurality of short sentences corresponding to the text knowledge.

3. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that The deep learning-based word vector generation technology converts the multiple short sentences into low-dimensional word vector data respectively, performs weighted average processing on the multiple low-dimensional word vector data, and obtains the sentence vector corresponding to the text knowledge, specifically including: Input the plurality of short sentences into a preset word embedding model respectively, and output corresponding word vectors through the preset word embedding model; Based on the frequency of occurrence of each word in the text knowledge, first weight allocation is performed on the word vector corresponding to each word in the short sentence; And, obtaining the position of each word in the short sentence, and performing a second weight allocation based on different positions; A weighted average process is performed based on the first weight and the second weight, so as to use a result of the weighted average as a sentence vector corresponding to the short sentence.

4. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that Based on the mapping relationship between the sentence vectors, storing the sentence vectors in a vector database specifically includes: Obtaining a question sentence vector and an answer sentence vector from the sentence vector; Determine a plurality of answer sentence vectors corresponding to each of the question sentence vectors, and sort the plurality of answer sentence vectors based on the correlation between the plurality of answer sentence vectors and the question sentence vector; Based on the arrangement order, the plurality of answer sentence vectors are mapped to the question sentence vector in sequence, and the sentence vectors are stored in a vector database based on the mapping relationship.

5. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that The acquiring of the industry text data corresponding to the text knowledge and fine-tuning the preset chatglm model based on the industry text data specifically includes: The acquired industry text data is text-encoded to obtain encoded data suitable for the preset chatglm model format; Dividing the encoded data into a plurality of sample sets; Fine-tune the preset chatglm model using the training set in the sample set, and determine the difference between the actual output value and the preset output value based on the acquired actual output value; Fine-tuning the weights of the preset chatglm model based on the difference; When the difference meets the preset difference condition, the fine-tuned preset chatglm model is tested based on the validation set and the test set in the sample set, and the parameters corresponding to the preset chatglm model are fine-tuned based on the evaluation result until the preset chatglm model meets the preset usage conditions.

6. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that The step of obtaining the answer text based on the vectorized question, the vector database and the fine-tuned preset chatglm model specifically includes: Input the vectorized question vector into the fine-tuned preset chatglm model to obtain a first reference answer text; Based on the vectorized question vector, similarity calculation is performed in the vector database to determine a plurality of reference question texts that meet similarity conditions; Based on the plurality of reference question texts, determining in the vector database the second reference answer texts corresponding to the reference question texts; sorting the plurality of second reference answer texts based on the frequency of occurrence of the second reference answer texts; The first reference answer text is compared with the sorted second reference answer text to determine the answer text based on the comparison result.

7. A text knowledge mining and dialogue generation method according to claim 6, It is characterized in that After determining the answer text based on the comparison result, the method further includes: Obtain the current user information and the historical conversation information corresponding to the current user to determine the user feature data and build a user portrait; Based on the user portrait, determining the text template with the highest similarity in the text pattern database; Based on the text template, the answer text is updated.

8. A text knowledge mining and dialogue generation method according to claim 1, It is characterized in that After fine-tuning the preset chatglm model based on the industry text data, the method further includes: Obtaining user feedback information, and associating the feedback information with corresponding dialogue generation tasks; Determine a sentence vector corresponding to the dialogue generation task, and perform a first coefficient allocation on the sentence vector based on the number of times the sentence vector is associated; and, analyzing the feedback information to determine a feedback information score corresponding to the feedback information, and performing a second coefficient allocation on the sentence vector based on the feedback information score; Based on the first coefficient and the second coefficient, an order to be adjusted corresponding to the sentence vector is determined, so as to adjust the sentence vector based on the order to be adjusted.

9. A text knowledge mining and dialogue generation device, It is characterized in that The device comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to execute the method according to any one of claims 1 to 8.

10. A non-volatile computer storage medium storing computer executable instructions, It is characterized in that The computer executable instructions can execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Retrieval method and device of knowledge base and storage medium

    CN116756295A

  • Question and answer method and device, electronic equipment and storage medium

    CN117708290A

  • Text generation method and system based on prompt project and fine tuning technology

    CN118095292A

  • Equipment operation and maintenance text data analysis processing method based on large model

    CN118246541A