A method and device for generating text data set of vectorized model

By segmenting text documents in specified fields and calculating correlations, keywords are extracted to generate text data sets, which solves the problem of inaccurate understanding of words in specific fields by vectorization models and achieves rapid generation of high-quality data sets and accuracy of the model. promote.

CN118468044BActive Publication Date: 2024-09-24ZHUO SHI ZHI XING (QINGTIAN) YUAN UNIVERSE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410932949.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-09-24
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

In the existing technology, it is difficult for the vectorization model to quickly obtain high-quality text data sets, resulting in the model's inaccurate understanding of words in specific fields and affecting processing accuracy.

Method used

By segmenting text documents in specified fields, calculating the correlation between text paragraphs, determining the positive and negative example sets, extracting keywords, generating target query text, and combining them to generate high-quality text data sets.

Benefits of technology

It realizes the rapid generation of high-quality text data sets, ensures that the vectorization model accurately understands words in specific fields, and improves processing accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118468044B
    Figure CN118468044B
Patent Text Reader

Abstract

The present invention provides a method and device for generating a text data set of a vectorization model, belonging to the field of artificial intelligence technology; the method comprises: performing text segmentation processing on a text document in a specified field to obtain a plurality of text paragraphs; for each target text paragraph, calculating the relevance between the target text paragraph and each other text paragraph; based on the relevance and a preset relevance threshold, determining a positive example set and a negative example set corresponding to the target text paragraph from other text paragraphs; performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set; combining the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph; combining the target query text, the positive example set and the negative example set corresponding to each target text paragraph to generate a text data set of a vectorization model in the specified field, thereby realizing rapid generation of a high-quality text data set of the vectorization model in the specified field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for generating a text data set of a vectorized model. Background Art

[0002] The vectorization model can convert the input text data into vector encoding, which can be used in multiple scenarios. For example, in the retrieval scenario, the similarity between the user query and each piece of data in the database can be calculated based on the vector encoding to find data related to the user query.

[0003] When vectorization models are applied to specific fields, in order to ensure that the vectorization models can accurately understand the professional terms in the field, it is usually necessary to construct text datasets to fine-tune the vectorization models. However, currently text datasets are usually manually constructed, which is costly and difficult to quickly obtain high-quality text datasets. Summary of the invention

[0004] In view of the above problems, the object of the present invention is to provide a method and device for generating a text dataset of a vectorized model, which can quickly generate a high-quality text dataset.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0006] On the one hand, a method for generating a text dataset of a vectorization model is provided, comprising:

[0007] Perform text segmentation on text documents in a specified field to obtain multiple text paragraphs;

[0008] For each target text paragraph, calculating the relevance between the target text paragraph and each other text paragraph, and obtaining a plurality of relevances corresponding to the target text paragraph, wherein the target text paragraph is any one of the plurality of text paragraphs;

[0009] Based on the multiple relevances and a preset relevance threshold, determining a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs, the positive example set including a plurality of positive example paragraphs, and the negative example set including a plurality of negative example paragraphs;

[0010] Performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set;

[0011] Combining the keyword set and the target text paragraph, generating a target query text corresponding to the target text paragraph;

[0012] The target query text, the positive example set, and the negative example set corresponding to each target text paragraph are combined to generate a text dataset of a vectorization model in the specified domain.

[0013] Optionally, for each target text paragraph, calculating the relevance between the target text paragraph and each other text paragraph to obtain multiple relevances corresponding to the target text paragraph includes:

[0014] Based on the first vectorization model, calculating a first similarity between the target text paragraph and each other text paragraph;

[0015] Calculating a second similarity between the target text paragraph and each other text paragraph based on a second vectorization model, wherein the first vectorization model and the second vectorization model have different architectures;

[0016] The first similarity and the second similarity are combined to calculate the relevance between the target text paragraph and each other text paragraph.

[0017] Optionally, the combining the first similarity and the second similarity to calculate the relevance between the target text paragraph and each other text paragraph includes:

[0018] Based on the first similarity and a preset sorting rule, the other text paragraphs are sorted to obtain a first paragraph sequence;

[0019] Based on the second similarity and the preset sorting rule, the other text paragraphs are sorted to obtain a second paragraph sequence;

[0020] For each other text paragraph, obtain a first ranking of the other text paragraph in the first paragraph sequence, and a second ranking of the other text paragraph in the second paragraph sequence;

[0021] Based on the first ranking and the second ranking of each other text paragraph, the relevance between the target text paragraph and the other text paragraph is calculated.

[0022] Optionally, the preset relevance threshold includes a first threshold and a second threshold, the first threshold is greater than the second threshold, and the determining the positive example set and the negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and the preset relevance threshold includes:

[0023] Determine other text paragraphs whose relevance is greater than the first threshold as positive example paragraphs corresponding to the target text paragraph, and obtain a positive example set corresponding to the target text paragraph;

[0024] Other text paragraphs whose relevance is less than the second threshold are determined as negative example paragraphs corresponding to the target text paragraph, so as to obtain a negative example set corresponding to the target text paragraph.

[0025] Optionally, performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set includes:

[0026] For each candidate positive example paragraph, segment and clean the candidate positive example paragraph to obtain multiple candidate words, and the candidate positive example paragraph is any one of the multiple positive example paragraphs;

[0027] For each of the candidate words, calculating the word frequency of the candidate word in the candidate positive example paragraph;

[0028] For each of the candidate words, calculating the paragraph frequency of the candidate word in the positive example set;

[0029] Multiplying the word frequency and the paragraph frequency to obtain a key score corresponding to the candidate word;

[0030] Keywords are extracted from the plurality of positive example paragraphs based on the key scores to obtain a keyword set.

[0031] Optionally, combining the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph includes:

[0032] Determining a target phrase from the keyword set, wherein the target phrase includes a preset number of keywords;

[0033] Based on the target phrase and the target text paragraph, generating a target prompt word, wherein the target prompt word includes a target quantity;

[0034] Using the target prompt word to guide the generation of a language model, generating the target number of candidate query texts;

[0035] A rationality check is performed on the target number of candidate query texts, and a target query text is determined from the target number of candidate query texts based on the rationality check result.

[0036] Optionally, determining a target phrase from the keyword set includes:

[0037] According to the preset number, combining keywords in the keyword set to obtain a plurality of candidate phrases;

[0038] Get the weight parameters at the current number of iterations;

[0039] For each candidate word group, calculating the average estimated parameter of the candidate word group at the current number of iterations based on the weight parameter;

[0040] Calculating, based on the average estimated parameter and the current number of iterations, estimated parameters of the candidate phrase when a target context is given, the target context including information about the target text paragraph and the text document to which the target text paragraph belongs;

[0041] A target phrase is determined from the plurality of candidate phrases based on the estimated parameters of each candidate phrase.

[0042] Optionally, after determining the target phrase from the plurality of candidate phrases based on the estimated parameters of each candidate phrase, the method further comprises:

[0043] Based on the scoring model and the scoring prompt words, obtaining the scoring parameters corresponding to the target phrase;

[0044] If the scoring parameter and the estimated parameter do not meet the preset convergence condition, updating the weight parameter to obtain the weight parameter for the next iteration number;

[0045] If the scoring parameter and the estimated parameter meet the preset convergence condition, the weight parameter is determined as the target weight parameter, and the target weight parameter is used as the weight parameter for the next iteration.

[0046] Optionally, performing a rationality check on the target number of candidate query texts, and determining a target query text from the target number of candidate query texts based on the rationality check result, includes:

[0047] Based on the candidate query text and the target text paragraph, generating a detection prompt word;

[0048] Based on the detection prompt word, guiding the detection model to determine whether each of the candidate query texts is related to the target text paragraph, so as to obtain a rationality detection result of each of the candidate query texts;

[0049] If the rationality detection result of the candidate query text is reasonable, the candidate query text is determined as the target query text.

[0050] On the other hand, a device for generating a text data set of a vectorization model is provided, comprising:

[0051] The segmentation module is used to perform text segmentation processing on text documents in a specified field to obtain multiple text paragraphs;

[0052] A calculation module, for calculating, for each target text paragraph, a relevance between the target text paragraph and each other text paragraph, and obtaining a plurality of relevances corresponding to the target text paragraph, wherein the target text paragraph is any one of the plurality of text paragraphs;

[0053] A determination module, configured to determine a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and a preset relevance threshold, wherein the positive example set includes a plurality of positive example paragraphs, and the negative example set includes a plurality of negative example paragraphs;

[0054] An extraction module, used for performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set;

[0055] A query generation module, used to combine the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph;

[0056] The data set generation module is used to combine the target query text, the positive example set and the negative example set corresponding to each target text paragraph to generate a text data set of the vectorization model in the specified field.

[0057] On the other hand, an electronic device is also provided, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in the text dataset generation method of any vectorization model provided in an embodiment of the present invention.

[0058] On the other hand, a computer-readable storage medium is also provided, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any method for generating a text dataset of a vectorization model provided in an embodiment of the present invention.

[0059] On the other hand, a computer program product is also provided, including a computer program / instruction, which, when executed by a processor, implements the steps in the text dataset generation method of any vectorization model provided in the embodiments of the present invention.

[0060] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0061] The embodiment of the present invention can perform text segmentation on a text document in a specified field to obtain multiple text paragraphs; the positive example paragraphs and the negative example paragraphs can be accurately determined by using the correlation between the target text paragraph and other text paragraphs; keywords are then extracted from the positive example paragraphs, and a target query text is generated by using the keywords and the positive example paragraphs, thereby ensuring that a target query text related to the target text paragraph is generated; finally, the target query text, the positive example paragraphs and the negative example paragraphs are combined to quickly generate a high-quality text data set for a vectorization model in the specified field. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0063] Figure 1 It is a schematic diagram of an application scenario of a text data set generation method of a vectorization model provided in an embodiment of the present invention;

[0064] Figure 2 It is a flowchart of a method for generating a text data set of a vectorized model provided by an embodiment of the present invention;

[0065] Figure 3 is a schematic diagram of calculating correlation provided by an embodiment of the present invention;

[0066] Figure 4 is a schematic diagram of obtaining a keyword set provided by an embodiment of the present invention;

[0067] Figure 5 It is a structural schematic diagram of a text data set generating device of a vectorized model provided by an embodiment of the present invention;

[0068] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0069] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0070] With the rapid development of artificial intelligence technology, vectorization models have been widely used in various scenarios. In particular, in the field of natural language processing, vectorization models are usually used to encode text into feature vectors for subsequent processing. However, the inventors found that vectorization models cannot well understand words in specific fields, resulting in inaccurate feature vectors, which in turn affects the accuracy of subsequent processing.

[0071] In order to enable the vectorization model to better understand words in a specific field, a text dataset in the corresponding field can be constructed for fine-tuning the vectorization model. Each piece of data in the text dataset of the vectorization model consists of a triple, that is, it needs to contain a query, a positively related text corresponding to the query, and a negatively related text corresponding to the query. At present, these data are all generated manually. Due to the high labor cost and the non-uniform standards for positive correlation and negative correlation, the construction cost of the text dataset is high and the quality is poor. Therefore, the present invention proposes a text dataset generation for a vectorization model to quickly generate a high-quality text dataset.

[0072] It is understandable that in the specific implementation of the present invention, data related to user information, etc., needs to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0073] For example, see Figure 1 , shows a schematic diagram of an application scenario of a method for generating a text dataset of a vectorization model. The application scenario may include a terminal 101 and a server 102, and data can be exchanged between the terminal 101 and the server 102 via a network. The terminal 101 may be a mobile phone, a tablet computer, a smart Bluetooth device, a computer, and the like; the server 102 may be a single server or a server cluster consisting of multiple servers.

[0074] The terminal 101 may be installed with a program related to automatic data set generation, and the user may send the model information for determining the need to generate a text data set to the server 102 through the terminal 101. At the same time, the user may submit the specified field to the server 102 through the terminal 101, or directly submit the text document of the specified field to the server 102.

[0075] The server 102 can perform text segmentation processing on text documents in a specified field to obtain multiple text paragraphs; for each target text paragraph, calculate the relevance of the target text paragraph with each other text paragraph to obtain multiple relevances corresponding to the target text paragraph; based on multiple relevances and a preset relevance threshold, determine the positive example set and the negative example set corresponding to the target text paragraph from other text paragraphs; perform keyword extraction processing on multiple positive example paragraphs to obtain a keyword set; combine the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph; combine the target query text corresponding to each target text paragraph, the positive example set and the negative example set to generate a text data set of a vectorized model in the specified field.

[0076] Finally, the server 102 may store the generated text data set in a designated database, and feed back an access link of the text data set to the terminal 101 so that the terminal 101 can obtain the text data set.

[0077] In this embodiment, a method for generating a text dataset of a vectorized model is provided, such as Figure 2 As shown, the specific process of the generation method may include the following contents:

[0078] S110: Perform text segmentation processing on the text document in the specified field to obtain multiple text paragraphs.

[0079] The designated field is the field where data collection is currently required, and the designated field can be determined according to actual needs. The text documents under the designated field refer to knowledge documents, user manuals, etc. within the designated field, and these text documents can be obtained from the Internet.

[0080] In order to facilitate the processing of text documents, these text documents can be segmented. For example, for each text document, the text document can be segmented according to a specified length to obtain corresponding text paragraphs. The specified length can refer to the number of characters, and the specific value of the specified length can be set according to actual needs, for example, it can be set to 500 characters, 1000 characters, etc. according to actual needs.

[0081] In some implementations, semantic integrity may be taken into consideration when segmenting a text document. As an implementation, a paragraph may be firstly cut out from the text document based on a specified length to determine whether the semantics of the paragraph are complete. If the paragraph is complete, the paragraph is determined as a text paragraph; if the paragraph is incomplete, the paragraph is adjusted based on semantic integrity to obtain a semantically complete text paragraph.

[0082] After performing text segmentation processing on each text document in the above manner, multiple text paragraphs can be obtained.

[0083] S120 . For each target text paragraph, calculate the relevance between the target text paragraph and each other text paragraph to obtain a plurality of relevances corresponding to the target text paragraph.

[0084] The target text paragraph is any one of the multiple text paragraphs, that is, each text paragraph will be processed as the target text paragraph; other text paragraphs refer to the text paragraphs other than the target text paragraph among the multiple text paragraphs. Relevance refers to the degree of association between the target text paragraph and other text paragraphs.

[0085] For each target text paragraph, the relevance between the target text paragraph and each other text paragraph can be calculated, thereby obtaining multiple relevances corresponding to the target text paragraph. For example, if there are n text paragraphs in total, n-1 relevances can be calculated for each target text paragraph.

[0086] In some implementations, the target text paragraph and other text paragraphs may be directly converted into corresponding feature vectors using a vectorization model, and then the cosine similarity between the target text paragraph and other text paragraphs may be calculated using the feature vectors to obtain multiple relevances corresponding to the target text paragraph.

[0087] In some embodiments, based on a first vectorization model, a first similarity between the target text paragraph and each other text paragraph is calculated; based on a second vectorization model, a second similarity between the target text paragraph and each other text paragraph is calculated, and the architectures of the first vectorization model and the second vectorization model are different; and in combination with the first similarity and the second similarity, the relevance between the target text paragraph and each other text paragraph is calculated.

[0088] See also Figure 3 , shows a schematic diagram of calculating the relevance, wherein the first vectorization model and the second vectorization model are both models for converting text paragraphs into feature vectors, but the model architectures of the first vectorization model and the second vectorization model are different. For example, the first vectorization model adopts bge-large-zh-v1.5 based on the encoder architecture, and the second vectorization model adopts the vectorization model gte-Qwen1.5-7B-instruct based on the large model architecture.

[0089] Using the first vectorization model, the target text paragraph can be converted into a first feature vector, each other text paragraph can be converted into a second feature vector, and the cosine similarity between the first feature vector and each second feature vector can be calculated to obtain the first similarity. Similarly, using the second vectorization model, the target text paragraph can be converted into a third feature vector, each other text paragraph can be converted into a fourth feature vector, and the cosine similarity between the third feature vector and each fourth feature vector can be calculated to obtain the second similarity.

[0090] It is understandable that there are multiple first similarities and multiple second similarities, and the relevance between the target text paragraph and each other text paragraph can be calculated using the first similarity and the second similarity. In some embodiments, when calculating the relevance, the other text paragraphs can be sorted based on the first similarity and the preset sorting rule to obtain a first paragraph sequence; based on the second similarity and the preset sorting rule, the other text paragraphs are sorted to obtain a second paragraph sequence; for each other text paragraph, the first ranking of the other text paragraph in the first paragraph sequence and the second ranking of the other text in the second paragraph sequence are obtained; based on the first ranking and the second ranking of each other text paragraph, the relevance between the target text paragraph and the other text paragraph is calculated.

[0091] After calculating multiple first similarities, one first similarity corresponds to one other text paragraph, and thus, the other text paragraphs can be sorted based on the first similarity to obtain a first paragraph sequence. The greater the first similarity, the more similar the target text paragraph is to the other text paragraphs, and the preset sorting rule can be to arrange the other text paragraphs in descending order according to the first similarity to obtain the first paragraph sequence.

[0092] Similarly, a second similarity corresponds to another text paragraph, and the other text paragraphs can be sorted based on the second similarity to obtain a second paragraph sequence. The greater the second similarity, the more similar the target text paragraph is to the other text paragraph, and the other text paragraphs can be arranged in descending order according to the second similarity to obtain the second paragraph sequence.

[0093] It is understandable that the ranking of the same other text paragraph in the first paragraph sequence and in the second paragraph sequence may be different. For each other text paragraph, the ranking of the other text paragraph in the first paragraph sequence can be obtained to obtain the first ranking; similarly, the ranking of the other text paragraph in the second paragraph sequence can be obtained to obtain the second ranking.

[0094] For each other text paragraph, the first ranking and the second ranking may be used to calculate the relevance between the other text paragraph and the target text paragraph. Optionally, the relevance may be calculated using the following formula:

[0095] ;

[0096] Among them, C represents the correlation between an other text paragraph and the target text paragraph; R1 represents the first ranking of the other text paragraph; R2 represents the second ranking of the other text paragraph; j is a constant, which can be set according to actual needs. It can be understood that the greater the correlation, the higher the ranking of the other text paragraph in the first paragraph sequence and the second paragraph sequence, and the stronger the correlation between the other text paragraph and the target text paragraph.

[0097] According to the above formula, the relevance between each other text paragraph and the target text paragraph can be calculated, thereby obtaining multiple relevances corresponding to the target text paragraph. When calculating the relevance, the similarities calculated by two vectorization models with different architectures are combined. When the vectorization model of one architecture is not accurate enough, it can be supplemented by the vectorization model of another architecture, which can further improve the accuracy of the relevance calculation.

[0098] S130: Determine a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and a preset relevance threshold.

[0099] The positive example set may include multiple positive example paragraphs, and the negative example set may include multiple negative example paragraphs, wherein the positive example paragraphs refer to other text paragraphs with a high relevance to the target text paragraph, and the negative example paragraphs refer to other text paragraphs with a low relevance to the target text paragraph.

[0100] In some embodiments, the preset relevance threshold may be a value set according to actual needs, and other text paragraphs with a relevance greater than the preset relevance threshold may be determined as positive example paragraphs, and other text paragraphs with a relevance less than or equal to the preset relevance threshold may be determined as negative example paragraphs.

[0101] When fine-tuning the vectorization model for a specified field, a contrastive learning method is usually used so that the query in the triplet has a high similarity with the positive example set and is not related to the negative example set. That is, when constructing the data set, it is necessary to ensure that the difference between the positive example paragraph and the negative example paragraph is large enough. Therefore, in some embodiments, the preset relevance threshold may include two values, a first threshold and a second threshold. Among them, the first threshold may be greater than the second threshold, and the specific values ​​of the first threshold and the second threshold may be set according to actual needs, and are not specifically limited here. When determining the positive example set and the negative example set, it can be that other text paragraphs with a relevance greater than the first threshold are determined as positive example paragraphs corresponding to the target text paragraph to obtain a positive example set; other text paragraphs with a relevance less than the second threshold are determined as negative example paragraphs corresponding to the target text paragraph to obtain a negative example set. That is, other text paragraphs with a relevance greater than the first threshold can be determined as positive example paragraphs to obtain a positive example set, and other text paragraphs with a relevance less than the second pre-threshold can be determined as negative example paragraphs to obtain a negative example set.

[0102] S140: Perform keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set.

[0103] The positive example set may include multiple positive example paragraphs, and the negative example set may include multiple negative example paragraphs. Keyword extraction processing may be performed on the multiple positive example paragraphs to extract keywords from the multiple positive example paragraphs to obtain a keyword set.

[0104] As an implementation method, each positive example paragraph may be directly segmented, and each word obtained by the segmentation is used as a keyword to obtain a keyword set.

[0105] As another implementation, in order to ensure that each keyword in the acquired keyword set has a high correlation with the target text paragraph, each candidate positive example paragraph may be segmented and cleaned to obtain multiple candidate words, and the candidate positive example paragraph is any one of the multiple positive example paragraphs; for each of the candidate words, the word frequency of the candidate word in the candidate positive example paragraph is calculated; for each of the candidate words, the paragraph frequency of the candidate word in the positive example set is calculated; the word frequency and the paragraph frequency are multiplied to obtain a key score corresponding to the candidate word; and the key score is used to extract keywords from the multiple positive example paragraphs to obtain a keyword set.

[0106] See also Figure 4, which shows a schematic diagram of obtaining a keyword set. Among them, the candidate positive example paragraph is any one of multiple positive example paragraphs, and each positive example paragraph will be processed as a candidate positive example paragraph. For each candidate positive example paragraph, perform word segmentation and cleaning on the candidate positive example paragraph, that is, split the candidate positive example paragraph into multiple words or characters, and then remove meaningless words, such as "de", "shi", etc., to obtain multiple words. After de-duplicating these multiple words, multiple candidate words are obtained.

[0107] For each candidate word, first count the number of times the candidate word appears in the candidate positive example paragraph, and then divide the number of occurrences by the total number of words in the candidate positive example paragraph to obtain the word frequency. Then count the number of positive example paragraphs in the entire positive example set that contain the candidate word, and divide the total number of positive example paragraphs in the positive example set by the sum of the number of positive example paragraphs containing the candidate word and 1 to obtain a ratio. Then take the logarithm of the calculated ratio to obtain the paragraph frequency.

[0108] Finally, multiply the word frequency and the paragraph frequency to obtain the key score corresponding to the candidate word. Specifically, the key score can be calculated according to the following formula:

[0109] ;

[0110] Among them, A represents the key score of the candidate word; n represents the number of times the candidate word appears in the corresponding candidate positive example paragraph; N represents the total number of words in the corresponding candidate positive example paragraph; D represents the total number of candidate positive example paragraphs in the positive example set; d represents the number of positive example paragraphs in the positive example set that contain the candidate word.

[0111] Among them, the higher the key score corresponding to the candidate word, the more significant or unique the appearance of the candidate word in the candidate positive example paragraph is, and it may be part of the theme or key content of the candidate positive example paragraph. In the above manner, for each candidate positive example paragraph, the key score of each candidate word therein can be calculated. Based on this key score, keywords can be extracted from multiple positive example paragraphs.

[0112] As an implementation method, for each candidate positive example paragraph, the candidate words therein can be sorted based on the key score, and the top m candidate words with higher rankings can be selected as the keywords of the candidate positive example paragraph. In this way, keywords can be determined from each candidate positive example paragraph to obtain a keyword set.

[0113] As an implementation method, the same candidate word may exist in different candidate positive example paragraphs. The key score of the candidate word can be divided by the sum of the key scores of each candidate word in the candidate positive example paragraph where the candidate word is currently located to obtain a normalized key score, and then the normalized key scores are summed to obtain the target score corresponding to the candidate word. The first m1 candidate words with the highest ranking are selected as keywords to obtain a keyword set, or the candidate words with the target score greater than the preset score are selected as keywords to obtain a keyword set.

[0114] S150: Combine the keyword set and the target text paragraph to generate a query text corresponding to the target text paragraph.

[0115] The keywords in the keyword set are extracted from the positive example paragraphs. The positive example paragraphs are text paragraphs that have a certain relevance to the target text paragraph, and the query text also needs to have a certain relevance to the target text paragraph. Therefore, the keywords in the keyword set can be used to generate the query text corresponding to the target text paragraph.

[0116] In some embodiments, when generating a query text, a target phrase can be determined from the keyword set, the target phrase including a preset number of keywords; based on the target phrase and the target text paragraph, a target prompt word is generated, the target prompt word including a target number; the target prompt word is used to guide the generation of a language model to generate the target number of candidate query texts; a rationality check is performed on the target number of candidate query texts, and a target query text is determined from the target number of candidate query texts based on the rationality check result.

[0117] The keyword set may include multiple keywords, and a preset number of keywords may be extracted from the keyword set to obtain a target phrase. The preset number may be set according to actual needs and is not specifically limited here. For example, it may be set to 2, 3, etc.

[0118] As an implementation method, a preset number of keywords may be randomly extracted from a keyword set to obtain a target phrase.

[0119] As another implementation, when extracting a preset number of keywords, the keywords can be combined in the keyword set according to the preset number to obtain multiple candidate phrases; the weight parameters at the current number of iterations are obtained; for each candidate phrase, the average estimated parameters of the candidate phrase at the current number of iterations are calculated based on the weight parameters; based on the average estimated parameters and the current number of iterations, the estimated parameters of the candidate phrase are calculated when a target context is given, the target context includes the target text paragraph and information about the text document to which the target text paragraph belongs; based on the estimated parameters of each candidate phrase, a target phrase is determined from the multiple candidate phrases.

[0120] Based on the preset number, all possible keyword combinations can be determined in the keyword set to obtain multiple candidate phrases, wherein each candidate phrase includes a preset number of keywords. The current iteration number refers to the number of times the target phrase is currently determined. When the current iteration number is the first time, the weight parameter can be a preset initial weight. Similarly, the average estimated parameter can also be a preset initial estimated value. Optionally, the estimated value can be initialized using a 0-1 normal distribution to obtain an initial estimated value, which can facilitate subsequent rapid convergence.

[0121] Based on the corresponding average estimated parameters and the current number of iterations, the estimated parameters of the candidate phrases can be calculated based on the following formula:

[0122] ;

[0123] Where Ra represents the estimated parameter of candidate phrase a; Q(s,a) represents the average estimated parameter of candidate phrase a selected under target context s; represents an adjustable parameter used to control the width of the confidence boundary; t represents the current number of iterations; N(s,a) represents the number of times the candidate phrase a is selected under the target context s. It should be noted that the average estimation parameter can be related to the corresponding weight parameter, that is, the weight parameter can affect the value of the average estimation parameter; The value determines the trade-off between exploration and exploitation of the model. The value encourages more exploration, even if the candidate phrase has a poor historical performance, it may be selected, while smaller The value is more inclined to use known information to select candidate phrases with good historical performance.

[0124] The target context may include information about the target text paragraph and the text document to which the target text paragraph belongs, such as the title of the text document. According to the above method, the estimated parameter corresponding to each candidate phrase may be calculated. Then, the candidate phrase corresponding to the maximum value of the estimated parameter may be selected to obtain the target phrase.

[0125] After obtaining the target phrase, in order to continuously optimize and determine the target phrase so that the selected target phrase is more in line with the target context, the scoring parameters corresponding to the target phrase can be obtained based on the scoring model and the scoring prompt words; if the scoring parameters and the estimated parameters do not meet the preset convergence conditions, the weight parameters are updated to obtain the weight parameters for the next iteration number; if the scoring parameters and the estimated parameters meet the preset convergence conditions, the weight parameters are determined as the target weight parameters, and the target weight parameters are used as the weight parameters for the next iteration number.

[0126] The scoring model may refer to a large language model. Using the large language model and the corresponding scoring prompt words, the scoring model can be guided to score the target phrase, and the score range can be 0-10 to obtain the scoring parameter of the target phrase. The difference between the scoring parameter and the estimated parameter is calculated. If the difference does not meet the preset convergence condition, such as when the difference is greater than a certain threshold, the gradient descent method can be used to update the weight parameter, so that in the next iteration, the updated weight parameter can be used to affect the estimated parameter to select a target phrase that is more in line with the target context. If the preset convergence condition is met, the corresponding weight parameter can be used as the target weight parameter. In subsequent iterations, the target weight parameter is used to affect the estimated parameter, thereby optimizing the selection of the target phrase. Combining the reinforcement learning algorithm to determine the target phrase can ensure that the optimal phrase is selected so that a more professional and accurate target query text can be generated later. It should be noted that the above process is an online update process, that is, as the number of target phrases selected increases, the strategy for selecting the target phrase can be continuously optimized based on the previously learned knowledge and the target context, so that the selected target phrase is more in line with the target context.

[0127] After obtaining the target phrase, a target prompt word may be generated based on the target phrase and the target text paragraph, and then the target prompt word may be input into the generative language model to guide the generative language model to generate a query text corresponding to the target text paragraph.

[0128] When generating the target prompt word, a first prompt word template may be obtained first, and the first prompt word template may include a phrase slot, a paragraph slot, and a quantity slot.

[0129] The first prompt word template example is as follows:

[0130] prompt = """

[0131] You are an expert / professor in {domain} and your task is to set {k} questions for the upcoming exam. You must strictly set questions based on the given reference information and not on your prior knowledge or fabricating information. Questions should be diverse in nature and cover different parts of the document. Please limit your questions to the scope of the reference information provided.

[0132] The questions you ask should be as relevant as possible to your keyword list.

[0133] Keyword list:

[0134] {keyword}

[0135] Reference Information:

[0136] {doc_i}

[0137] List of questions:

[0138] """

[0139] Among them, {k} is the number slot, which can be filled with the number of query texts to be generated, that is, the target number. For example, the target number can be 2 or 3. {keyword} is the phrase slot, which can be filled with the determined target phrase; {doc_i} is the paragraph slot, which can be filled with the corresponding target text paragraph. After each slot is filled with the corresponding content, the target prompt word can be obtained.

[0140] The generative language model refers to a generative language model used to generate candidate query texts. The target prompt word is input into the generative language model, and the generative language model can generate a target number of candidate query texts as the output of the generative language model according to the requirements in the target prompt word.

[0141] In order to ensure the rationality of the candidate query texts, the rationality detection can be continued for the target number of candidate query texts, and then the target query text can be screened out based on the rationality detection results. Optionally, detection prompt words can be generated based on the candidate query texts and the target text paragraphs; based on the detection prompt words, the detection model is guided to determine whether each of the candidate query texts and the target text paragraphs are related to obtain the rationality detection result of each of the candidate query texts; if the rationality detection result of the candidate query text is reasonable, the candidate query text is determined as the target query text.

[0142] The candidate query text and the target text paragraph are used to generate detection prompt words for rationality detection. When generating the detection prompt words, a second prompt word template may be obtained first, and the second prompt word template may include a candidate slot and a paragraph slot.

[0143] The second prompt word template example is as follows:

[0144] prompt=""

[0145] You are an expert scorer who assesses the relevance of retrieved documents to user questions.

[0146] This is the retrieved document:

[0147] {doc i}

[0148] This is the user query:

[0149] {query}

[0150] If the document contains keywords related to the user's question, rate it as relevant and answer yes, otherwise answer no and output the answer in json format.

[0151] """

[0152] If the answer is yes, the current query is retained as the synthesized query.

[0153] Among them, {doc_i} is a paragraph slot, which can be filled with the target text paragraph, and {query} is a candidate slot, which can be filled with a target number of candidate query texts. After each slot is filled with the corresponding content, the detection prompt word can be obtained.

[0154] The detection model is a language model. The detection prompt words are input into the detection model to guide the detection model to determine whether the target text paragraph includes keywords related to the candidate query text for each candidate query text; if included, the rationality test result of the candidate query text is determined to be reasonable; if not, the rationality test result of the candidate query text is determined to be unreasonable. The candidate query text with a reasonable rationality test result is determined as the target query text. Rationality testing helps to optimize the generation of candidate query texts and ensure that the generated candidate query texts are not only grammatically correct but also semantically consistent with expectations.

[0155] S160, combining the target query text, the positive example set, and the negative example set corresponding to each target text paragraph to generate a text dataset of a vectorization model in the specified field.

[0156] For each target text paragraph, after obtaining the target query text, positive example set and negative example set corresponding to the target text paragraph, they can be combined to generate a text dataset.

[0157] As an implementation method, each positive example paragraph in the positive example set may be combined with each negative example paragraph in the negative example set to obtain a plurality of combination data; and each target text paragraph and each combination data may be combined to obtain target combination data.

[0158] According to the above method, a plurality of target combination data can be obtained for each target text paragraph, and all the target combination data can constitute a text data set.

[0159] It should be noted that the text dataset is generated based on text documents in a specified field. The text dataset can be used to fine-tune the vectorization model so that the vectorization model can accurately convert the text in the specified field into corresponding vectors.

[0160] The text data set generation scheme for the vectorized model provided by the embodiment of the present invention can be applied in various scenarios where training data for the vectorized model needs to be constructed. For example, taking the health care field as an example, the scheme provided by the embodiment of the present invention can quickly generate high-quality text data sets based on text documents in the health care field, so as to train the corresponding vectorized model in the health care field.

[0161] As can be seen from the above, the embodiment of the present invention can perform text segmentation on text documents in a specified field to obtain multiple text paragraphs, and calculate the relevance of the target text paragraph and other text paragraphs by fusing the similarity calculated by vectorization models of different structures, so that the relevance is more accurate. The relevance is used to accurately distinguish multiple positive example paragraphs related to the target text paragraph, and multiple negative example paragraphs unrelated to the target text paragraph; then, keywords are extracted from the positive example paragraphs to accurately generate the target query text related to the target text paragraph, and finally, the target query text, positive example paragraphs and negative example paragraphs are combined to obtain a triple text data set in the specified field, so that a high-quality text data set can be quickly generated.

[0162] In order to better implement the above method, the embodiment of the present invention also provides a text data set generation device of a vectorized model, which can be integrated in an electronic device, and the electronic device can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.

[0163] For example, in this embodiment, the method of the embodiment of the present invention is described in detail by taking the text data set generation device of the vectorization model specifically integrated in the server as an example.

[0164] For example, Figure 5 As shown, the text dataset generating device 200 of the vectorized model may include a segmentation module 210 , a calculation module 220 , a determination module 230 , an extraction module 240 , a query generation module 250 and a dataset generation module 260 .

[0165] The segmentation module 210 is used to perform text segmentation processing on the text document in the specified field to obtain multiple text paragraphs;

[0166] A calculation module 220, for calculating, for each target text paragraph, a relevance between the target text paragraph and each other text paragraph, to obtain a plurality of relevances corresponding to the target text paragraph, wherein the target text paragraph is any one of the plurality of text paragraphs;

[0167] A determination module 230, configured to determine a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and a preset relevance threshold, wherein the positive example set includes a plurality of positive example paragraphs, and the negative example set includes a plurality of negative example paragraphs;

[0168] An extraction module 240 is used to perform keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set;

[0169] A query generation module 250, configured to combine the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph;

[0170] The data set generation module 260 is used to combine the target query text, the positive example set and the negative example set corresponding to each target text paragraph to generate a text data set of a vectorization model.

[0171] In some embodiments, the calculation module 220 is specifically used to:

[0172] Based on the first vectorization model, calculating a first similarity between the target text paragraph and each other text paragraph;

[0173] Calculating a second similarity between the target text paragraph and each other text paragraph based on a second vectorization model, wherein the first vectorization model and the second vectorization model have different architectures;

[0174] The first similarity and the second similarity are combined to calculate the relevance between the target text paragraph and each other text paragraph.

[0175] In some embodiments, the calculation module 220 is specifically used to:

[0176] Based on the first similarity and a preset sorting rule, the other text paragraphs are sorted to obtain a first paragraph sequence;

[0177] Based on the second similarity and the preset sorting rule, the other text paragraphs are sorted to obtain a second paragraph sequence;

[0178] For each other text paragraph, obtain a first ranking of the other text paragraph in the first paragraph sequence, and a second ranking of the other text paragraph in the second paragraph sequence;

[0179] Based on the first ranking and the second ranking of each other text paragraph, the relevance between the target text paragraph and the other text paragraph is calculated.

[0180] In some embodiments, the preset correlation threshold includes a first threshold and a second threshold, the first threshold is greater than the second threshold, and the determination module 230 is specifically used to:

[0181] Determine other text paragraphs whose relevance is greater than the first threshold as positive example paragraphs corresponding to the target text paragraph, and obtain a positive example set corresponding to the target text paragraph;

[0182] Other text paragraphs whose relevance is less than the second threshold are determined as negative example paragraphs corresponding to the target text paragraph, so as to obtain a negative example set corresponding to the target text paragraph.

[0183] In some embodiments, the extraction module 240 is specifically used to:

[0184] For each candidate positive example paragraph, segment and clean the candidate positive example paragraph to obtain multiple candidate words, and the candidate positive example paragraph is any one of the multiple positive example paragraphs;

[0185] For each of the candidate words, calculating the word frequency of the candidate word in the candidate positive example paragraph;

[0186] For each of the candidate words, calculating the paragraph frequency of the candidate word in the positive example set;

[0187] Multiplying the word frequency and the paragraph frequency to obtain a key score corresponding to the candidate word;

[0188] Extract keywords from the multiple positive example paragraphs based on the key scores to obtain a keyword set

[0189] In some embodiments, the query generation module 250 is specifically used to:

[0190] Determining a target phrase from the keyword set, wherein the target phrase includes a preset number of keywords;

[0191] Based on the target phrase and the target text paragraph, generating a target prompt word, wherein the target prompt word includes a target quantity;

[0192] Using the target prompt word to guide the generation of a language model, generating the target number of candidate query texts;

[0193] A rationality check is performed on the target number of candidate query texts, and a target query text is determined from the target number of candidate query texts based on the rationality check result.

[0194] In some embodiments, the query generation module 250 is specifically used to:

[0195] According to the preset number, combining keywords in the keyword set to obtain a plurality of candidate phrases;

[0196] Get the weight parameters at the current number of iterations;

[0197] For each candidate word group, calculating the average estimated parameter of the candidate word group at the current number of iterations based on the weight parameter;

[0198] Calculating, based on the average estimated parameter and the current number of iterations, estimated parameters of the candidate phrase when a target context is given, the target context including information about the target text paragraph and the text document to which the target text paragraph belongs;

[0199] A target phrase is determined from the plurality of candidate phrases based on the estimated parameters of each candidate phrase.

[0200] In some embodiments, after determining the target phrase from the plurality of candidate phrases based on the estimated parameters of each candidate phrase, the query generation module 250 is specifically configured to:

[0201] Based on the scoring model and the scoring prompt words, obtaining the scoring parameters corresponding to the target phrase;

[0202] If the scoring parameter and the estimated parameter do not meet the preset convergence condition, updating the weight parameter to obtain the weight parameter for the next iteration number;

[0203] If the scoring parameter and the estimated parameter meet the preset convergence condition, the weight parameter is determined as the target weight parameter, and the target weight parameter is used as the weight parameter for the next iteration.

[0204] In some embodiments, the query generation module 250 is specifically used to:

[0205] Based on the candidate query text and the target text paragraph, generating a detection prompt word;

[0206] Based on the detection prompt word, guiding the detection model to determine whether each of the candidate query texts is related to the target text paragraph, so as to obtain a rationality detection result of each of the candidate query texts;

[0207] If the rationality detection result of the candidate query text is reasonable, the candidate query text is determined as the target query text.

[0208] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0209] As can be seen from the above, the text dataset generating device of the vectorization model of this embodiment can perform text segmentation on text documents in a specified field to obtain multiple text paragraphs; the positive example paragraphs and the negative example paragraphs can be accurately determined by utilizing the correlation between the target text paragraphs and other text paragraphs; keywords are then extracted from the positive example paragraphs, and target query texts are generated using the keywords and the positive example paragraphs, thereby ensuring that target query texts related to the target text paragraphs are generated; and finally, the target query texts, positive example paragraphs and negative example paragraphs are combined to quickly generate a high-quality text dataset of the vectorization model in the specified field.

[0210] The embodiment of the present invention further provides an electronic device, which may be a terminal, a server, or the like. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, or the like; the server may be a single server or a server cluster composed of multiple servers, or the like.

[0211] In some embodiments, the text dataset generation device of the vectorization model can also be integrated into multiple electronic devices. For example, the text dataset generation device of the vectorization model can be integrated into multiple servers, and the text dataset generation method of the vectorization model of the present invention can be implemented by multiple servers.

[0212] In this embodiment, the electronic device of this embodiment is a server as an example for detailed description, for example, Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0213] The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0214] The processor 310 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 320, and calling data stored in the memory 320. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 310.

[0215] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.

[0216] The electronic device also includes a power supply 330 for supplying power to various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 330 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0217] The electronic device may further include an input module 340, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0218] The electronic device may further include a communication module 350. In some embodiments, the communication module 350 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 350, thereby providing the user with wireless broadband Internet access. For example, the communication module 350 may be used to help the user send and receive emails, browse web pages, and access streaming media.

[0219] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 310 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 320 according to the following instructions, and the processor 310 will run the application programs stored in the memory 320, thereby implementing the steps in the methods of the embodiments of the present invention.

[0220] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0221] From the above, it can be seen that the electronic device provided by the embodiment of the present invention can perform text segmentation on text documents in a specified field to obtain multiple text paragraphs; the positive example paragraphs and the negative example paragraphs can be accurately determined by using the correlation between the target text paragraph and other text paragraphs; then keywords are extracted from the positive example paragraphs, and the target query text is generated using the keywords and the positive example paragraphs, which can ensure that the target query text related to the target text paragraph is generated, and finally the target query text, positive example paragraphs and negative example paragraphs are combined to quickly generate a high-quality text data set for the vectorization model in the specified field.

[0222] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0223] To this end, an embodiment of the present invention provides a computer-readable storage medium, which stores multiple instructions, and the instructions can be loaded by a processor to execute the steps in the text dataset generation method of any vectorization model provided by the embodiment of the present invention.

[0224] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0225] According to one aspect of the present invention, a computer program product or computer program is provided, the computer program product or computer program comprising a computer program / instruction, the computer program / instruction being stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the electronic device executes the method provided in various optional implementations of providing text data set generation in the above-mentioned embodiments.

[0226] Since the instructions stored in the storage medium can execute the steps in the text dataset generation method of any vectorization model provided in the embodiments of the present invention, the beneficial effects that can be achieved by the text dataset generation method of any vectorization model provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0227] The above is a detailed introduction to a method and device for generating a text data set of a vectorized model provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for generating a text dataset of a vectorized model, characterized in that: The method comprises: Perform text segmentation on text documents in a specified field to obtain multiple text paragraphs; For each target text paragraph, calculating the relevance between the target text paragraph and each other text paragraph, and obtaining a plurality of relevances corresponding to the target text paragraph, wherein the target text paragraph is any one of the plurality of text paragraphs; Based on the multiple relevances and a preset relevance threshold, determining a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs, the positive example set including a plurality of positive example paragraphs, and the negative example set including a plurality of negative example paragraphs; Performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set; Combining the keyword set and the target text paragraph, generating a target query text corresponding to the target text paragraph, including: determining a target phrase from the keyword set, the target phrase including a preset number of keywords; generating a target prompt word based on the target phrase and the target text paragraph, the target prompt word including a target number; using the target prompt word to guide the generation of a language model to generate the target number of candidate query texts; performing a rationality test on the target number of candidate query texts, and determining a target query text from the target number of candidate query texts based on the rationality test result; The target query text, the positive example set, and the negative example set corresponding to each target text paragraph are combined to generate a text dataset of a vectorization model in the specified domain.

2. The method according to claim 1, characterized in that For each target text paragraph, calculating the relevance between the target text paragraph and each other text paragraph to obtain multiple relevances corresponding to the target text paragraph includes: Based on the first vectorization model, calculating a first similarity between the target text paragraph and each other text paragraph; Calculating a second similarity between the target text paragraph and each other text paragraph based on a second vectorization model, wherein the first vectorization model and the second vectorization model have different architectures; The first similarity and the second similarity are combined to calculate the relevance between the target text paragraph and each other text paragraph.

3. The method according to claim 2, characterized in that The combining the first similarity and the second similarity to calculate the relevance between the target text paragraph and each other text paragraph includes: Based on the first similarity and a preset sorting rule, the other text paragraphs are sorted to obtain a first paragraph sequence; Based on the second similarity and the preset sorting rule, the other text paragraphs are sorted to obtain a second paragraph sequence; For each other text paragraph, obtain a first ranking of the other text paragraph in the first paragraph sequence, and a second ranking of the other text paragraph in the second paragraph sequence; Based on the first ranking and the second ranking of each other text paragraph, the relevance between the target text paragraph and the other text paragraph is calculated.

4. The method according to claim 1, characterized in that: The preset relevance threshold includes a first threshold and a second threshold, the first threshold is greater than the second threshold, and determining the positive example set and the negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and the preset relevance threshold includes: Determine other text paragraphs whose relevance is greater than the first threshold as positive example paragraphs corresponding to the target text paragraph, and obtain a positive example set corresponding to the target text paragraph; Other text paragraphs whose relevance is less than the second threshold are determined as negative example paragraphs corresponding to the target text paragraph, so as to obtain a negative example set corresponding to the target text paragraph.

5. The method according to claim 1, characterized in that The keyword extraction process is performed on the plurality of positive example paragraphs to obtain a keyword set, including: For each candidate positive example paragraph, segment and clean the candidate positive example paragraph to obtain multiple candidate words, and the candidate positive example paragraph is any one of the multiple positive example paragraphs; For each of the candidate words, calculating the word frequency of the candidate word in the candidate positive example paragraph; For each of the candidate words, calculating the paragraph frequency of the candidate word in the positive example set; Multiplying the word frequency and the paragraph frequency to obtain a key score corresponding to the candidate word; Keywords are extracted from the plurality of positive example paragraphs based on the key scores to obtain a keyword set.

6. The method according to claim 1, characterized in that Determining a target phrase from the keyword set includes: According to the preset number, combining keywords in the keyword set to obtain a plurality of candidate phrases; Get the weight parameters at the current number of iterations; For each candidate word group, calculating the average estimated parameter of the candidate word group at the current number of iterations based on the weight parameter; Calculating, based on the average estimated parameter and the current number of iterations, estimated parameters of the candidate phrase when a target context is given, the target context including information about the target text paragraph and the text document to which the target text paragraph belongs; A target phrase is determined from the plurality of candidate phrases based on the estimated parameters of each candidate phrase.

7. The method according to claim 6, characterized in that After determining the target phrase from the plurality of candidate phrases based on the estimated parameters of each candidate phrase, the method further includes: Based on the scoring model and the scoring prompt words, obtaining the scoring parameters corresponding to the target phrase; If the scoring parameter and the estimated parameter do not meet the preset convergence condition, updating the weight parameter to obtain the weight parameter for the next iteration number; If the scoring parameter and the estimated parameter meet the preset convergence condition, the weight parameter is determined as the target weight parameter, and the target weight parameter is used as the weight parameter for the next iteration.

8. The method according to claim 1, characterized in that The performing a rationality check on the target number of candidate query texts, and determining a target query text from the target number of candidate query texts based on the rationality check result, includes: Based on the candidate query text and the target text paragraph, generating a detection prompt word; Based on the detection prompt word, guiding the detection model to determine whether each of the candidate query texts is related to the target text paragraph, so as to obtain a rationality detection result of each of the candidate query texts; If the rationality detection result of the candidate query text is reasonable, the candidate query text is determined as the target query text.

9. A device for generating a text data set of a vectorized model, used to implement the method according to any one of claims 1 to 8, characterized in that: The device comprises: The segmentation module is used to perform text segmentation processing on text documents in a specified field to obtain multiple text paragraphs; A calculation module, for calculating, for each target text paragraph, a relevance between the target text paragraph and each other text paragraph, and obtaining a plurality of relevances corresponding to the target text paragraph, wherein the target text paragraph is any one of the plurality of text paragraphs; A determination module, configured to determine a positive example set and a negative example set corresponding to the target text paragraph from the other text paragraphs based on the multiple relevances and a preset relevance threshold, wherein the positive example set includes a plurality of positive example paragraphs, and the negative example set includes a plurality of negative example paragraphs; An extraction module, used for performing keyword extraction processing on the plurality of positive example paragraphs to obtain a keyword set; A query generation module, used to combine the keyword set and the target text paragraph to generate a target query text corresponding to the target text paragraph, including: determining a target phrase from the keyword set, the target phrase including a preset number of keywords; generating a target prompt word based on the target phrase and the target text paragraph, the target prompt word including a target number; using the target prompt word to guide the generation of a language model to generate the target number of candidate query texts; performing a rationality test on the target number of candidate query texts, and determining a target query text from the target number of candidate query texts based on the rationality test result; The data set generation module is used to combine the target query text, the positive example set and the negative example set corresponding to each target text paragraph to generate a text data set of the vectorization model in the specified field.