Data enhancement method and system, electronic equipment and computer storage medium

By selecting initial samples from the target corpus, building entity dictionary and relational templates, and using sentence templates to generate enhanced samples, it solves the problem that manual annotation is difficult to cope with changing business scenarios, and improves the generalization ability and training efficiency of the model.

CN119322847APending Publication Date: 2025-01-17GLOBAL ENERGY INTERCONNECTION RES INST CO LTD +3
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411176854.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

When using graph construction and relationship extraction technologies, manual annotation is difficult to cope with changing business scenarios, and cannot guarantee the timeliness and flexibility of model training.

Method used

By selecting initial samples from the target corpus, marking entities and relationships, building entity dictionary and relationship templates, re-expressing text using sentence templates, generating enhanced samples, summarizing and fusion to obtain enhanced data, and reducing manual annotation dependencies.

Benefits of technology

It improves the generalization ability of the model in different scenarios, reduces the cost and inaccuracy of manual annotation, accelerates model training, and generates training samples that are diverse and close to real application situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119322847A_ABST
    Figure CN119322847A_ABST
Patent Text Reader

Abstract

The invention belongs to a data processing method, and provides a data enhancement method, a data enhancement system, electronic equipment and a computer storage medium aiming at the technical problems that a manual annotation mode is difficult to cope with continuously changing business scenes and the timeliness and the flexibility of corresponding model training cannot be ensured when atlas construction and relation extraction technologies are utilized at present. And marking entities and relationships in the initial sample, performing classification arrangement to obtain an entity dictionary, replacing the entities of the text in the marked sample, and marking the replaced entities to obtain a first augmented sample. Constructing a relationship template and a sentence pattern template, re-expressing the text in the replaced first augmented sample through the sentence pattern template, replacing the entity and relationship of the text in the re-expressed first augmented sample in combination with the entity dictionary to obtain a second augmented sample, and then summarizing and fusing the first augmented sample and the second augmented sample to obtain a second augmented sample; and enhanced data is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a data processing method, and specifically to a data enhancement method, system, electronic device, and computer storage medium. Background Art

[0002] In contemporary standardization work, the management and application of technical standards face unprecedented challenges. With the rapid growth in the complexity and number of technical standard documents, traditional manual management methods can no longer meet the needs of efficient and accurate processing and utilization of standard information. In this context, the use of graph construction and relationship extraction technology has become a key means of processing technical standards, especially in dealing with the "hallucination" problem that may be caused by large models.

[0003] When using graph construction and relationship extraction technology, traditional manual labeling of entities and relationships is usually required. However, manual labeling is not only costly, but also difficult to quickly adapt and adjust labeling rules in the face of ever-changing business scenarios, making it impossible to guarantee the timeliness and flexibility of corresponding model training. Summary of the invention

[0004] This application provides a data enhancement method, system, electronic device, and computer storage medium to address the technical problems that the current use of graph construction and relationship extraction technology, which uses manual labeling, is difficult to cope with ever-changing business scenarios and cannot ensure the timeliness and flexibility of corresponding model training.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, the present application proposes a data enhancement method, comprising:

[0007] Select some texts from the target corpus as initial samples, mark the entities and relations in the initial samples, and obtain marked samples corresponding to the initial samples;

[0008] Classify and sort entities in the labeled samples according to categories to obtain an entity dictionary; the categories include at least one type;

[0009] Combined with the entity dictionary, replace the entity in the text of the marked sample, and mark the replaced entity to obtain the first augmented sample;

[0010] Constructing a relationship template; the relationship template includes a relationship category, a relationship type and a relationship positioning word;

[0011] Combine the relationship template to construct the sentence template;

[0012] The text in the first augmented sample after replacement is restated by using the sentence template, and the entities and relations of the text in the first augmented sample after restated are replaced in combination with the entity dictionary to obtain a second augmented sample;

[0013] The first augmented samples and the second augmented samples are aggregated and fused to obtain enhanced data.

[0014] Furthermore, the marking of entities and relations in the initial sample includes:

[0015] Mark the entity type, entity name and entity id in the text sentence;

[0016] And mark the relationship name, the head entity corresponding to the relationship, the id of the entity, and the direction of the relationship.

[0017] Furthermore, the replacing of entities in the text of the marked sample in combination with the entity dictionary includes:

[0018] If the entity type is a numeric entity, replace the entity with a random value;

[0019] If the entity type is a non-numeric entity, replace the entity with at least one other entity in the entity dictionary.

[0020] Furthermore, the sentence template is constructed by combining the relationship template, including:

[0021] The sentence template includes a short sentence template and a relation specification;

[0022] The short sentence template is a string including placeholders and text, and is used to generate a sentence; wherein the placeholder includes a location ID, an entity name or a relationship locator, an entity type or a relationship type, and a category of a replacement entity or relationship;

[0023] The relationship specification includes a head entity id, a tail entity id, and a relationship between the head entity and the tail entity.

[0024] Furthermore, the combining entity dictionary to replace the entities and relations of the text in the restated first augmented sample includes:

[0025] According to the entity type and in combination with the entity dictionary, replace the entity in the text of the reformulated first augmented sample;

[0026] For the text in the restated first augmented sample, if the placeholder includes a relationship type, the relationship type is augmented and replaced with a relationship locator of the same category according to the category of the replacement relationship where the relationship type is located.

[0027] Furthermore, replacing the entity of the text in the restated first augmented sample according to the entity type and in combination with the entity dictionary includes:

[0028] If the entity type is a numeric entity, replace the entity with a random value;

[0029] If the entity type is a non-numeric entity, determine whether the text in the restated first augmented sample includes the category of the replacement entity; if so, replace the entity with at least one entity of another entity type of the same category; otherwise, replace the entity with at least one other entity in the entity dictionary.

[0030] Further, obtaining the second augmented sample includes:

[0031] According to the entities and relations of the text in the first augmented sample after the replacement and reformulation, based on the sentence template, the sample sentence is reconstructed;

[0032] Select multiple sample sentences one by one and merge them into new samples;

[0033] The entities and relations in the new sample are labeled to obtain the second augmented sample.

[0034] In a second aspect, the present application proposes a data enhancement system, comprising:

[0035] The tagging module is used to select some texts from the target corpus as initial samples, tag entities and relations in the initial samples, and obtain a labeled sample corresponding to the initial samples;

[0036] An entity dictionary module is used to classify and sort entities in the marked sample according to categories to obtain an entity dictionary; the categories include at least one type;

[0037] A first augmentation module, used to replace entities in the text of the marked sample in combination with the entity dictionary, and mark the replaced entities to obtain a first augmented sample;

[0038] The first template module is used to construct a relationship template; the relationship template includes a relationship category, a relationship type and a relationship positioning word;

[0039] The second template module is used to combine the relationship template to construct a sentence template;

[0040] The second augmentation module is used to reformulate the text in the replaced first augmented sample through the sentence template, and replace the entities and relations of the text in the reformulated first augmented sample in combination with the entity dictionary to obtain a second augmented sample;

[0041] A fusion module is used to aggregate and fuse the first augmented sample and the second augmented sample to obtain enhanced data.

[0042] Furthermore, the marking of entities and relations in the initial sample includes:

[0043] Mark the entity type, entity name and entity id in the text sentence;

[0044] And mark the relationship name, the head entity corresponding to the relationship, the id of the entity, and the direction of the relationship.

[0045] Furthermore, the replacing of entities in the text of the marked sample in combination with the entity dictionary includes:

[0046] If the entity type is a numeric entity, replace the entity with a random value;

[0047] If the entity type is a non-numeric entity, replace the entity with at least one other entity in the entity dictionary.

[0048] Furthermore, the sentence template is constructed by combining the relationship template, including:

[0049] The sentence template includes a short sentence template and a relation specification;

[0050] The short sentence template is a string including placeholders and text, and is used to generate a sentence; wherein the placeholder includes a location ID, an entity name or a relationship locator, an entity type or a relationship type, and a category of a replacement entity or relationship;

[0051] The relationship specification includes a head entity id, a tail entity id, and a relationship between the head entity and the tail entity.

[0052] Furthermore, the combining entity dictionary to replace the entities and relations of the text in the restated first augmented sample includes:

[0053] According to the entity type and in combination with the entity dictionary, replace the entity in the text of the reformulated first augmented sample;

[0054] For the text in the restated first augmented sample, if the placeholder includes a relationship type, the relationship type is augmented and replaced with a relationship locator of the same category according to the category of the replacement relationship where the relationship type is located.

[0055] Furthermore, replacing the entity of the text in the restated first augmented sample according to the entity type and in combination with the entity dictionary includes:

[0056] If the entity type is a numeric entity, replace the entity with a random value;

[0057] If the entity type is a non-numeric entity, determine whether the text in the restated first augmented sample includes the category of the replacement entity; if so, replace the entity with at least one entity of another entity type of the same category; otherwise, replace the entity with at least one other entity in the entity dictionary.

[0058] Further, obtaining the second augmented sample includes:

[0059] According to the entities and relations of the text in the first augmented sample after the replacement and reformulation, based on the sentence template, the sample sentence is reconstructed;

[0060] Select multiple sample sentences one by one and merge them into new samples;

[0061] The entities and relations in the new sample are labeled to obtain the second augmented sample.

[0062] In a third aspect, the present application provides an electronic device, comprising:

[0063] Memory for storing computer programs;

[0064] A processor is used to implement the steps of the above-mentioned data enhancement method when executing the computer program.

[0065] In a fourth aspect, the present application proposes a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned data enhancement method are implemented.

[0066] Compared with the prior art, this application has the following beneficial effects:

[0067] The present application proposes a data enhancement method, which marks the entities and relationships in the initial sample, and classifies and organizes them to obtain an entity dictionary, replaces the entities in the text in the marked sample, and marks the replaced entities to obtain a first augmented sample, thereby enriching the entities in the data. By constructing a relationship template and a sentence template, when using the data enhanced by the present application, the model can learn a wider range of language patterns, restate the text in the replaced first augmented sample through the sentence template, and replace the entities and relationships in the text in the restated first augmented sample in combination with the entity dictionary to obtain a second augmented sample, and then aggregate and fuse the first augmented sample and the second augmented sample to obtain enhanced data, further enriching the entities and types of the data. Through the enhancement method of the present application, a large number of training samples with diversity and close to the distribution of real application situations can be synthesized, which increases the richness of the data. When the data is used for model training later, the model can learn a wider range of language patterns and the types of relationships between entities, thereby improving the generalization ability of the model in different scenarios. In addition, it can reduce the labor cost of manual annotation, maximize the avoidance of inaccuracy and incompleteness of manual annotation, and accelerate model training.

[0068] The present application also proposes a data enhancement system, an electronic device and a computer storage medium, which have all the advantages of the above-mentioned data enhancement method. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0070] Figure 1 This is a first flow chart of the data enhancement method of this application;

[0071] Figure 2 This is a second flow chart of the data enhancement method of this application;

[0072] Figure 3 A schematic diagram of entity replacement in an embodiment of the present application;

[0073] Figure 4 A schematic diagram of the data enhancement system of this application. DETAILED DESCRIPTION

[0074] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0075] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0076] It should be noted that the terms “first”, “second”, etc. are only used for distinguishing descriptions and should not be understood as indicating or implying relative importance.

[0077] In the description of the embodiments of the present application, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0078] Technical standards refer to the standards formulated for technical matters that need to be coordinated and unified in the field of standardization, which stipulate the technical content of things. Technical standards are the technical basis for scientific research, design, technology, inspection and other technical work and commodity circulation. Due to the rapid increase in the complexity and number of technical standard documents, effective management of technical standard documents is required.

[0079] Using graph construction and relationship extraction technology to process technical standards can efficiently organize, manage and understand complex technical specifications and requirements. Graph construction refers to the process of converting entities and their relationships in technical standards into graph data structures. This process converts unstructured standard documents into structured, queryable knowledge graphs, so that the concepts, attributes, rules and their connections in the standards can be clearly presented, which not only helps the storage and retrieval of standardized information, but also provides a powerful tool for intelligent decision support, compliance checking and standard interpretation. Relationship extraction is a way to automatically build graphs, which involves automatically identifying and extracting semantic relationships between entities from standard texts, including identifying technical terms, parameter specifications, test methods, compliance requirements and other entities in the standards, as well as their associations, such as "definition", "application", "based on", etc. Through relationship extraction, a semantic network between entities can be built to form a deep understanding of the content of the standard.

[0080] After training the models with technical standards processed by graph construction and relationship extraction technology, these models can be used for actual technical standard management. The data used to train the models is particularly important for the accuracy of model application. Data enhancement is a technology that improves model performance by increasing the diversity and complexity of data sets. Data enhancement can effectively solve problems such as insufficient data and data noise, and enhance the generalization and robustness of the model. In practical applications, data enhancement can generate new training samples by performing a series of transformations and processing on the original data, thereby expanding the training data set. These transformations can be geometric transformations, color transformations, noise addition, etc. The specific type of the data set is determined according to different models.

[0081] When using graph construction and relationship extraction technology, entities and relationships need to be labeled. Traditional manual labeling methods usually have the following problems:

[0082] (1) Sample imbalance:

[0083] In real-world datasets, some relationship types may be very common, but others are relatively rare. This imbalance can cause the trained model to tend to predict the most common relationships, while having poor recognition performance for minority relationships.

[0084] (2) Poor learning ability with small samples:

[0085] Many types of relations may only appear in a limited number of instances, which makes it difficult for the model to fully learn enough patterns to accurately extract these relations. However, deep learning models usually require a large amount of labeled data to achieve good performance, and in the case of small samples, the model is prone to overfitting, that is, it performs well on the training set but has poor generalization ability on unseen new data.

[0086] Based on the above situation, the present application proposes a data enhancement method, system, electronic device, and computer storage medium. The present application is described in detail below in conjunction with embodiments and drawings.

[0087] like Figure 1 As shown, it is a first flow chart of the data enhancement method of the present application, which may include:

[0088] S101, select some text from the target corpus as an initial sample, mark the entities and relations in the initial sample, and obtain a marked sample corresponding to the initial sample.

[0089] It should be noted that a corpus is a structured text database that collects and stores a large amount of technical standard text according to specific sampling standards. In practical applications, the number of initial samples selected from the target corpus can be adjusted according to the needs of enhancement. When marking entities and relationships in samples, manual marking methods can be used or other marking tools can be used.

[0090] S102, classify and sort entities in the marked sample according to categories to obtain an entity dictionary; the categories include at least one type.

[0091] It should be noted that the obtained entity dictionary includes entity categories and entities that can be included in each category, and each entity includes at least one type.

[0092] S103, combining with the entity dictionary, replacing the entity in the text of the marked sample, and marking the replaced entity to obtain a first augmented sample.

[0093] In practical applications, entities in the text of the labeled sample are replaced, for example, by using other types of the same category in the entity dictionary. In some special cases, types in other categories can also be used for replacement, as long as the replaced text does not exceed the reasonable range of the text.

[0094] S104, constructing a relationship template; the relationship template includes a relationship category, a relationship type and a relationship locator.

[0095] In practical applications, the constructed relationship template can be used to describe the relationship in the text using a unified standard, which can be specifically described by relationship category, relationship type and relationship locator. Relationship category usually refers to the broad classification of relationships between entities, describing the general nature of the relationship; relationship type is a specific classification under the relationship category, which more specifically describes the relationship between entities; relationship locator is a specific word or phrase used in the text to indicate the relationship between entities. Through such a relationship template, the relationship between entities can be accurately and comprehensively described.

[0096] S105, combining the relationship template to construct a sentence template.

[0097] In practical applications, combined with relationship templates, we can construct sentence templates to better describe entity relationships in texts. A sentence template is a framework that specifies how to organize language to express specific relationships.

[0098] It should be noted that the main purposes and functions of relationship templates and sentence templates are:

[0099] (1) Standardized expression:

[0100] Sentence templates can help standardize information about specific relationships in the text. Even if the original text has diverse expressions, it can be unified into a predefined format for subsequent processing and analysis.

[0101] (2) Relation extraction can be flexibly adjusted:

[0102] Sentence templates make it easier to adjust the extraction method of the relationship between entities. For example, when the relationship "collection time" needs to be extracted, the sentence template can predefine the structure of the relationship and the location of the entity. No matter how the specific numerical value of the collection time changes (such as 1s, 2s, 3s becomes 1s, 4s, 8s, 10s, or becomes 1s, 4s, 8s, 16s, 29s), the template can adapt to this change and maintain the accuracy of relationship extraction.

[0103] (3) Support for scalable dataset construction:

[0104] After constructing the sentence template, you can easily generate or expand the training data set. For example, once the sentence template about "collection time" is determined, you can quickly generate sentences containing different time values, which helps the training model better understand the pattern of such relationships.

[0105] (4) Improve the generalization ability of the model:

[0106] By using relation templates and sentence templates, the model can learn common representations of different types of relations, which helps improve its generalization ability when faced with new data.

[0107] (5) More accurate and comprehensive testing:

[0108] The relation templates and sentence templates provide a structured input format for the model, so that the test set can accurately cover a variety of expected entity relations and syntactic structures. Therefore, the performance of the model when processing real-world data can be more accurately evaluated.

[0109] S106, restating the text in the replaced first augmented sample by using the sentence template, and replacing the entities and relations in the text in the restated first augmented sample in combination with the entity dictionary to obtain a second augmented sample.

[0110] After the restatement, the entities and relations of the text in the first augmented sample can be replaced again to obtain a richer second augmented sample.

[0111] S107: Aggregate and fuse the first augmented sample and the second augmented sample to obtain enhanced data.

[0112] It should be noted that aggregating and fusing the first augmented sample and the second augmented sample means aggregating the first augmented sample and the second augmented sample to obtain the sum of the two samples as the enhanced data.

[0113] The data enhancement method of this application has many advantages, which are specifically manifested in:

[0114] 1. Improve model generalization.

[0115] (1) Increased diversity and richness: Through the enhancement method of this application, a large number of training samples with diversity and close to the actual distribution can be synthesized, which increases the richness of the training data and helps the model learn a wider range of language patterns and relationship types between entities, thereby improving the generalization ability in different scenarios.

[0116] (2) Enhanced robustness: The enhanced dataset covers more abnormal situations and boundary conditions, making the model more robust when facing noise, ambiguous expressions or edge cases within the domain, reducing the possibility of misjudgment.

[0117] (3) Reducing the risk of overfitting: The data augmentation method of this application helps to prevent the model from being overly dependent on a specific feature combination in the training set by introducing additional training samples, thereby reducing the risk of overfitting and making the model more stable on new data.

[0118] 2. Provides new ideas for annotation methods.

[0119] (1) Reduce the burden of manual annotation: Traditional relationship extraction tasks rely heavily on expensive manual annotation, and the data augmentation method of this application can alleviate this problem to a certain extent. By generating a large amount of high-quality synthetic data, the dependence on manually annotated data can be greatly reduced, the project cost can be reduced, and the iteration speed of model training can be accelerated.

[0120] (2) Reduce manual review workload: The traditional review process usually requires checking the entity and relationship annotations in the standard text one by one, which is time-consuming and error-prone. With the data enhancement method of this application, the focus of the review can be shifted to the review of entity dictionaries and sentence templates, which means that professionals can focus more on confirming the accuracy and completeness of the entity itself, whether the sentence template is correctly applied, and whether all necessary contexts and changes are covered, rather than repeatedly checking the annotations of known standards, thereby simplifying the review steps.

[0121] (3) Promoting semi-supervised and weakly supervised learning: The data augmentation method of this application provides the possibility for semi-supervised and weakly supervised learning, that is, using a small amount of labeled data and a large amount of unlabeled data to train the model. This learning method can still achieve a high level of performance under limited resources.

[0122] (4) Improved flexibility and innovation: The flexibility of the data augmentation method in this application means that the augmentation algorithm can be customized according to specific needs. For example, by introducing domain-specific noise, transformation, or context modification, new samples that meet specific task requirements can be created, opening up new paths for model training and performance optimization.

[0123] Therefore, the data enhancement method of this application not only significantly improves the generalization ability of the model when processing complex texts such as technical standards, but also provides a new solution for reducing the workload of manual annotation and accelerating the model training cycle. It has important theoretical value and practical application prospects.

[0124] It should also be noted that the data enhancement method of the present application can be used not only for technical standard texts, but also for other similar fields.

[0125] As a second embodiment of the data enhancement method of the present application, it may include:

[0126] S201, pre-labeled samples.

[0127] Select a certain number of texts from the target corpus as initial samples. Clarify the entity types and relationships that need to be identified in each initial sample. Entity types usually refer to "parameters", "parameter values", etc., and relationships refer to the relationships between entities, such as ">", "<", "is", etc., and define the relevant entity relationship annotation specifications. The annotators manually annotate the entities and relationships in the initial samples according to the specifications to obtain annotated samples. When annotating, the entity needs to be marked with the entity type and the position of the entity in the text sentence, and uniquely identified with an id. The relationship needs to be marked with the relationship name, the id of the head and tail entities corresponding to the relationship, and the direction of the relationship.

[0128] S202, constructing an entity dictionary.

[0129] Collect all entities in the labeled samples and create a preliminary entity list. During the creation process, remove duplicate entities and sort them by entity type to form a preliminary entity dictionary.

[0130] S203, replacing entities in the initial sample to generate a first type of augmented samples.

[0131] If the entity type is a numeric entity, the numeric entity in the text can be replaced with a random value. The digits of the random value should cover 0-9, the positive and negative signs, and each entity contains 1-5 digits, and five-digit entities should be ensured. Otherwise, replace the entities in the text according to the constructed entity dictionary. After the replacement, the entity annotation results are updated synchronously so that the entity position correctly points to the correct entity.

[0132] S204, relationship template construction.

[0133] Relationship templates mainly include categories, relationship types, and relationship locators. Relationship types are relationships between entities defined in the specifications of relationship extraction and knowledge graph design. Relationships of the same type use the same label or identifier to avoid confusion and redundancy caused by differences in expression. Relationship locators are a set of keywords or phrases used to locate and identify specific relationship types in text, and support flexible matching of regular expressions.

[0134] S205, sentence template construction.

[0135] Each sentence template contains a short sentence template and a relationship specification. The short sentence template is a string containing placeholders and text, which is used to generate specific sentences. The placeholder can be composed of four parts: id, entity name / relationship locator, entity / relationship type, and category. Among them, id is used to identify the unique placeholder and will be referenced by the relationship rule. The entity name is the word of the entity in the original short sentence. The relationship locator represents the word of the relationship in the original short sentence. The category accurately defines the scope of interchangeable entities or relationships, ensuring that only entities or relationships of the same type are replaced during the replacement process. In practical applications, the category can be empty, indicating that it can be replaced with entities of all categories of the entity type. The relationship rule represents the relationship set between entities, which can include the head entity id, the tail entity id, and the relationship. The head entity id and the tail entity id both point to the placeholder id in the short sentence template. The relationship can be an id, pointing to the placeholder id in the short sentence template. When the relationship is implicitly expressed in the sentence, it can be represented by the relationship name.

[0136] S206, generating a second type of augmented samples according to the sentence pattern.

[0137] Specifically, it can include: entity generation, relationship generation, sentence filling and sample generation.

[0138] (1) Entity generation: mainly divided into numerical entity generation and dictionary entity generation. If the entity type is a numerical entity, a random value is generated. The random value digits should cover 0-9 and cover positive and negative signs. Each entity contains 1-5 digits, and five-digit entities should be guaranteed to appear. If the entity type is a non-numerical entity, the entities in the text can be generated based on the constructed entity dictionary. If the sentence template specifies a category, only entities of the same category need to be generated.

[0139] (2) Relationship generation: If there is a relationship placeholder, the relationship needs to be generated. If the sentence template specifies a category, it is limited to generating relationships of the same category. It can generate relationship types different from the sentence template and generate new locators based on the regular expression of the relationship locator corresponding to the relationship type.

[0140] (3) Sentence filling: Sample sentences are reconstructed based on the generated entities and relations. For example, “{1: temperature rise: parameter}{2: not greater than: <=: 1}{3: 50: parameter value} K” can generate “time exceeds -2.3 K” and “humidity is less than 34.2 K”.

[0141] (4) Sample generation: Each time, 4-8 generated sentences are selected and merged into one sentence, such as "the time exceeds -2.3K, the voltage is 83Hz-213Hz, the humidity is less than 34.2K, and the temperature at which the capacitor can be put into operation is 8℃, 12℃, etc." At the same time, new entity relationship annotation results are generated.

[0142] The above-mentioned replacement of the same category can improve semantic accuracy and consistency and avoid semantic problems caused by using words of different categories. For example, in "temperature is greater than 5℃", "exceed", "greater than" and "above", "outside" and other relationship positioning words belong to different categories. They are usually not interchanged at will, otherwise it will lead to semantic contradictions or errors. Therefore, it can be required to follow the semantic logic rules when replacing the relationship type to maintain the correctness and coherence of the sentence.

[0143] S207, the data of the first type of augmented samples and the second type of augmented samples are merged, and then the relationship extraction model training can be performed.

[0144] The following is an example of a data enhancement method of the present application, which may include:

[0145] S301, pre-label samples.

[0146] The text is "The average temperature rise of the winding should not exceed 70K", and some of the marked results are:

[0147] (1) Entity set (as shown in Table 1):

[0148] Table 1 Entity set table in some annotation results

[0149] Entity id Entity Name Position in the text 1 Temperature rise [3,7] 2 70 [11,13]

[0150] (2) Relationship set (as shown in Table 2):

[0151] Table 2. Relationship sets in some annotation results

[0152] Header entity id Tail entity id Relationship Type 1 2 <=

[0153] S302, constructing an entity dictionary.

[0154] The entity dictionary example table is shown in Table 3:

[0155] Table 3 Entity dictionary example table

[0156]

[0157] S303, entity replacement, generating the first type of augmented samples.

[0158] like Figure 3 The following is a schematic diagram of entity replacement. The replaced text example is:

[0159] The temperature of the winding should not be greater than 70K, the humidity of the winding should not be greater than 70K, the average temperature rise of the winding should not be greater than 1.8K, etc.

[0160] Taking "the temperature of the winding should not exceed 70K" as an example, the entity annotation results after replacement are shown in Table 4:

[0161] Table 4 Entity annotation results after replacement

[0162] Entity id Entity Name Position in the text 1 temperature [3,5] 2 70 [9,11]

[0163] S304, relationship template construction

[0164] An example of a relationship template is shown in Table 5.

[0165] Table 5 Relationship template example table

[0166]

[0167] It should be noted that the positioning words for “should not be less than” in Table 5 can be “should not be less than”, “should not be less than”, or “not less than”.

[0168] S305, sentence template construction

[0169] Each template contains a short sentence template and a relation specification. Examples of two short sentence templates are given below.

[0170] Example 1 of short sentence template:

[0171] A short sentence template is a string containing placeholders and text, which is used to generate a specific sentence. Example 1 of a short sentence template is:

[0172] "{1: temperature rise: parameter}{2: not greater than: <=: 1}{3: 50: parameter value} K"

[0173] Among them, "{1: temperature rise: parameter}", "{2: not greater than: <=: 1}" and "{3: 50: parameter value}" are placeholders, representing different parts of the template respectively:

[0174] (1) {1: frequency: parameter} represents the placeholder at the first position, that is, the id is 1, which describes the parameter "temperature";

[0175] (2) {2: not greater than: <=: 1} + represents the placeholder at the second position, that is, the id is 2, and the relationship described is not greater than, which is represented by "not greater than" in the statement, and the category is 1;

[0176] (3){3:50:parameter value} indicates the placeholder at the third position, that is, the id is 3, which describes another specific value "50", which is also a parameter value entity.

[0177] In addition to the above short sentence templates, the logical relationship between the parts in the template is also defined through relationship rules. In Example 1, the relationship rules are:

[0178] "relations":[[1,3,2]]. This indicates that the entity with id 1 forms a relationship with entity with id 3 with id 2.

[0179] Example 2 of short sentence template:

[0180] A short sentence template is a string containing placeholders and text, which is used to generate a specific sentence. In short sentence template example 2, the sentence template is:

[0181] "{1:frequency:parameter} is {2:20:parameter value}Hz-{3:300:parameter value}Hz"

[0182] Here, "{1:frequency:parameter}", "{2:20:parameter value}" and "{3:300:parameter value}" are placeholders, representing different parts in the template.

[0183] (1) {1: frequency: parameter} represents the placeholder at the first position, that is, the id is 1, which describes the parameter "frequency";

[0184] (2) {2:20:parameter value} indicates the placeholder at the second position, i.e., the id is 2, which describes a specific value "20" as the parameter value entity;

[0185] (3){3:300:parameter value} indicates the placeholder at the third position, that is, the id is 3, which describes another specific value "300", which is also a parameter value entity.

[0186] The logical relationship between the parts in the template is defined by the relationship rules. In Example 1, the relationship rules are:

[0187] "relations":[[1,2,">="],[1,3,"<="]]

[0188] [1,2,">="] indicates that the entity with id 1 forms a greater than or equal relationship with the entity with id 2.

[0189] [1,3,"<="] indicates that the entity with id 1 forms a less than or equal relationship with the entity with id 3.

[0190] S306, generating the second type of augmented samples according to the sentence template, mainly including entity generation, relationship generation, sentence filling and sample generation.

[0191] Entity generation and relationship generation can adopt the specific methods of the aforementioned embodiments. Sentence filling can reconstruct sample sentences based on the generated entities and relationships, such as "{1: temperature rise: parameter}{2: not greater than: <=: 1}{3: 50: parameter value} K", which can generate "time exceeds -2.3K", "humidity is less than 34.2K" sample generation, each time selecting 4-8 generated sentences and merging them into one sentence, such as "time exceeds -2.3K, voltage is 83Hz-213Hz, humidity should be less than 34.2K, the temperature at which the capacitor can be put into operation is 8℃, 12℃, etc." At the same time, new entity relationship annotation results are generated, as shown in Table 6 and Table 7:

[0192] Table 6 Entity set table in the new entity relationship annotation results generated when generating the second type of augmented samples

[0193]

[0194]

[0195] Table 7 Relationship set table of new entity relationship annotation results generated when generating the second type of augmented samples

[0196] Header entity id Tail entity id Relationship Type 1 2 <= 3 4 >= 3 5 <= 6 7 < 8 9 = 8 10 =

[0197] Based on the above data enhancement methods, such as Figure 4 As shown, the present application also proposes a data enhancement system, which may include:

[0198] The tagging module is used to select some texts from the target corpus as initial samples, tag entities and relations in the initial samples, and obtain a labeled sample corresponding to the initial samples;

[0199] An entity dictionary module is used to classify and sort entities in the marked sample according to categories to obtain an entity dictionary; the categories include at least one type;

[0200] A first augmentation module, used to replace entities in the text of the marked sample in combination with the entity dictionary, and mark the replaced entities to obtain a first augmented sample;

[0201] The first template module is used to construct a relationship template; the relationship template includes a relationship category, a relationship type and a relationship positioning word;

[0202] The second template module is used to combine the relationship template to construct a sentence template;

[0203] The second augmentation module is used to reformulate the text in the replaced first augmented sample through the sentence template, and replace the entities and relations of the text in the reformulated first augmented sample in combination with the entity dictionary to obtain a second augmented sample;

[0204] A fusion module is used to aggregate and fuse the first augmented sample and the second augmented sample to obtain enhanced data.

[0205] It should be noted that in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each module is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another device, or some features can be ignored or not executed. The module described as a separate component may or may not be physically separated. The component displayed as a module may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0206] In addition, each module in each embodiment of the present invention may be integrated into a processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0207] An electronic device provided in an embodiment of the present application includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the data enhancement method described in any of the above embodiments are implemented.

[0208] Another electronic device provided in the embodiment of the present application may also include: an input port connected to the processor, used to transmit multimodal data collected by an external acquisition device to the processor; and a display unit connected to the processor, used to display the processing results of the processor to the outside world; a communication module connected to the processor, used to realize communication between the electronic device and the outside world. The display unit can be a display panel, a laser scanning display, etc.; the communication mode adopted by the communication module includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection (including wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s).

[0209] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the data enhancement method described in any of the above embodiments are implemented.

[0210] The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.

[0211] For the description of the relevant parts of the data enhancement system, electronic device, and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts in the data enhancement method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.

[0212] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data enhancement method, characterized in that: include: Select some texts from the target corpus as initial samples, mark the entities and relations in the initial samples, and obtain marked samples corresponding to the initial samples; Classify and sort entities in the labeled samples according to categories to obtain an entity dictionary; the categories include at least one type; Combined with the entity dictionary, replace the entity in the text of the marked sample, and mark the replaced entity to obtain the first augmented sample; Constructing a relationship template; the relationship template includes a relationship category, a relationship type and a relationship positioning word; Combine the relationship template to construct the sentence template; The text in the first augmented sample after replacement is restated by using the sentence template, and the entities and relations of the text in the first augmented sample after restated are replaced in combination with the entity dictionary to obtain a second augmented sample; The first augmented samples and the second augmented samples are aggregated and fused to obtain enhanced data.

2. A data enhancement method according to claim 1, characterized in that: The marking of entities and relations in the initial sample includes: Mark the entity type, entity name and entity id in the text sentence; And mark the relationship name, the head entity corresponding to the relationship, the id of the entity, and the direction of the relationship.

3. A data enhancement method according to claim 2, characterized in that: The replacing of entities in the text of the marked sample in combination with the entity dictionary includes: If the entity type is a numeric entity, replace the entity with a random value; If the entity type is a non-numeric entity, replace the entity with at least one other entity in the entity dictionary.

4. A data enhancement method according to claim 3, characterized in that: The combining relationship template to construct a sentence template includes: The sentence template includes a short sentence template and a relation specification; The short sentence template is a string including placeholders and text, and is used to generate a sentence; wherein the placeholder includes a location ID, an entity name or a relationship locator, an entity type or a relationship type, and a category of a replacement entity or relationship; The relationship specification includes a head entity id, a tail entity id, and a relationship between the head entity and the tail entity.

5. A data enhancement method according to claim 4, characterized in that: The combining entity dictionary to replace the entities and relations of the text in the restated first augmented sample includes: According to the entity type and in combination with the entity dictionary, replace the entity in the text of the reformulated first augmented sample; For the text in the restated first augmented sample, if the placeholder includes a relationship type, the relationship type is augmented and replaced with a relationship locator of the same category according to the category of the replacement relationship where the relationship type is located.

6. A data enhancement method according to claim 5, characterized in that: The replacing the entity of the text in the restated first augmented sample according to the entity type and in combination with the entity dictionary includes: If the entity type is a numeric entity, replace the entity with a random value; If the entity type is a non-numeric entity, determine whether the text in the restated first augmented sample includes the category of the replacement entity; if so, replace the entity with at least one entity of another entity type of the same category; otherwise, replace the entity with at least one other entity in the entity dictionary.

7. A data enhancement method according to claim 6, characterized in that: The obtaining of the second augmented sample comprises: According to the entities and relations of the text in the first augmented sample after the replacement and reformulation, based on the sentence template, the sample sentence is reconstructed; Select multiple sample sentences one by one and merge them into new samples; The entities and relations in the new sample are labeled to obtain the second augmented sample.

8. A data enhancement system, characterized in that: include: The tagging module is used to select some texts from the target corpus as initial samples, tag entities and relations in the initial samples, and obtain a labeled sample corresponding to the initial samples; An entity dictionary module is used to classify and sort entities in the marked sample according to categories to obtain an entity dictionary; the categories include at least one type; A first augmentation module, used to replace entities in the text of the marked sample in combination with the entity dictionary, and mark the replaced entities to obtain a first augmented sample; The first template module is used to construct a relationship template; The relationship template includes a relationship category, a relationship type and a relationship locator; The second template module is used to combine the relationship template to construct a sentence template; The second augmentation module is used to reformulate the text in the replaced first augmented sample through the sentence template, and replace the entities and relations of the text in the reformulated first augmented sample in combination with the entity dictionary to obtain a second augmented sample; A fusion module is used to aggregate and fuse the first augmented sample and the second augmented sample to obtain enhanced data.

9. A data enhancement system according to claim 8, characterized in that: The marking of entities and relations in the initial sample includes: Mark the entity type, entity name and entity id in the text sentence; And mark the relationship name, the head entity corresponding to the relationship, the id of the entity, and the direction of the relationship.

10. A data enhancement system according to claim 9, characterized in that: The replacing of entities in the text of the marked sample in combination with the entity dictionary includes: If the entity type is a numeric entity, replace the entity with a random value; If the entity type is a non-numeric entity, replace the entity with at least one other entity in the entity dictionary.

11. A data enhancement system according to claim 10, characterized in that: The combining relationship template to construct a sentence template includes: The sentence template includes a short sentence template and a relation specification; The short sentence template is a string including placeholders and text, and is used to generate a sentence; wherein the placeholder includes a location ID, an entity name or a relationship locator, an entity type or a relationship type, and a category of a replacement entity or relationship; The relationship specification includes a head entity id, a tail entity id, and a relationship between the head entity and the tail entity.

12. A data enhancement system according to claim 11, characterized in that: The combining entity dictionary to replace the entities and relations of the text in the restated first augmented sample includes: According to the entity type and in combination with the entity dictionary, replace the entity in the text of the reformulated first augmented sample; For the text in the restated first augmented sample, if the placeholder includes a relationship type, the relationship type is augmented and replaced with a relationship locator of the same category according to the category of the replacement relationship where the relationship type is located.

13. A data enhancement system according to claim 12, characterized in that: The replacing the entity of the text in the restated first augmented sample according to the entity type and in combination with the entity dictionary includes: If the entity type is a numeric entity, replace the entity with a random value; If the entity type is a non-numeric entity, determine whether the text in the restated first augmented sample includes the category of the replacement entity; if so, replace the entity with at least one entity of another entity type of the same category; otherwise, replace the entity with at least one other entity in the entity dictionary.

14. A data enhancement system according to claim 13, characterized in that: The obtaining of the second augmented sample comprises: According to the entities and relations of the text in the first augmented sample after the replacement and reformulation, based on the sentence template, the sample sentence is reconstructed; Select multiple sample sentences one by one and merge them into new samples; The entities and relations in the new sample are labeled to obtain the second augmented sample.

15. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data enhancement method according to any one of claims 1 to 7 when executing the computer program.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data enhancement method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Method for constructing large legal affair model, method for analyzing legal affair information, and computer device

    CN120973922A

  • Legal big data model construction method, legal information analysis method, computer device

    CN120973922B