Method and device for constructing corpus

By using large language models to generate similar corpus in the intelligent outbound call platform and constructing a labeled corpus, the problem of lack of high-quality data in the early stage of new model training is solved, and the training efficiency and generalization ability of the model are improved.

CN118569272APending Publication Date: 2024-08-30ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410768227.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the intelligent outbound call platform, there is a lack of high-quality labeled data in the early stages of new model training, making it difficult to improve model performance.

Method used

By matching the similarity between the unlabeled corpus and the target corpus, similar corpus is generated, and a large language model is used to generate corpus with the same category, and a labeled corpus is constructed for intent recognition model training.

Benefits of technology

Quickly generate a large amount of labeled training corpus, improve the training efficiency and generalization ability of the model, and solve the problem of lack of high-quality training data for new models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569272A
    Figure CN118569272A
Patent Text Reader

Abstract

The embodiment of the invention relates to a method and device for constructing a corpus, and the method comprises the steps: obtaining a first corpus which comprises a plurality of non-label corpora, then obtaining a target corpus and a target category label corresponding to the target corpus, carrying out the similarity matching of the target corpus and each corpus in the first corpus, and obtaining a target category label corresponding to the target corpus; and obtaining a plurality of retrieval result corpora with high similarity ranking. Next, according to the target corpus, the target category label and the multiple retrieval result corpora, determining a prompt text; the prompt text indicates the large language model to generate the corpus of the category indicated by the target category label by taking each corpus in the prompt text as an example. And after the prompt text is obtained, inputting the prompt text into the large language model to obtain a plurality of generation result corpora. And finally, according to the plurality of retrieval result corpora, the plurality of generation result corpora and the target category label, constructing a second corpus with a label.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of artificial intelligence, and more particularly, to a method and device for constructing a corpus. Background Art

[0002] Smart outbound calling refers to a method of automating outbound phone calls using artificial intelligence technology. Smart outbound calling robots can automatically initiate outbound phone calls based on actual scenarios, collect call results through voice dialogues between humans and robots, and perform statistical processing on the data. Smart outbound calling can be applied to a variety of scenarios, such as customer service, marketing, research, etc.

[0003] On the intelligent outbound call platform, the choice of robot speech strategy is determined by the intent recognition model. Each intent category is bound to the corresponding speech. By configuring the model into the dialogue process, the intelligent outbound call dialogue question-and-answer capability is realized. The effect of the model greatly affects the call quality and user experience. Therefore, the technical staff of the outbound call platform need to frequently optimize and update the corpus to improve the model performance. The improvement of model performance requires a large amount of high-quality training corpus. In the early stage of training a new model, there is often a lack of high-quality labeled data. Therefore, a method is needed to build a labeled corpus for training the intent recognition model. Summary of the invention

[0004] One or more embodiments of the present specification describe a method and apparatus for constructing a corpus, combining corpus-based retrieval results with generation results based on a large language model, so as to quickly generate a large amount of labeled training corpus in the early stages of training an intent recognition model.

[0005] In a first aspect, a method for constructing a corpus is provided, comprising:

[0006] Obtain a first corpus, which contains multiple unlabeled corpora;

[0007] Obtaining a target corpus and its corresponding target category label, performing similarity matching between the target corpus and each corpus in the first corpus, and obtaining a plurality of search result corpora with top similarity rankings;

[0008] Determine a prompt text according to the target corpus, the target category label and the plurality of search result corpora; the prompt text instructs the large language model to generate corpora of the category indicated by the target category label using each corpus in the prompt text as an example;

[0009] Inputting the prompt text into a large language model to obtain multiple generated result corpora;

[0010] A second corpus with labels is constructed according to the multiple search result corpora, the multiple generated result corpora and the target category labels.

[0011] In a possible implementation, the first corpus contains an embedding vector corresponding to each corpus; and performing similarity matching between the target corpus and each corpus in the first corpus includes:

[0012] Inputting the target corpus into a text encoder to obtain a target embedding vector;

[0013] The target embedding vector is matched with the embedding vector corresponding to each corpus in the first corpus for similarity.

[0014] In a possible implementation, before performing similarity matching between the target corpus and each corpus in the first corpus, the method further includes:

[0015] Multiple corpora in the first corpus are respectively input into a text encoder to obtain an embedding vector corresponding to each corpus.

[0016] In a possible implementation, the similarity includes at least one of the following: cosine similarity, Euclidean distance, and Manhattan distance.

[0017] In a possible implementation, the text encoder includes at least one of the following: a BERT encoder and a Word2Vec encoder.

[0018] In a possible implementation, each corpus in the first corpus also has a corresponding database index.

[0019] In a possible implementation, constructing a labeled second corpus according to the plurality of search result corpora, the plurality of generated result corpora, and the target category labels includes:

[0020] The target category label is added to each of the plurality of search result corpora and the plurality of generated result corpora respectively, so as to construct a second corpus with the label.

[0021] In a possible implementation, constructing a labeled second corpus according to the plurality of search result corpora, the plurality of generated result corpora, and the target category labels includes:

[0022] Adding the target category label to each of the plurality of search result corpora and the plurality of generated result corpora;

[0023] The respective corpora are matched with the target corpus respectively in terms of similarity, and are ranked according to the similarities to construct a second corpus with labels.

[0024] In a possible implementation, after constructing the second corpus with labels, the method further includes:

[0025] Sending the second corpus to a manual screening platform; the manual screening platform is used to manually screen each corpus in the second corpus;

[0026] A third corpus obtained by manually screening the second corpus is received from the manual screening platform.

[0027] In a possible implementation, the target corpus is a real user conversation, and the target category label indicates the user intention; the second corpus is used to train a user intention recognition model.

[0028] In a second aspect, a device for constructing a corpus is provided, comprising:

[0029] An acquisition unit is configured to acquire a first corpus, which includes a plurality of unlabeled corpora;

[0030] A search result determination unit is configured to obtain a target corpus and a target category label corresponding to the target corpus, perform similarity matching between the target corpus and each corpus in the first corpus, and obtain a plurality of search result corpora with top similarity rankings;

[0031] A prompt text determination unit is configured to determine a prompt text according to the target corpus, the target category label and the plurality of search result corpora; the prompt text instructs the large language model to generate corpora of the category indicated by the target category label using each corpus in the prompt text as an example;

[0032] A generation result determination unit is configured to input the prompt text into a large language model to obtain a plurality of generation result corpora;

[0033] The corpus construction unit is configured to construct a labeled second corpus according to the multiple search result corpora, the multiple generated result corpora and the target category label.

[0034] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.

[0035] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.

[0036] The embodiment of this specification proposes a method and device for constructing a corpus, based on a first unlabeled corpus accumulated in past practice, by searching the first corpus for corpora similar to the target corpus to obtain multiple search results. Then, based on the search results, multiple generation results are generated through a large language model to construct multiple corpora of the same category as the target corpus to form a second labeled corpus. In the early stage of training the intent recognition model, a large amount of labeled training corpora can be quickly generated. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the multiple embodiments disclosed in this specification, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only the multiple embodiments disclosed in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 A schematic diagram showing an implementation scenario of a method for constructing a corpus according to an embodiment;

[0039] Figure 2 A flowchart showing a method for constructing a corpus according to one embodiment;

[0040] Figure 3 A schematic block diagram of an apparatus for constructing a corpus according to an embodiment is shown. DETAILED DESCRIPTION

[0041] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0042] As mentioned above, on the intelligent outbound call platform, the choice of robot speech strategy is determined by the intent recognition model. Training the intent recognition model requires a large number of labeled user conversations as training corpus to identify the intent labels of user conversations. For example, when the user conversation is "Sorry, I'm busy", its corresponding label can be "inconvenient" or "reject". After receiving the intent classification result of the intent recognition model for the user's conversation, the outbound call robot can select a sentence from the speech library corresponding to the intent category to reply, for example, it can be "Okay, then I won't bother you for now, goodbye", or it can be "When are you free?" to complete a round of conversation. After hearing the outbound call robot's reply, the user may continue the call, and the outbound call robot can repeat the above process to continue a new round of conversation.

[0043] From the above, it can be seen that correctly identifying the intent of user conversations is particularly important for intelligent outbound call platforms. In the early stages of training a new intent recognition model, there is often a lack of high-quality labeled data. Large Language Models (LLMs) refer to natural language processing models with a large number of parameters. These models are usually based on deep learning technology to process and generate natural language text. Large language models can learn the grammar, vocabulary, and contextual relationships of human natural language, so that they can generate text, understand and answer questions, translate languages, and perform other natural language processing tasks. Using the generation capabilities of large language models, a large amount of training corpus can be quickly generated in the early stages of model training or when the model needs to be updated and iterated to build or update the corpus.

[0044] Figure 1 A schematic diagram of an implementation scenario of a method for constructing a corpus according to an embodiment is shown. Figure 1 In the example, first, an outbound call corpus is obtained. These corpora can be accumulated from past practices. For example, it can be historical corpora from other models and / or real user conversations. Real user conversations themselves are unlabeled; and for building a new model (an intent recognition model in the embodiment of this specification), even if the historical corpora of other models are labeled, their definitions of labels may not necessarily apply to the new model, so these historical corpora are also considered to be unlabeled. Therefore, the outbound call corpus is an unlabeled corpus and cannot be directly used to train the intent recognition model.

[0045] Then, the target corpus and its corresponding target category label are obtained. The embodiment of this specification is used to retrieve and generate corpora similar to the target corpus, and to construct a corpus based on the obtained corpora.

[0046] The target corpus is input into the outbound call corpus for retrieval, and m retrieval result corpora similar to the target corpus text content are obtained. Then, based on the target corpus, the target category label and the multiple retrieval result corpora, a prompt text (Prompt) is constructed, and the prompt text instructs the large language model to use each corpus in the prompt text as an example to generate corpora of the category indicated by the target category label. For example, the prompt text can be: "Please imitate n colloquial sentences intended for [target category] according to the examples given below. These examples are: [target corpus], [retrieval result corpus 1], [retrieval result corpus 2], ... [retrieval result corpus m]. ". Wherein, when used, the content enclosed in square brackets in the prompt text will be replaced by the corresponding actual content. The prompt text is input into the large language model to obtain n generated result corpora generated by the large language model. Finally, based on the m retrieval result corpora and the n generated result corpora, as well as the target category label, a labeled extended corpus is constructed, and the labels of the aforementioned m+n corpora are all target category labels.

[0047] By combining multiple target corpora and target category labels and executing the above process respectively, a large amount of training corpora can be quickly generated. Among them, each target corpus can be pre-set by the technician according to the actual needs of the training model.

[0048] In the large language model, prompt text refers to the input text or question provided by the user or system to the large language model to guide the model to generate the corresponding output. The prompt text can be a short question, a paragraph, or a complete dialogue scene. Its function is to provide the model with initial input information. Its content usually determines the response or output generated by the model. For example, if you input "What is the boiling point of water?", the large language model will generate the response "At standard atmospheric pressure, the boiling point of water is 100 degrees Celsius."

[0049] The specific implementation steps of the above method for constructing a corpus are described below in conjunction with specific embodiments. Figure 2 A flowchart of a method for constructing a corpus according to an embodiment is shown. The execution subject of the method can be any platform or server or device cluster with computing and processing capabilities. Figure 2As shown, the method at least includes: step 202, obtaining a first corpus, which includes multiple unlabeled corpora; step 206, obtaining a target corpus and its corresponding target category label, performing similarity matching between the target corpus and each corpus in the first corpus, and obtaining multiple retrieval result corpora with top similarity rankings; step 208, determining a prompt text based on the target corpus, the target category label and the multiple retrieval result corpora; the prompt text instructs the large language model to generate corpora of the category indicated by the target category label using each corpus in the prompt text as an example; step 210, inputting the prompt text into the large language model to obtain multiple generated result corpora; step 212, constructing a labeled second corpus based on the multiple retrieval result corpora, the multiple generated result corpora and the target category label.

[0050] The specific execution process of each of the above steps is described below.

[0051] First, in step 202, a first corpus is obtained, which includes a plurality of unlabeled corpora.

[0052] The first corpus can be Figure 1 The outbound call corpus in the outbound call corpus can be the corpus accumulated from past practices. For example, it can be the conversations made by users during ordinary live customer service outbound calls in the past; it can also be the historical corpus of other models. For example, "Sorry, I don't have time.", "Please give me the details of this product.", "When will my refund arrive?", etc.

[0053] Next, in step 206, a target corpus and its corresponding target category label are obtained, and the target corpus is matched with each corpus in the first corpus for similarity, so as to obtain a plurality of search result corpora with top similarity rankings.

[0054] The target category label is used to indicate the intent category of the target corpus, which is a refinement and summary of the user's intent in the target corpus. The intent category can be preset by the technician, for example, it can be "inconvenient", "paid", "check balance", etc.

[0055] In one embodiment, the similarity matching in step 206 may be based on the similarity matching between the target corpus and the embedding vectors of each corpus in the first corpus. At this time, the first corpus contains the embedding vectors corresponding to each corpus. Specifically, the similarity matching includes: inputting the target corpus into the text encoder to obtain the target embedding vector; performing similarity matching on the target embedding vector and the embedding vector corresponding to each corpus in the first corpus to obtain a plurality of retrieval result corpora with the highest similarity ranking. For example, the top m corpora may be selected, that is, the m corpora with the closest similarity to the target corpus are retrieved from the first corpus as the retrieval result corpora.

[0056] A variety of text encoders can be used to encode the corpus to obtain an embedding vector. For example, existing text encoders such as BERT encoder (Bidirectional Encoder Representations from Transformers), Word2Vec encoder, etc. can be used. It can also be a model that technicians have trained in advance according to actual needs, which is not limited here.

[0057] There are many methods that can be used to measure the similarity between two embedding vectors, such as cosine similarity, Euclidean distance, Manhattan distance, etc., which are not limited here.

[0058] In other embodiments, other similarity matching methods may be used. For example, the same text between the target corpus and the corpus to be matched in the first corpus may be directly matched, and the more the same text, the higher the similarity.

[0059] When the similarity of the embedded vectors is used as the basis for similarity matching between corpora in step 206, before step 206, the method further includes: step 204, inputting multiple corpora in the first corpus into the text encoder respectively to obtain the embedded vector corresponding to each corpus.

[0060] The text encoder used in step 204 is the same as that in step 206, ensuring that the target embedding vector and the embedding vectors corresponding to each corpus in the first corpus are located in the same representation space, so that similarity matching can be performed.

[0061] In one embodiment, in order to speed up the retrieval and similarity matching in step 206, each corpus in the first corpus also has a corresponding database index. By pre-establishing a database index for each corpus in the first corpus, the speed of retrieval of the corpus in the corpus can be accelerated. In particular, when multiple rounds of retrieval and corpus generation are performed using multiple target corpora, the step 206 corresponding to each round can obtain the acceleration effect of the database index.

[0062] Through the similarity matching in step 206, a part of the corpus can be obtained, which includes multiple search result corpora. However, the corpus obtained by similarity matching may be too similar to the original target corpus, which will lead to insufficient generalization ability of the intent recognition model trained based on these corpora. Therefore, subsequent steps 208 to 210 are required to further generate richer and more diverse corpora to improve the generalization ability of the model.

[0063] Then, in step 208, a prompt text is determined according to the target corpus, the target category label and the multiple search result corpora; the prompt text instructs the large language model to generate corpora of the category indicated by the target category label using each corpus in the prompt text as an example.

[0064] The corresponding prompt text can be designed according to specific needs, as long as it can meet the above requirements. For example, the prompt text can be: "Please imitate n colloquial sentences with the intention of [target category label] based on the examples given below. These examples are: [target corpus], [search result corpus 1], [search result corpus 2], ... [search result corpus m]."; Or, the prompt text can also be:

[0065] "I will first give you several examples of colloquial sentences, as follows:

[0066] **Start the Example**

[0067] [target corpus], [search result corpus 1], [search result corpus 2], ... [search result corpus m].

[0068] **END OF EXAMPLE**

[0069] Based on the above example, please write out n colloquial sentences where the speaker's intention is [target category label]. "

[0070] When using the above prompt text, the content enclosed in square brackets in the prompt text will be replaced by the corresponding actual content.

[0071] By adding the target category label to the prompt text, the search space of the large language model when generating text can be limited to the range indicated by the target category label, which speeds up the generation speed while improving the accuracy of the generated text.

[0072] Next, in step 210, the prompt text is input into a large language model to obtain a plurality of generated result corpora.

[0073] The large language model can use existing models, such as ChatGPT, Tongyi Qianwen, etc.; it can also be a large language model trained and / or fine-tuned by technicians according to actual needs. There is no limitation here.

[0074] For example, in a specific embodiment, the target corpus may be: "Sorry, I'm busy now.", and the corresponding target category label may be "inconvenient". The four search result corpora retrieved from the first corpus are: "Let's talk later, I'm driving.", "What? I'm not free now, I'm in class now.", "Sorry, I don't have time now.", "He's cooking, it's inconvenient to answer the phone.". The number of generated result corpora to be generated is 5.

[0075] Then, the prompt text combined with the corpus and the target category label can be "Please imitate 5 colloquial sentences with the intention of inconvenience based on the examples given below. These examples are: Sorry, I'm busy now. Let's talk later, I'm driving. What? I don't have time now, I'm in class now. Sorry, I don't have time now. He is cooking, it's inconvenient to answer the phone."

[0076] Input the prompt text into the large language model, and get 5 generated result corpora generated by the large language model: "Sorry, I really don't have time now.", "Let's talk later, I have something to do now.", "Sorry, I'm a bit in a hurry now.", "Sorry, it's really not possible now, I'm busy.", "Sorry, I really don't have time now."

[0077] In another specific embodiment, the target corpus may be: "No, I always pay it back in advance.", and the corresponding target category label may be "paid". The four search result corpora retrieved from the first corpus are: "I just paid it back, I just paid it back.", "I have already paid it back, please check it again.", "You must have made a mistake, I paid it back a long time ago.", "I paid it back at 12 o'clock last night."

[0078] Then, the prompt text combined with the corpus and the target category label can be "Please imitate 5 colloquial sentences with the intention of repayment based on the examples given below. These examples are: No, I always pay it back early. I just paid it off. I just paid it off. I have already paid the money back, please check it again. You must have made a mistake, I paid it back a long time ago. I paid it back at 12 o'clock last night."

[0079] Input the prompt text into the large language model, and get 5 generated result corpora generated by the large language model: "Don't make a mistake, I paid it back a long time ago.", "I just paid it back, really.", "I paid it back a long time ago, you can check it again.", "It must be a mistake, I paid it back before.", "I paid it back last night, didn't you receive it?"

[0080] It should be noted that the content related to the number of corpora in the above embodiments is only an example and does not limit the protection scope of the solution.

[0081] Back to Figure 2 Finally, in step 212, a second corpus with labels is constructed according to the multiple search result corpora, the multiple generated result corpora and the target category labels.

[0082] In one embodiment, step 212 specifically includes: adding the target category label to each of the plurality of search result corpora and the plurality of generated result corpora, respectively, to construct a second corpus with labels.

[0083] The target category labels are added to each of the search result corpus and the generated result corpus obtained in the above steps, and a set is formed to construct a second corpus of labels.

[0084] In another embodiment, step 212 specifically includes: adding the target category label to each of the multiple search result corpora and the multiple generated result corpora respectively; performing similarity matching between each of the corpora and the target corpus respectively, and ranking them according to the similarity to construct a second corpus with labels.

[0085] The target category labels are added to each of the search result corpus and the generated result corpus obtained in the above steps, and are sorted according to the similarity to form an ordered sequence for constructing a second corpus of labels.

[0086] Optionally, after forming the ordered sequence, several corpora with the highest similarity rankings may be selected and retained for constructing a second corpus of tags.

[0087] The second corpus can be used to train a user intent recognition model. The user intent recognition model is used to help the outbound call robot recognize the user's intent when speaking in the intelligent outbound call platform, and then to assist the outbound call robot in finding appropriate words from the word library for reply.

[0088] By executing the process shown in step 202 to step 212 multiple times, using different target corpora and their corresponding target category labels as input each time, labeled corpora can be retrieved and generated in batches to construct a second corpus.

[0089] In some possible implementations, after obtaining the second corpus, the method further includes step 214: sending the second corpus to a manual screening platform; the manual screening platform is used to manually screen each corpus in the second corpus; and receiving a third corpus obtained by manual screening of the second corpus from the manual screening platform.

[0090] The second corpus can be sent to relevant technicians, who can manually screen the corpora in the second corpus according to actual needs, retain the corpora that meet the requirements, and obtain the third corpus. Then, the third corpus can be used to train the user intent recognition model.

[0091] In some possible implementations, multiple input corpora customized by technicians and corresponding target category labels can be used instead of the search result corpora in step 206 to directly construct the prompt text according to step 208. Then, the contents shown in steps 210 and 212 are continued to be executed to construct a second corpus with labels.

[0092] By using Figure 2 The method shown is based on the unlabeled first corpus. By combining the two tasks of retrieval and generation, it utilizes the rich generation capabilities of the large language model to simultaneously generate relevant query results and generated content. Traditional information retrieval usually only focuses on returning documents or pages that match the user query. At the same time, the corpus obtained based on similarity matching may be too similar to the original target corpus, resulting in insufficient generalization ability of the trained model. Retrieval generation uses the retrieved content as the basis for generation to generate corpus that better meets user needs, and then combines the retrieval results with the generation results to build a corpus with richer content. It is used to better train the user intent recognition model in the outbound call platform and improve the generalization ability of the model. It provides support and assistance for scenarios where a small amount of unlabeled corpus is used for cold start model training, as well as for updating and iterating existing models.

[0093] According to another embodiment, a device for constructing a corpus is also provided. Figure 3A schematic block diagram of an apparatus for constructing a corpus according to an embodiment is shown, and the apparatus can be deployed in any device, platform or device cluster with computing and processing capabilities. Figure 3 As shown, the device 300 includes:

[0094] The acquisition unit 301 is configured to acquire a first corpus, which includes a plurality of unlabeled corpora;

[0095] The search result determination unit 302 is configured to obtain a target corpus and a target category label corresponding to the target corpus, perform similarity matching between the target corpus and each corpus in the first corpus, and obtain a plurality of search result corpora with top similarity rankings;

[0096] The prompt text determination unit 303 is configured to determine the prompt text according to the target corpus, the target category label and the multiple search result corpora; the prompt text instructs the large language model to generate corpora of the category indicated by the target category label using each corpus in the prompt text as an example;

[0097] A generation result determination unit 304 is configured to input the prompt text into a large language model to obtain a plurality of generation result corpora;

[0098] The corpus construction unit 305 is configured to construct a labeled second corpus according to the multiple search result corpora, the multiple generated result corpora and the target category label.

[0099] According to another aspect of the embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method described in any of the above embodiments.

[0100] According to yet another embodiment, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the above embodiments is implemented.

[0101] Each embodiment in this specification 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 embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0102] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0103] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0104] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0105] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for constructing a corpus, comprising: Obtain a first corpus, which contains multiple unlabeled corpora; Obtaining a target corpus and its corresponding target category label, performing similarity matching between the target corpus and each corpus in the first corpus, and obtaining a plurality of search result corpora with top similarity rankings; Determining a prompt text according to the target corpus, the target category label, and the plurality of search result corpora; The prompt text instructs the large language model to use each corpus in the prompt text as an example to generate corpus of the category indicated by the target category label; Inputting the prompt text into a large language model to obtain multiple generated result corpora; A second corpus with labels is constructed according to the multiple search result corpora, the multiple generated result corpora and the target category labels.

2. The method according to claim 1, wherein: The first corpus contains embedding vectors corresponding to each corpus; The target corpus is matched with each corpus in the first corpus by similarity, including: Inputting the target corpus into a text encoder to obtain a target embedding vector; The target embedding vector is matched with the embedding vector corresponding to each corpus in the first corpus for similarity.

3. The method according to claim 2, before performing similarity matching between the target corpus and each corpus in the first corpus, the method further comprises: Multiple corpora in the first corpus are respectively input into a text encoder to obtain an embedding vector corresponding to each corpus.

4. The method according to claim 2, wherein: The similarity includes at least one of the following: cosine similarity, Euclidean distance, and Manhattan distance.

5. The method according to claim 2 or 3, wherein: The text encoder includes at least one of the following: a BERT encoder and a Word2Vec encoder.

6. The method according to claim 1, wherein: Each corpus in the first corpus also has a corresponding database index.

7. The method according to claim 1, constructing a second corpus with labels according to the plurality of search result corpora, the plurality of generated result corpora and the target category labels, comprising: The target category label is added to each of the plurality of search result corpora and the plurality of generated result corpora respectively, so as to construct a second corpus with the label.

8. The method according to claim 1, constructing a second corpus with labels according to the plurality of search result corpora, the plurality of generated result corpora and the target category labels, comprising: Adding the target category label to each of the plurality of search result corpora and the plurality of generated result corpora; The respective corpora are matched with the target corpus respectively in terms of similarity, and are ranked according to the similarities to construct a second corpus with labels.

9. The method according to claim 1, after constructing the second labeled corpus, the method further comprises: sending the second corpus to a manual screening platform; The manual screening platform is used to manually screen each corpus in the second corpus; A third corpus obtained by manually screening the second corpus is received from the manual screening platform.

10. The method according to claim 1, wherein: The target corpus is a real user conversation, and the target category label indicates the user intention; the second corpus is used to train a user intention recognition model.

11. A device for constructing a corpus, comprising: An acquisition unit is configured to acquire a first corpus, which includes a plurality of unlabeled corpora; A search result determination unit is configured to obtain a target corpus and a target category label corresponding to the target corpus, perform similarity matching between the target corpus and each corpus in the first corpus, and obtain a plurality of search result corpora with top similarity rankings; A prompt text determination unit, configured to determine a prompt text according to the target corpus, the target category label and the plurality of search result corpora; The prompt text instructs the large language model to use each corpus in the prompt text as an example to generate corpus of the category indicated by the target category label; A generation result determination unit is configured to input the prompt text into a large language model to obtain a plurality of generation result corpora; The corpus construction unit is configured to construct a labeled second corpus according to the multiple search result corpora, the multiple generated result corpora and the target category label.

12. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 10.

13. A computing device comprising a memory and a processor, wherein: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Cited By

  • Idea support program and method

    JP2026062366A

  • Idea support program and method

    JP7672120B1