Dataset generation method and apparatus, electronic device, and storage medium

CN116468044BActive Publication Date: 2026-10-09NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310140556.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2026-10-09
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

[0003]通常,RTE任务的数据集需要大量的标注人员进行人工标注,由于标注人员的专业素质高低不一,导致标注数据费时费力,且标注质量不可控,难以快速准确地生成数据集

Benefits of technology

[0015] This application embodiment can acquire a text dataset for a classification task. Utilizing the task type of the classification task, the data labels corresponding to the text data in the text dataset are converted into descriptive data. Then, the target dataset is automatically generated using the descriptive data and the text data. Converting the data labels in the existing text dataset into corresponding descriptive data according to the same logic and combining them with the text data to generate the target dataset ensures dataset accuracy. The entire process requires no manual intervention, fully utilizes the existing text dataset, and saves annotation costs, thereby generating the dataset quickly and accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468044B_ABST
    Figure CN116468044B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a dataset generation method and device, electronic equipment and a storage medium; the method comprises: obtaining a text dataset of a classification task, the text dataset comprising text data and data labels corresponding to the text data; converting the data labels into description data according to the task type of the classification task, the description data being text data describing the data labels and having a corresponding relationship with the text data; and generating a target dataset according to the text data and the description data corresponding to the text data. The data labels in the existing text dataset are converted into corresponding description data according to the same logic, and the description data is combined with the text data to generate a target dataset, which can ensure the accuracy of the dataset, the entire process does not require human intervention, makes full use of the existing text dataset, and can save labeling costs, thereby quickly and accurately generating a dataset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically to dataset generation methods, apparatus, electronic devices, and storage media. Background Technology

[0002] Recognizing Textual Entailment (RTE) is one of the tasks in Natural Language Inference (NLI). Given a pair of sentences, it is necessary to determine whether one sentence can be inferred from the other. If it can, there is a logical relationship between the two sentences, which is called entailment; otherwise, it is not entailment.

[0003] Typically, RTE task datasets require manual annotation by a large number of annotators. Due to the varying levels of expertise among annotators, data annotation is time-consuming and labor-intensive, and the annotation quality is uncontrollable, making it difficult to generate datasets quickly and accurately. Summary of the Invention

[0004] This application provides a dataset generation method, apparatus, electronic device, and storage medium that can generate datasets quickly and accurately.

[0005] This application provides a dataset generation method, including:

[0006] Obtain a text dataset for a classification task, wherein the text dataset includes text data and data labels corresponding to the text data;

[0007] Based on the task type of the classification task, the data tags are converted into descriptive data, which is text data describing the data tags and has a corresponding relationship with the text data;

[0008] A target dataset is generated based on the text data and the corresponding descriptive data.

[0009] This application also provides a dataset generation apparatus, including:

[0010] The acquisition module is used to acquire the text dataset for the classification task. The text dataset includes text data and data labels corresponding to the text data.

[0011] The conversion module is used to convert the data tags into descriptive data according to the task type of the classification task. The descriptive data is text data that describes the data tags and has a corresponding relationship with the text data.

[0012] The generation module is used to generate a target dataset based on the text data and the corresponding descriptive data.

[0013] This application also provides an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute steps in any of the dataset generation methods provided in this application.

[0014] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the dataset generation methods provided in this application.

[0015] This application embodiment can acquire a text dataset for a classification task. Utilizing the task type of the classification task, the data labels corresponding to the text data in the text dataset are converted into descriptive data. Then, the target dataset is automatically generated using the descriptive data and the text data. Converting the data labels in the existing text dataset into corresponding descriptive data according to the same logic and combining them with the text data to generate the target dataset ensures dataset accuracy. The entire process requires no manual intervention, fully utilizes the existing text dataset, and saves annotation costs, thereby generating the dataset quickly and accurately. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a schematic diagram illustrating an application scenario of the dataset generation method provided in the embodiments of this application;

[0018] Figure 2 This is a flowchart illustrating the dataset generation method provided in an embodiment of this application;

[0019] Figure 3 This is a schematic diagram illustrating the mapping relationship between preset types and preset data provided in the embodiments of this application;

[0020] Figure 4 This is a flowchart illustrating a dataset generation method provided in another embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the overall process of the dataset generation method provided in the embodiments of this application;

[0022] Figure 6This is a schematic diagram of the structure of the dataset generation device provided in the embodiments of this application;

[0023] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] This application provides a dataset generation method, apparatus, electronic device, and storage medium.

[0026] Specifically, the dataset generation device can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet, smart Bluetooth device, laptop, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.

[0027] In some embodiments, the dataset generation device may also be integrated into multiple electronic devices, such as multiple servers, with multiple servers implementing the dataset generation method of this application.

[0028] In some embodiments, the server may also be implemented as a terminal.

[0029] For example, refer to Figure 1This diagram illustrates an application scenario of the dataset generation method provided in this embodiment. The scenario may include a terminal device 1000, a server 2000, a database 3000, and a network 4000. The user's terminal 1000 can connect to the server 2000 via the network 4000. The terminal device 1000 can be any device with computing hardware capable of supporting and executing software products for generating datasets. The server 2000 can be a single server or a server cluster. The network 4000 can be a wireless network or a wired network, such as a wireless local area network (WLAN), local area network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Furthermore, different terminal devices 1000 can connect to other terminals or the server 2000 using their own Bluetooth networks or hotspot networks. The database 3000 stores the data generated when the user uses the terminal device 1000 to generate the dataset.

[0030] When executing the dataset generation method, the terminal device 1000 can obtain a text dataset for a classification task, the text dataset including text data and data labels corresponding to the text data; according to the task type of the classification task, the data labels are converted into descriptive data, the descriptive data being text data describing the data labels and having a corresponding relationship with the text data; and a target dataset is generated based on the text data and the descriptive data corresponding to the text data.

[0031] By utilizing existing text datasets for classification tasks, which include text data and pre-labeled data, the data labels are converted into descriptive text data based on the task type of the classification task, thus obtaining descriptive data. Then, using the descriptive data and the text data in the text dataset, the target dataset is generated, which can generate the dataset quickly and accurately.

[0032] It's important to note that machine learning refers to the process where computers are trained to create models by inputting large amounts of data. These models learn patterns in the data and then use this knowledge to classify or predict new input data. The large amount of data used for training the models is called a dataset, and different datasets are used for different machine learning tasks.

[0033] Data sets for RTE tasks are not naturally occurring; they often need to be obtained from news and encyclopedia data, and then processed and labeled by a large number of professionals to obtain the dataset. Manual labeling is costly and inefficient, and the standards for labeling by different professionals are difficult to standardize, leading to uncontrollable dataset quality and making it difficult to generate datasets quickly and accurately. Therefore, to save data labeling costs and improve dataset quality, the method provided in this application embodiment can be used to quickly and accurately generate datasets, which will be described in detail below.

[0034] In this embodiment, a dataset generation method is provided, such as... Figure 2 As shown, the specific process of this dataset generation method can be as follows:

[0035] S110. Obtain the text dataset for the classification task, wherein the text dataset includes text data and data labels corresponding to the text data.

[0036] A classification task is the process by which a computer maps text containing information to one or more pre-defined categories. Depending on the pre-defined categories, classification tasks can be categorized in various ways. For example, if the pre-defined categories are relationships between entities, the classification task can be a relation extraction task. Or, if the pre-defined categories are the emotions expressed in the text, the classification task can be a sentiment classification task.

[0037] A text dataset for a classification task refers to the data set used to train a neural network model so that the trained model can perform the classification task. Supervised training, also known as supervised learning, is a common method for training neural network models. This training method allows the computer to learn or build a pattern from the training data and infer new instances based on this pattern. The training data consists of basic data and expected data. The basic data can be the text data in the text dataset, while the expected data can be the data label corresponding to each text data.

[0038] A text dataset can include multiple text data points, each with its own label. The text datasets for different classification tasks are different. In other words, a text dataset for a classification task refers to a pre-labeled dataset used for training the classification task, which can be obtained from publicly available databases.

[0039] S120. Based on the task type of the classification task, the data tags are converted into descriptive data, where the descriptive data is text data describing the data tags and has a corresponding relationship with the text data.

[0040] The classification tasks can include sentiment classification, relation extraction, product evaluation, and film / television evaluation. Sentiment classification involves identifying the sentiment contained in text data; relation extraction involves identifying the relationships between entities in text data; product evaluation involves classifying products; and film / television evaluation involves classifying films / television works.

[0041] The meaning of data labels in text datasets differs depending on the task type of classification. For example, in relation extraction classification tasks, data labels in text datasets typically represent relations, while in sentiment classification tasks, data labels in text datasets typically represent sentiment.

[0042] Descriptive data refers to text data used to describe data labels. Depending on the task type of the classification task, data labels can be converted into descriptive data. For example, in a sentiment classification task, the data labels in the text dataset could be positive or negative. Since it is a sentiment classification task, the data labels represent the sentiment implied by the corresponding text data, so "positive" can be converted to "this sentence expresses a positive sentiment." As another example, in a relation extraction classification task, the data labels in the text dataset could be interpersonal relationships, such as father and son. Since it is a relation extraction classification task, "father and son" can be converted to "the people in this sentence are in a father-son relationship."

[0043] It should be noted that there is a correspondence between text data and data tags. Since descriptive data is converted from data tags, there is a correspondence between data tags and descriptive data. Therefore, there is also a correspondence between descriptive data and text data.

[0044] In some implementations, when converting data tags into descriptive data based on the task type of the classification task, the tag type of the data tags may be determined according to the task type of the classification task; the preset data corresponding to the tag type may be determined as reference data according to the mapping relationship between preset types and preset data, wherein the preset types include the tag types; and the data tags may be converted into descriptive data based on the reference data.

[0045] As mentioned earlier, the meanings of data labels in text datasets differ for classification tasks of different types, while the meanings of data labels in text datasets are the same for classification tasks of the same type. In some implementations, the label type of the data labels can be determined based on the task type of the classification task, whereby the label type can be used to represent the type of data labels.

[0046] For example, in a classification task involving relationship extraction, the label types corresponding to the data labels can include relationships between people, relationships between people and positions, and relationships between people and organizations. Similarly, in a classification task involving sentiment, the label types corresponding to the data labels can include positive and negative categories.

[0047] One implementation method is to determine the tag type of the data tags based on keyword matching. For example, a correspondence can be established between preset task types and preset keywords, where the preset task types include task types. Based on this correspondence, the preset keywords corresponding to the task types can be determined as target keywords. Then, it is determined whether the data tags include the target keyword. If the target keyword is included, it can be determined as the tag type corresponding to the target keyword.

[0048] The target keyword can be a single word or multiple words, and can be set according to actual needs. For example, the target keyword can be a job title, such as CEO, Chairman, Manager, etc., and its corresponding tag type is the relationship between people and positions. If any target keyword is included in the data tag, then the tag type corresponding to the data tag can be determined to be the relationship between people and positions.

[0049] The mapping relationship between preset types and preset data can be pre-established. Preset types can include tag types. After obtaining the tag type of a data tag, the preset data corresponding to the tag type can be determined as reference data based on the mapping relationship between preset types and preset data. Reference data refers to the data that needs to be referenced when converting data tags into descriptive data. Using reference data, data tags can be converted into descriptive data.

[0050] In some implementations, before determining the preset data corresponding to a label type as reference data based on the mapping relationship between preset types and preset data, a mapping relationship between preset types and preset data can be established. As one implementation, establishing the mapping relationship between preset types and preset data can involve obtaining the types of preset data labels corresponding to all preset text data in a preset text dataset for all preset classification tasks, thus obtaining a preset type; based on the preset data labels of the preset type, generating preset data corresponding to the preset type, thereby obtaining the mapping relationship between the preset type and the preset data.

[0051] The preset text dataset for the preset classification task has the same meaning as the text dataset for the aforementioned classification task, except that the preset text dataset for the preset classification task is a dataset used to create a mapping relationship between preset types and preset data. Of course, in some implementations, the preset text dataset can be the same as the text dataset.

[0052] The preset text dataset for a preset classification task may include preset text data and preset data labels corresponding to the preset text data. When establishing the mapping relationship between preset types and preset data, the preset type can be determined. For example, the preset type can be obtained by obtaining the types of preset data labels corresponding to all preset text data in the preset text dataset for the preset classification task.

[0053] Then, based on the preset data tags of the preset type, preset data corresponding to the preset type is generated. The preset data may include first preset data and second preset data. When generating the preset data corresponding to the preset type, a specific object and a generic object may be determined from the preset data tags. The first preset data corresponding to the preset type is generated by combining the specific object and the preset type. The second preset data corresponding to the preset type is generated by combining the generic object and the preset type.

[0054] In this context, a specific object refers to a concrete, particular object. For example, "Xiaoming" specifically refers to an object named "Xiaoming," while "lawyer" refers to a specific job title. A generic object refers to a general, indefinite object. For example, "organization" is a general, indefinite object, while "person" is an indefinite object that cannot be identified by referring to either "organization" or "person."

[0055] In some implementations, a neural network model can be pre-trained to obtain an object recognition model that can identify specific and generic objects in the input text. Thus, the specific and generic objects can be obtained using the object recognition model.

[0056] After identifying the specific object from the preset data tags, the specific object and the preset type can be combined to generate the first preset data of the preset type. For example, if the preset type of the preset data tags is the relationship type between people and positions, and if the preset data tags contain a specific object, then the meaning that the preset data tags intend to represent is the position of the specific object, and thus the first preset data can be generated. The generated first preset data carries the specific object.

[0057] The generic object is determined from the preset data tags. That is, when a specific object cannot be determined based on the preset data tags, the generic object and the preset type can be combined to generate a second preset data corresponding to the preset type. For example, if the preset type of the preset data tags is a positive emotion, and the preset data tags contain a generic object, then the specific object cannot be determined based on the preset data tags. It can be assumed that the meaning intended by the preset data tags is that the emotion expressed by the preset text data is positive, and thus a second preset data can be generated.

[0058] In some implementations, the mapping relationship between preset types and preset data can be established manually. Since the preset types in the preset text dataset of the preset classification task are limited, manually establishing the mapping relationship between preset types and preset data requires less work, is reusable, and can also improve the efficiency of dataset generation.

[0059] In some implementations, the preset type may correspond only to the second preset data or the first preset data; the specific setting can be determined according to actual needs and is not specifically limited here. Following the above method, a mapping relationship between preset types and preset data can be established. For example, see [reference needed]. Figure 3 This diagram illustrates the mapping relationship between preset types and preset data. Specifically, Per: title represents the relationship type between a person and a position; Org: member of represents the relationship type between a person and an organization; No relation represents a no-relationship type; Positive represents a positive type; Negative represents a negative type; 5 stars represents an excellent type; and 4 stars represents a good type.

[0060] In some implementations, each preset type can be associated with a task type. For example, the preset types for a classification task of the relationship extraction type could include relationships between people and positions, relationships between people and organizations, and no relationship. The preset types for a classification task of the emotion classification type could include positive and negative types. The preset types for a classification task of the film and television evaluation type could include excellent and good types.

[0061] For example, Figure 3 In the text, when the tag type is Per:title, its first preset data is "B is the jobtitle of A", where A indicates Per and B indicates title; its second preset data is "This sentence indicates the job title of the person".

[0062] After obtaining the tag type corresponding to the data tag, the preset data corresponding to the tag type can be directly determined as the reference data based on the mapping relationship between preset types and preset data. Since the preset data includes first preset data and second preset data, the reference data can also correspondingly include first reference data and second reference data. That is, the first preset data can be determined as the first reference data, and the second preset data can be determined as the second reference data.

[0063] When converting data tags into descriptive data based on reference data, the specific object can be determined from the data tags; if the specific object is not a preset object, and the text data corresponding to the data tag contains the specific object in the data tag, the specific object in the first reference data is replaced with the specific object in the data tag to obtain the descriptive data; if the specific object is a preset object, or the text data corresponding to the data tag does not contain the specific object in the data tag, the second reference data is determined as the descriptive data.

[0064] After obtaining the first reference data and the second reference data, a specific object can be determined from the data tags. In some implementations, if a specific object exists in the data tags, it can be directly determined; if no specific object exists in the data tags, the specific object can be determined as a preset object. The preset object can be any pre-set character used to indicate that no specific object exists in the data tags.

[0065] For example, if the data label is "Tim, CEO", where "Tim" and "CEO" are both specific objects, then the specific objects identified from this data label are "Tim" and "CEO". As another example, if the data label is "Positive" and the default object is null, where "Positive" is not a specific object, then the specific object in this data label can be directly determined as null.

[0066] In some implementations, the object recognition model trained as described above can be used to determine a specific object from the data tags. If the output of the object recognition model indicates that there is no specific object in the data tags, then the specific object of the data tag can be determined as a preset object.

[0067] If the specific object is not a preset object, it indicates that a specific object exists in the data label; if the specific object is a preset object, it indicates that a specific object does not exist in the data label. If the specific object is not a preset object, and the text data corresponding to the data label contains the specific object in the data label, then the specific object in the first reference data is replaced with the specific object in the data label to obtain the description data.

[0068] For example, if the first reference data is "B is the job title of A", where B refers to a position and A refers to a person, and the data label is "Tim, CEO", where Tim indicates a person and CEO indicates a position, then replace A in the first reference data with Tim and replace B in the first reference data with CEO to obtain the final descriptive data "CEO is the job title of Tim".

[0069] If the specific object is a predefined object, or if the text data corresponding to the data tag does not contain the specific object in the data tag, then the second reference data can be directly used as the descriptive data. Since the text data does not contain the specific object in the data tag, the meaning represented by the data tag is considered to be general, and the second reference data can be directly determined as the descriptive data. For example, if the data tag is "No relation" and the second reference data is "This sentence doesn't include a specific relationship," since the data tag does not contain a specific object, then "This sentence doesn't include a specific relationship" can be determined as the descriptive data.

[0070] In some implementations, when the specific object is a preset object, only the second reference data can be used as the description data; when the specific object is not a preset object, both the first reference data and the second reference data can be used as the description data.

[0071] In some implementations, if the reference data only includes the second reference data, then it is not necessary to determine the specific object from the label data, and the second reference data can be directly used as the description data.

[0072] S130. Generate a target dataset based on the text data and the corresponding descriptive data.

[0073] After converting the data labels corresponding to the text data into descriptive data, the target dataset can be generated based on the text data and the descriptive data corresponding to the text data.

[0074] In some implementations, the text data and the corresponding descriptive data can be combined to obtain the first target data; the first text data and the descriptive data corresponding to the second text data can be combined to obtain the second target data, wherein the second text data and the first text data are different text data in the text dataset; and the target dataset is generated based on the first target data, the second target data, and the specified label.

[0075] Data labels are derived from text data, while descriptive data can be used to describe data labels. Therefore, descriptive data is another way of representing data labels, and thus, descriptive data can be inferred from text data. In other words, the logical relationship between text data and its corresponding descriptive data is one of implication.

[0076] Implication is a logical relationship where, given a pair of sentences, if one sentence can be derived from the other, then the logical relationship between the two sentences is implication; if one sentence cannot be derived from the other, then the logical relationship between the two sentences is non-implication.

[0077] By combining the text data and its corresponding descriptive data, the first target data can be obtained. The first target data consists of two sentences with an implicit logical relationship. For example, if the text data is "Tim is the CEO of Apple" and the data label is "Tim, CEO", the corresponding descriptive data is "CEO is the job title of Tim", and the first target data is the combination of "Tim is the CEO of Apple" and "CEO is the job title of Tim".

[0078] In some implementations, if there is more than one descriptive data corresponding to the text data, the text data can be combined with each of its corresponding descriptive data to obtain the corresponding first target data. For example, in the previous example, if the text data is "Tim is the CEO of Apple," and the corresponding descriptive data includes "This sentence indicates the job title of the person," then the first target data can also be a combination of "Tim is the CEO of Apple" and "This sentence indicates the job title of the person."

[0079] There is usually no implicit relationship between different text data; therefore, there is also no implicit relationship between the text data and the descriptive data corresponding to other text data. The first text data and the second text data are different text data in the text dataset.

[0080] For example, the first text data is "Tim is the CEO of Apple," and its corresponding descriptive data is "CEO is the job title of Tim." The second text data is "Bob is an Apple lawyer," and its corresponding descriptive data is "lawyer is the job title of Bob." Clearly, "lawyer is the job title of Bob" cannot be derived from "Tim is the CEO of Apple." Therefore, the descriptive data corresponding to the first and second text data can be combined to obtain the second target data. The logical relationship between the sentences in the second target data is non-implication.

[0081] In some implementations, when combining the description data corresponding to the first text data and the second text data, the first text data may be determined from the text dataset, and the text data in the text dataset other than the first text data may be determined as the second text data; the first text data may be combined with the description data corresponding to each of the second text data to obtain the second target data.

[0082] In this context, the first text data can be any text data in the text dataset, and the text data in the text dataset other than the first text data is designated as the second text data. For example, if there are a total of 5 text data in the text dataset, namely "x1, x2, x3, x4, x5", and if x1 is determined as the first text data, then x2, x3, x4, and x5 are all the second text data.

[0083] Then, the first text data is combined with the description data corresponding to each second text data to obtain the second target data. As in the previous example, there are 4 second text data, and their corresponding description data are "x2', x3', x4', x5'". Then x1 and x2' are combined into one second target data, and x1 and x3' are combined into another second target data, resulting in 4 second target data.

[0084] In some implementations, each piece of text data can be used as the first piece of text data to generate the corresponding second target data.

[0085] After generating the first target data and the second target data, specified labels can be set for the first target data and the second target data to generate a target dataset. In some embodiments, generating the target dataset based on the first target data and the second target data may involve obtaining specified labels, which include a first specified label and a second specified label. The first specified label is used to indicate that there is an implication relationship between the text data and the description data, and the second specified label is used to indicate that there is a non-implication relationship between the text data and the description data. The first specified label is used as the data label for the first target data to obtain positive example data; the second specified label is used as the data label for the second target data to obtain negative example data; and the positive example data and the negative example data are merged to obtain the target dataset.

[0086] The specified label refers to the pre-defined data label. The specified label may include a first specified label and a second specified label. The first specified label is used to indicate that the text data and the description data have an implication relationship, and the second specified label is used to indicate that the text data and the description data have a non-implication relationship.

[0087] Thus, the first specified label can be used as the data label for the first target data to obtain positive example data, and the second specified label can be used as the data label for the second target data to obtain negative example data. Here, positive example data refers to two data sets with an implication relationship, and negative example data refers to two data sets with a non-implication relationship.

[0088] By merging the obtained positive and negative data, we can obtain the target dataset, which is the dataset corresponding to the RTE task.

[0089] The dataset generation scheme provided in this application can be applied to various dataset generation scenarios. For example, taking the generation of a dataset for an RTE task as an example, the scheme provided in this application can convert the data labels in the text dataset into descriptive data based on the already labeled text dataset for a classification task, and then automatically generate the target dataset using the text data and the corresponding descriptive data.

[0090] The method provided in this application can obtain a text dataset for a classification task. Utilizing the task type of the classification task, the data labels corresponding to the text data in the text dataset are converted into descriptive data. Then, the target dataset is automatically generated using the descriptive data and the text data. Converting the data labels in the existing text dataset into corresponding descriptive data according to the same logic and combining them with the text data to generate the target dataset ensures dataset accuracy. The entire process requires no manual intervention, fully utilizes the existing text dataset, and saves annotation costs, thereby generating the dataset quickly and accurately.

[0091] The method described in the above embodiments will be further described in detail below.

[0092] In this embodiment, the method of this application embodiment will be described in detail using the target dataset as the dataset of the RTE task as an example.

[0093] like Figure 4 As shown, the specific process of a dataset generation method is as follows:

[0094] S210. Obtain the text dataset for the classification task, wherein the text dataset includes text data and data labels corresponding to the text data.

[0095] S220. Determine the label type of the data labels based on the task type of the classification task.

[0096] S230. Based on the mapping relationship between preset types and preset data, the preset data corresponding to the tag type is determined as reference data, wherein the preset type includes the tag type.

[0097] S240. Based on the reference data, convert the data tags into descriptive data.

[0098] S250. Generate a dataset for the RTE task based on the text data and the description data corresponding to the text data.

[0099] The above S210 to S250 can be referred to the description of the corresponding parts in the foregoing embodiments, and can also be referred to... Figure 5 The diagram illustrates the overall process of the dataset generation method.

[0100] First, we can obtain the text dataset for the classification task. These text datasets are pre-labeled, meaning they include text data and corresponding data labels. Furthermore, we can pre-establish a mapping relationship between preset types and preset data for later use.

[0101] After obtaining the text data and the corresponding data tags, the tag type for each data tag can be determined. Then, based on the mapping relationship between the preset type and the preset data, the preset data corresponding to the tag type can be determined as the reference data.

[0102] Then, if the data label contains a specific object, it is determined whether the corresponding text data includes that specific object; if the text data includes the specific object, description data is generated based on the first reference data; if the text data does not include the specific object, the second reference data is directly used as the description data.

[0103] Then, the text data and its corresponding descriptive data are combined to obtain the first target data, and the data label of the first target data is set as the first specified label to obtain the positive example data. For example, the first specified label could be "Entailment".

[0104] Then, the text data and the descriptions corresponding to other text data are combined to obtain the second target data, and the data label of the second target data is set as the second specified label to obtain the negative example data. For example, the second specified label can be "not Entailment".

[0105] The positive and negative examples are then merged to obtain the dataset for the RTE task.

[0106] As can be seen from the above, the dataset generation method provided in this application embodiment can generate an RTE dataset based on a text dataset belonging to a classification task that has already been annotated, without manual annotation. Compared with the method of manually annotating a large amount of unstructured text data, the dataset generation method provided in this application embodiment can make full use of existing annotated data, quickly and accurately generate an RTE dataset, greatly enrich the amount of training data for the RTE task, and save annotation costs.

[0107] To better implement the above methods, this application also provides a dataset generation device, which can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer; the server can be a single server or a server cluster composed of multiple servers.

[0108] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the dataset generation device specifically integrated into the terminal as an example.

[0109] For example, such as Figure 6 As shown, the dataset generation device 300 may include an acquisition module 310, a conversion module 320, and a generation module 330.

[0110] The acquisition module 310 is used to acquire a text dataset for a classification task. The text dataset includes text data and data labels corresponding to the text data.

[0111] The conversion module 320 is used to convert the data tags into descriptive data according to the task type of the classification task. The descriptive data is text data that describes the data tags and has a corresponding relationship with the text data.

[0112] The generation module 330 is used to generate a target dataset based on the text data and the description data corresponding to the text data.

[0113] In some embodiments, the conversion module 320 further includes:

[0114] The tag type determination unit is used to determine the tag type of the data tag based on the task type of the classification task;

[0115] A reference determination unit is used to determine the preset data corresponding to the tag type as reference data according to the mapping relationship between the preset type and the preset data, wherein the preset type includes the tag type;

[0116] A conversion unit is used to convert the data tags into descriptive data based on the reference data.

[0117] In some embodiments, the dataset generation apparatus 300 further includes an establishment module, wherein the preset data includes first preset data and second preset data. Before determining the preset data corresponding to the tag type as reference data according to the mapping relationship between the preset type and the preset data, the establishment module is further configured to:

[0118] To obtain the preset type, find the types of preset data labels corresponding to all preset text data in the preset text dataset for the preset classification task.

[0119] Based on the preset data tags of the preset type, preset data corresponding to the preset type is generated, and the mapping relationship between the preset type and the preset data is obtained.

[0120] In some embodiments, the establishment module is further configured to:

[0121] Determine the specific object and the generic object from the preset data tags;

[0122] By combining the specific object and the preset type, the first preset data corresponding to the preset type is generated;

[0123] By combining the generic object and the preset type, a second preset data corresponding to the preset type is generated.

[0124] In some embodiments, the reference data includes first reference data and second reference data, and the conversion unit is further configured to:

[0125] The specific object is determined from the data tags;

[0126] If the specific object is not a preset object, and the text data corresponding to the data tag contains the specific object in the data tag, then the specific object in the first reference data is replaced with the specific object in the data tag to obtain the description data;

[0127] If the specific object is a preset object, or if the text data corresponding to the data tag does not contain the specific object in the data tag, the second reference data will be determined as the description data.

[0128] In some embodiments, the generation module further includes:

[0129] The first combining unit is used to combine the text data and the description data corresponding to the text data to obtain the first target data;

[0130] The second combination unit is used to combine the description data corresponding to the first text data and the second text data to obtain the second target data, wherein the second text data and the first text data are different text data in the text dataset;

[0131] The generation unit is configured to generate the target dataset based on the first target data, the second target data, and the specified label.

[0132] In some embodiments, the second combining unit is further configured to:

[0133] First text data is determined from the text dataset, and the text data in the text dataset other than the first text data is determined as second text data;

[0134] The first text data is combined with the description data corresponding to each of the second text data to obtain the second target data.

[0135] In some embodiments, the generating unit is further configured to:

[0136] Obtain a specified tag, the specified tag including a first specified tag and a second specified tag, the first specified tag is used to indicate that there is an implication relationship between the text data and the description data, and the second specified tag is used to indicate that there is a non-implication relationship between the text data and the description data;

[0137] Using the first specified label as the data label for the first target data, positive example data is obtained;

[0138] Using the second specified label as the data label for the second target data, negative example data is obtained;

[0139] The positive and negative examples are merged to obtain the target dataset.

[0140] In practice, each of the above modules or units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above modules or units, please refer to the previous method embodiments, which will not be repeated here.

[0141] As can be seen from the above, the dataset generation device in this embodiment can acquire a text dataset for a classification task, convert the data labels corresponding to the text data in the text dataset into descriptive data using the task type of the classification task, and then automatically generate the target dataset using the descriptive data and the text data. Converting the data labels in the existing text dataset into corresponding descriptive data according to the same logic and combining them with the text data to generate the target dataset ensures dataset accuracy. The entire process requires no manual intervention, makes full use of the existing text dataset, and saves annotation costs, thereby generating the dataset quickly and accurately.

[0142] Accordingly, this application also provides an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer, personal digital assistant (PDA) and other terminal devices.

[0143] like Figure 7 As shown, Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 400 includes a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 and the memory 402 are electrically connected. Those skilled in the art will understand that 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, or combine certain components, or have different component arrangements.

[0144] The processor 401 is the control center of the electronic device 400. It connects various parts of the electronic device 400 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, it performs various functions of the electronic device 400 and processes data, thereby monitoring the electronic device 400 as a whole.

[0145] In this embodiment, the processor 401 in the electronic device 400 loads the instructions corresponding to the processes of one or more applications into the memory 402 according to the following steps, and the processor 401 runs the applications stored in the memory 402 to realize various functions:

[0146] Obtain a text dataset for a classification task, the text dataset including text data and data labels corresponding to the text data; according to the task type of the classification task, convert the data labels into descriptive data, the descriptive data being text data describing the data labels and having a corresponding relationship with the text data; generate a target dataset based on the text data and the descriptive data corresponding to the text data.

[0147] Converting data labels from existing text datasets into corresponding descriptive data using the same logic, and then combining them with text data to generate the target dataset, ensures dataset accuracy. The entire process requires no manual intervention, makes full use of existing text datasets, and saves annotation costs, thus generating datasets quickly and accurately.

[0148] Based on the task type of the classification task, determine the tag type of the data tag; based on the mapping relationship between preset types and preset data, determine the preset data corresponding to the tag type as reference data, wherein the preset type includes the tag type; based on the reference data, convert the data tag into descriptive data.

[0149] Based on the mapping relationship between preset types and preset data, data labels can be converted into descriptive data based on the same standard, so as to quickly generate datasets in the future.

[0150] Obtain the types of preset data labels corresponding to all preset text data in the preset text dataset of the preset classification task, and obtain the preset type; based on the preset data labels of the preset type, generate the preset data corresponding to the preset type, and obtain the mapping relationship between the preset type and the preset data.

[0151] Determine specific objects and generic objects from the preset data tags; combine the specific objects and the preset types to generate the first preset data corresponding to the preset types; combine the generic objects and the preset types to generate the second preset data corresponding to the preset types.

[0152] By utilizing specific and generic objects in data tags, at least one preset data corresponding to the same preset type can be generated, which can ensure the accuracy of subsequent conversion of data tags into descriptive data, thereby improving the accuracy of the generated dataset.

[0153] The specific object is determined from the data tags; if the specific object is not a preset object, and the text data corresponding to the data tag contains the specific object in the data tag, the specific object in the first reference data is replaced with the specific object in the data tag to obtain the description data; if the specific object is a preset object, or the text data corresponding to the data tag does not contain the specific object in the data tag, the second reference data is determined as the description data.

[0154] By combining the inclusion relationship between specific objects in the text data and data labels with reference data, data labels can be more accurately converted into descriptive data.

[0155] The text data and its corresponding descriptive data are combined to obtain first target data; the first text data and the descriptive data corresponding to second text data are combined to obtain second target data, wherein the second text data and the first text data are different text data in the text dataset; the target dataset is generated based on the first target data, the second target data, and a specified label.

[0156] First text data is determined from the text dataset, and second text data is determined from the text dataset other than the first text data. The first text data is combined with the description data corresponding to each second text data to obtain the second target data.

[0157] Obtain specified labels, including a first specified label and a second specified label. The first specified label indicates an implicit relationship between the text data and the description data, and the second specified label indicates a non-implicit relationship between the text data and the description data. Use the first specified label as the data label for the first target data to obtain positive example data. Use the second specified label as the data label for the second target data to obtain negative example data. Merge the positive example data and the negative example data to obtain the target dataset.

[0158] By simply merging data and automatically assigning specific labels to the merged data, the target dataset can be generated quickly and accurately.

[0159] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0160] Optional, such as Figure 7As shown, the electronic device 400 also includes: a touch display screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch display screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407. Those skilled in the art will understand that... Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0161] The touch display screen 403 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 403 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 401. It can also receive and execute commands from the processor 401. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 401 to determine the type of touch event. Subsequently, the processor 401 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 403 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 403 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 403 can also be used as part of the input unit 406 to achieve input functions.

[0162] The radio frequency circuit 404 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.

[0163] Audio circuit 405 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuit 405 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 405, converted back into audio data, and then processed by processor 401 before being transmitted via radio frequency circuit 404 to, for example, another electronic device, or output to memory 402 for further processing. Audio circuit 405 may also include an earphone jack to provide communication between peripheral headphones and electronic devices.

[0164] The input unit 406 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0165] Power supply 407 is used to supply power to various components of electronic device 400. Optionally, power supply 407 can be logically connected to processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 407 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0166] although Figure 7 As not shown in the diagram, the electronic device 400 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0167] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0168] As can be seen from the above, the electronic device provided in this embodiment can acquire text datasets for classification tasks. Utilizing the task type of the classification task, it converts the data labels corresponding to the text data in the text dataset into descriptive data, and then automatically generates the target dataset using the descriptive data and text data. Converting the data labels in the existing text dataset into corresponding descriptive data according to the same logic, and combining them with the text data to generate the target dataset, ensures dataset accuracy. The entire process requires no manual intervention, fully utilizes the existing text dataset, and saves annotation costs, thereby generating the dataset quickly and accurately.

[0169] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0170] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute the steps in any of the dataset generation methods provided in embodiments of this application. For example, the computer program can execute the following steps:

[0171] Obtain a text dataset for a classification task, the text dataset including text data and data labels corresponding to the text data; according to the task type of the classification task, convert the data labels into descriptive data, the descriptive data being text data describing the data labels and having a corresponding relationship with the text data; generate a target dataset based on the text data and the descriptive data corresponding to the text data.

[0172] Converting data labels from existing text datasets into corresponding descriptive data using the same logic, and then combining them with text data to generate the target dataset, ensures dataset accuracy. The entire process requires no manual intervention, makes full use of existing text datasets, and saves annotation costs, thus generating datasets quickly and accurately.

[0173] Based on the task type of the classification task, determine the tag type of the data tag; based on the mapping relationship between preset types and preset data, determine the preset data corresponding to the tag type as reference data, wherein the preset type includes the tag type; based on the reference data, convert the data tag into descriptive data.

[0174] Based on the mapping relationship between preset types and preset data, data labels can be converted into descriptive data based on the same standard, so as to quickly generate datasets in the future.

[0175] Obtain the types of preset data labels corresponding to all preset text data in the preset text dataset of the preset classification task, and obtain the preset type; based on the preset data labels of the preset type, generate the preset data corresponding to the preset type, and obtain the mapping relationship between the preset type and the preset data.

[0176] Determine specific objects and generic objects from the preset data tags; combine the specific objects and the preset types to generate the first preset data corresponding to the preset types; combine the generic objects and the preset types to generate the second preset data corresponding to the preset types.

[0177] By utilizing specific and generic objects in data tags, at least one preset data corresponding to the same preset type can be generated, which can ensure the accuracy of subsequent conversion of data tags into descriptive data, thereby improving the accuracy of the generated dataset.

[0178] The specific object is determined from the data tags; if the specific object is not a preset object, and the text data corresponding to the data tag contains the specific object in the data tag, the specific object in the first reference data is replaced with the specific object in the data tag to obtain the description data; if the specific object is a preset object, or the text data corresponding to the data tag does not contain the specific object in the data tag, the second reference data is determined as the description data.

[0179] By combining the inclusion relationship between specific objects in the text data and data labels with reference data, data labels can be more accurately converted into descriptive data.

[0180] The text data and its corresponding descriptive data are combined to obtain first target data; the first text data and the descriptive data corresponding to second text data are combined to obtain second target data, wherein the second text data and the first text data are different text data in the text dataset; the target dataset is generated based on the first target data, the second target data, and a specified label.

[0181] First text data is determined from the text dataset, and second text data is determined from the text dataset other than the first text data. The first text data is combined with the description data corresponding to each second text data to obtain the second target data.

[0182] Obtain specified labels, including a first specified label and a second specified label. The first specified label indicates an implicit relationship between the text data and the description data, and the second specified label indicates a non-implicit relationship between the text data and the description data. Use the first specified label as the data label for the first target data to obtain positive example data. Use the second specified label as the data label for the second target data to obtain negative example data. Merge the positive example data and the negative example data to obtain the target dataset.

[0183] By simply merging data and automatically assigning specific labels to the merged data, the target dataset can be generated quickly and accurately.

[0184] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

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

[0186] Since the computer program stored in the storage medium can execute the steps in any of the dataset generation methods provided in the embodiments of this application, the beneficial effects that any of the dataset generation methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0187] The above provides a detailed description of a dataset generation method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for generating a dataset, characterized in that, The method includes: Obtain a text dataset for a classification task, wherein the text dataset includes text data and data labels corresponding to the text data; Based on the task type of the classification task, the data tags are converted into descriptive data, which describes the data tags and has a corresponding relationship with the text data; Based on the text data and the corresponding descriptive data, a target dataset is generated; The step of generating the target dataset based on the text data and the corresponding descriptive data includes: By combining the text data and the corresponding descriptive data, the first target data is obtained; By combining the descriptive data corresponding to the first text data and the second text data, a second target data is obtained, wherein the second text data and the first text data are different text data in the text dataset; Obtain a specified tag, the specified tag including a first specified tag and a second specified tag, the first specified tag is used to indicate that there is an implication relationship between the text data and the description data, and the second specified tag is used to indicate that there is a non-implication relationship between the text data and the description data; Using the first specified label as the data label for the first target data, positive example data is obtained; Using the second specified label as the data label for the second target data, negative example data is obtained; The positive and negative examples are merged to obtain the target dataset.

2. The method according to claim 1, characterized in that, The step of converting the data labels into descriptive data according to the task type of the classification task includes: Based on the task type of the classification task, determine the tag type of the data tag; Based on the mapping relationship between preset types and preset data, the preset data corresponding to the tag type is determined as reference data, and the preset type includes the tag type; Based on the reference data, the data labels are converted into descriptive data.

3. The method according to claim 2, characterized in that, The preset data includes first preset data and second preset data. Before determining the preset data corresponding to the tag type as reference data based on the mapping relationship between preset types and preset data, the method further includes: To obtain the preset type, find the types of preset data labels corresponding to all preset text data in the preset text dataset for the preset classification task. Based on the preset data tags of the preset type, preset data corresponding to the preset type is generated, and the mapping relationship between the preset type and the preset data is obtained.

4. The method according to claim 3, characterized in that, The preset data includes first preset data and second preset data. Generating preset data corresponding to the preset type based on the preset data tag of the preset type includes: Determine the specific object and the generic object from the preset data tags; By combining the specific object and the preset type, the first preset data corresponding to the preset type is generated; By combining the generic object and the preset type, a second preset data corresponding to the preset type is generated.

5. The method according to claim 4, characterized in that, The reference data includes first reference data and second reference data. The step of converting the data tags into descriptive data based on the reference data includes: The specific object is determined from the data tags; If the specific object is not a preset object, and the text data corresponding to the data tag contains the specific object in the data tag, then the specific object in the first reference data is replaced with the specific object in the data tag to obtain the description data; If the specific object is a preset object, or if the text data corresponding to the data tag does not contain the specific object in the data tag, the second reference data will be determined as the description data.

6. The method according to claim 1, characterized in that, The combination of the description data corresponding to the first text data and the second text data yields the second target data, including: First text data is determined from the text dataset, and the text data in the text dataset other than the first text data is determined as second text data; The first text data is combined with the description data corresponding to each of the second text data to obtain the second target data.

7. A dataset generation apparatus, characterized in that, The device includes: The acquisition module is used to acquire the text dataset for the classification task. The text dataset includes text data and data labels corresponding to the text data. The conversion module is used to convert the data tags into descriptive data according to the task type of the classification task. The descriptive data is used to describe the data tags and has a corresponding relationship with the text data. The generation module is used to generate a target dataset based on the text data and the corresponding descriptive data. The generation module is further configured to: combine the text data and the corresponding descriptive data to obtain first target data; combine the first text data and the descriptive data corresponding to the second text data to obtain second target data, wherein the second text data and the first text data are different text data in the text dataset; obtain specified tags, wherein the specified tags include a first specified tag and a second specified tag, wherein the first specified tag is used to indicate that there is an implication relationship between the text data and the descriptive data, and the second specified tag is used to indicate that there is a non-implication relationship between the text data and the descriptive data; use the first specified tag as the data tag of the first target data to obtain positive example data; use the second specified tag as the data tag of the second target data to obtain negative example data; and merge the positive example data and the negative example data to obtain the target dataset.

8. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps in the dataset generation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the dataset generation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Webpage classification method and device based on meta-tag and equipment

    CN113468396A