A text data automatic extraction method and device based on a large language model
By converting text data to Markdown format and using a large language model for entity extraction and relation extraction, combined with a shortest path matching algorithm, the problems of low efficiency and poor accuracy in traditional methods are solved, and efficient automatic extraction and accurate processing of scientific research text data in the steel industry are achieved.
Patent Information
- Application Number
- CN202511096892.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-08-06
AI Technical Summary
Traditional methods for extracting scientific research text data rely on manual screening, regular expression matching, and supervised learning, which suffer from low efficiency, poor accuracy, and insufficient flexibility. Furthermore, large language models face challenges in application to the steel industry due to domain-specific requirements and insufficient semantic understanding depth.
An automatic text data extraction method based on a large language model is adopted, including text conversion to Markdown format, entity extraction and relation extraction, combined with the shortest path matching algorithm to improve the utilization efficiency of text data.
It improves the accuracy and stability of extracting scientific research text data, enhances the understandability of text data, and meets the professional needs of the steel industry.
Smart Images

Figure CN120911446B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data information processing, and more particularly, to a large language model-based text data automatic extraction method and device. BACKGROUND
[0002] With the continuous development of the steel industry, the relevant scientific research text data is increasing. A large amount of important information for steel research and development, production, and application is contained in these scientific research texts.
[0003] In the traditional scientific research text data extraction process, manual screening, regular matching, and supervised learning are mainly relied on. The core process of manual screening can be divided into three stages: systematic retrieval, hierarchical screening, and academic judgment. Regular matching screening is to extract and filter scientific research text data through regular expressions. Supervised learning screening is to extract keywords through binary or multi-classification methods and then perform relationship extraction. In recent years, large language models have made significant progress in natural language processing, exhibiting strong language understanding and generation capabilities. They have performed well in text classification, question-answering systems, and text summarization, providing a new approach to solving the problem of automatic extraction of scientific research text data in the steel industry.
[0004] However, manual screening has the characteristics of long extraction time and poor efficiency. Regular matching has the problems of poor flexibility and low precision. Supervised learning requires a large amount of supervised data in advance and has weak generalization, such as the need to adjust the strength and elongation of the extracted steel text, the conductivity, and the expansion coefficient in the next extraction. In addition, directly applying large language models to scientific research text data extraction in the steel industry also faces problems such as field specialization requirements, data format diversification, and insufficient semantic understanding depth. SUMMARY
[0005] According to the present application, a large language model-based data automatic extraction scheme is provided. This scheme can take advantage of the low cost, strong capability, fast speed, and good generalization of large language models to improve the utilization efficiency of text data.
[0006] In the first aspect of the present application, a large language model-based text data automatic extraction method is provided. The method includes:
[0007] Obtaining a target text and converting the target text into a Markdown format text, then using regular matching technology to process the content of the Markdown format text to obtain a text data set, which includes text data and table data;
[0008] According to the large language model, the entity extraction prompt word is constructed, the target entity containing the target data is extracted from the text data set by using the large language model and the entity extraction prompt word, and the number of target entities is recorded;
[0009] According to the large language model, the relationship extraction prompt word is constructed, and based on the target entity and the number of target entities, the large language model and the relationship extraction prompt word are used for relationship extraction on the text data set to obtain a target text data set;
[0010] The shortest path matching algorithm is used to match the target text data set to obtain a structured target text data.
[0011] In a second aspect of the application, an electronic device is provided. The electronic device comprises at least one processor; and a memory connected to the at least one processor in communication; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of the first aspect of the application.
[0012] Compared with the prior art, the application can fully exert the advantages of low cost, strong ability, fast speed and good generalization of the large language model, and can improve the utilization efficiency of the steel industry scientific research text data, and has important practical significance for promoting the technological progress of the steel industry.
[0013] It should be understood that the content described in the summary section is not intended to limit the key or important features of the embodiments of the application, nor to limit the scope of the application. Other features of the application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0014] The above and other features, advantages, and aspects of embodiments of the application will become more apparent by describing in detail preferred embodiments thereof with reference to the attached drawings in which:
[0015] Figure 1 A flowchart of a large language model-based text data automatic extraction method according to an embodiment of the application is shown;
[0016] Figure 2 A block diagram of extracting target entities according to an embodiment of the application is shown;
[0017] Figure 3 A block diagram of relationship extraction according to an embodiment of the application is shown;
[0018] Figure 4 A block diagram of an evaluation model workflow according to an embodiment of the application is shown;
[0019] Figure 5A block diagram illustrating target proper noun vector dataset extraction according to an embodiment of the present application is shown.
[0020] Figure 6 A block diagram illustrating target text vector and dictionary vector conversion according to an embodiment of the present application is shown.
[0021] Figure 7 A block diagram illustrating target entity and dictionary vector matching according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] To make the objects, technical solutions and advantages of embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0023] In addition, the term "and / or" herein is only used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.
[0024] In the present application, the target text is obtained and converted into a Markdown format text; a target text dataset is extracted according to a large language model, and the target text dataset is matched to obtain a structured target text data. In this way, the accuracy and stability of text extraction can be improved, and the understandability is stronger.
[0025] Embodiment 1
[0026] Figure 1 A flowchart of a text data automatic extraction method based on a large language model according to an embodiment of the present application is shown.
[0027] The method comprises:
[0028] S101, obtaining a target text, converting the target text into a Markdown format text, and processing the content of the Markdown format text by using a regular matching technology to obtain a text dataset, the text dataset comprising text data and table data.
[0029] Specifically, the target text is converted into a Markdown format text by performing an OCR (Optical Character Recognition) recognition process on the target text. The regular matching technique is a text processing technique based on a specific rule to describe a string pattern, and achieves efficient search, extraction, verification or replacement of complex text through a simple string combination (referred to as a regular expression).
[0030] The regular matching technique is used to process the content of the Markdown format text, including:
[0031] (1) For text data: segment the text data according to chapters, and segment the segmented text according to periods.
[0032] (2) For table data: each table is disassembled into a key-value pair of "table title-table content".
[0033] As some optional embodiments of the present embodiment, the target text is obtained by using the Web of Science database, taking "Steel", "Iron" and "Fe alloy" as retrieval conditions, retrieving the DOI (Document Identifier) of the related scientific research text; and then using the Nature, AAAS Science, Elsevier, arXiv and other journal databases to collect the DOI numbers to obtain the target text data set.
[0034] S102, as shown in Figure 2 The entity extraction prompt word is constructed according to the large language model, and the target entity containing the target data is extracted from the text data set by using the large language model and the entity extraction prompt word, and the number of target entities is recorded, including:
[0035] S201, the entity extraction prompt word is constructed according to the context analysis ability of the large language model, and the entity extraction prompt word includes a judgment prompt word and an extraction prompt word.
[0036] Specifically, according to the different context analysis capabilities of different large language models, more applicable judgment prompt words and extraction prompt words are constructed, such as: for large parameter full-size models (such as GPT series, Qwen3 large model, DeepSeek full model, etc.), strong instruction understanding ability and sample learning ability are possessed; when designing prompt words, a moderate few-shot (few sample example) mechanism can be introduced, by providing 2-5 typical cases (including input conditions, reasoning process and output results) highly matched with the target task scene, guiding the model to quickly align the task logic. For small parameter light weight models (such as various mobile terminal adaptation models, light weight API models, etc.), due to the limited computing resources and weak context processing ability, excessive complex prompt words or additional samples will cause high model load, and even cause information overload, reasoning deviation and other problems; follow the principle of "extreme simple instruction + clear output format", directly focus on the core task target, omit redundant examples and explanatory content, in order to reduce the model processing pressure, and ensure the execution efficiency and result stability of the basic task.
[0037] S202, judging whether the text data set contains target data based on the judgment prompt word through the large language model, taking the data set containing the target data as the text data set to be extracted.
[0038] Specifically, the target data can contain multiple texts, for example, the target data is steel composition, steel process and steel performance. For text data, a sentence containing any one text in the target data is taken as the text data set to be extracted; for table data, a table containing any one text in the target data in the table title is taken as the text data set to be extracted.
[0039] S203, extracting entities from the text data set to be extracted by using the large language model and the extraction prompt word, adding different special characters before and after the entity respectively, taking the entity with special characters as the target entity, and recording the number of target entities.
[0040] Among them, the target entity includes composition entity, process entity and performance entity.
[0041] Specifically, the target entity is an entity data set, and the number of target entities is the length of the above entity data set. Adding different special characters before and after the entity can be realized directly through the extraction prompt word, and the special character can be " @@ " or " ## ".
[0042] First, regarding sentence classification based on prompt words: In the relevant papers extracted through initial keyword searches, the ratio of relevant sentences to irrelevant sentences is typically about 1:100. Therefore, classifying sentences based on prompt words simplifies information extraction and entity recognition tasks, effectively improving the accuracy of information extraction. Second, regarding entity recognition: This embodiment fully leverages the generation advantages of the large language model. By instructing the large language model to add special characters "@@" and "##" before and after entities using prompt words, a prompt framework is constructed. This method significantly improves the accuracy of metal entity recognition. Verification shows that the improvement in precision, recall, and F1 score all exceed 2%. The F1 score is the harmonic mean of precision and recall, used to comprehensively evaluate model performance. Precision: The proportion of results predicted as positive by the model that are actually positive. Recall: The proportion of all actual positive examples that were successfully predicted as positive by the model.
[0043] This embodiment presents an efficient prompt word design approach for extracting specific entities from structured text. It can be directly applied to scenarios involving the extraction of metal entity names and also provides a reference for extraction tasks of other types of entities. The large language model mentioned is an existing model that includes intelligent question answering and text generation capabilities, such as DeepSeek, QWEN3, and the GPT series, which can be invoked using APIs or local deployment.
[0044] S103, such as Figure 3 As shown, relation extraction prompts are constructed based on a large language model. Based on the target entities and their number, relations are extracted from the text dataset using the large language model and the relation extraction prompts to obtain the target text dataset, which includes:
[0045] S301. Construct relation extraction prompts based on the context analysis capabilities of the large language model, wherein the relation extraction prompts include small sample relation extraction prompts and large sample relation extraction prompts.
[0046] Specifically, based on the different context analysis capabilities of different large language models, more applicable small-sample relation extraction prompts and large-sample relation extraction prompts are constructed.
[0047] S302. If the number of target entities is equal to 1, based on the target entities, use a large language model and small sample relation extraction prompts to extract relations from the text dataset to obtain a small sample text dataset.
[0048] Specifically, the text dataset, target entities, and few-sample relation extraction prompts are input into the large language model. The large language model extracts data from the text dataset that conforms to the prompts of the few-sample relation extraction as the few-sample text dataset.
[0049] As some optional implementations of the present embodiment, if the number of target entities is equal to 1, the specific content of the prompt word is as follows:
[0050] (1) For component entities: the prompt instruction for steel name head entity relationship extraction is: "You are an expert in the field of steel, your task is to identify steel name entities from the text. Rules: Steel name entity: specific alloy grade or component system of steel (for example, X70, X80 and Fe-Cr-Ni-Mo alloy system). Exclusion items: single metal elements (such as iron, chromium) and non-steel alloys (such as aviation aluminum alloy). Input text: The following is the input text for you to analyze: {text} Output requirement: Must strictly follow the following return format: {{"metal_entities":[]}}".
[0051] (2) For process entities and performance entities: the following is an example of steel relationship extraction prompt instruction for process (final rolling temperature, cooling rate) and performance (yield strength, toughness): "You are an expert in the field of steel, please perform relationship extraction task on the text {text} according to the given metal name entity {ent}. You need to accurately extract the following six attribute information (if the text does not mention a certain attribute, fill in null for the corresponding value), and output in the specified JSON format: composition: element composition and proportion of metal materials (need to extract element symbol, content value and unit, for example, "Fe80%, C0.5%").
[0052] Final rolling temperature: the final temperature value in the metal rolling process (need to include units such as ℃, or can be room temperature, etc.); Cooling rate: the rate value in the cooling stage (need to include units such as ℃ / s, ℃ / min); Tensile strength: the tensile strength index of material mechanics performance (need to include numerical value and unit); Yield strength: the yield strength index of material mechanics performance (need to include numerical value and unit); Toughness: an index related to the material's ability to resist fracture (such as impact toughness, need to include numerical value and unit).
[0053] Output format requirement: json
[0054] {{
[0055] "metalentity":"{ent}",
[0056] "composition":"(extract content, or fill in null if there is none)",
[0057] "finalrollingtemperature":"(extract content, or fill in null if there is none)",
[0058] "coolingrate":"(Extract content, fill in null if none)",
[0059] "tensilestrength":"(Extract content, fill in null if none)",
[0060] "yieldstrength":"(Extract content, fill in null if none)",
[0061] "toughness":"(Extract content; fill in null if none is found)"
[0062] }}
[0063] Key points for implementation: Numerical values must retain their original units and modifiers (such as "approximately", "≥", etc.); strictly adhere to JSON syntax specifications, use double quotes for strings, and avoid redundant symbols; if a component contains multiple elements, separate them with commas, " (e.g., "Al95%,Cu3%,Mg2%").
[0064] S303. If the number of target entities is greater than 1, based on the target entities, use a large language model and large sample relation extraction prompts to extract relations from the text dataset to obtain a text relation dataset, which includes text entities and text entity relations; construct an evaluation model, train the evaluation model using a binary cross-entropy loss function, use the trained evaluation model to evaluate the text relation dataset, and use the text relation dataset whose evaluation results meet the evaluation criteria as a large sample text dataset.
[0065] Specifically, the text dataset, target entities, and large sample relation extraction prompts are input into the large language model. The large language model extracts data that conforms to the large sample relation extraction prompts from the text dataset as the text relation dataset.
[0066] As some optional implementation methods of this embodiment, if the number of target entities is greater than 1, the same prompt word as when the number of target entities is equal to 1 is used to extract information for each target entity, and the extracted JSON format is stored in a list for evaluation of the evaluation model below.
[0067] In this embodiment, as Figure 4 As shown, the evaluation model is constructed by training it using a binary cross-entropy loss function. The trained evaluation model is then used to evaluate the text relation dataset. The text relation dataset whose evaluation results meet the evaluation criteria is used as a large-sample text dataset, including:
[0068] S401, such as Figure 5As shown, the evaluation model is used to extract a target proper noun vector dataset from the text relationship dataset, including:
[0069] S501, constructing a proper noun dictionary, extracting dictionary data of a target entity from the proper noun dictionary.
[0070] Specifically, constructing a proper noun dictionary includes: using a large language model to filter the vocabulary in the Wikipedia dictionary, for example, selecting steel industry specific terms such as stainless steel, pipeline steel, cold rolling and forging, and their explanation information as the proper noun dictionary.
[0071] As some optional embodiments of the present embodiment, the explanation of "stainless steel" in the proper noun dictionary is: stainless steel is an iron-based alloy containing not less than 10.5% chromium, which can form a chromium oxide passivation film on the surface, thereby having the characteristics of resisting atmospheric, acid and alkali corrosion. Usually add elements such as nickel and molybdenum to form various types such as austenite and ferrite. Stainless steel has high strength, beauty and easy cleaning, and is widely used in kitchen utensils, construction, medical treatment and other fields.
[0072] S502, as Figure 6 shown, the BERT model is used to convert the text relationship dataset and the dictionary data into target text vectors and dictionary vectors, including:
[0073] S601, converting the text relationship dataset into a target text vector by the encoder of the BERT model, wherein the target text vector is a multi-dimensional vector.
[0074] S602, inputting the dictionary data into the BERT model, adding position coding in the dictionary data through the Embedding layer of the BERT model and converting it into a dictionary data vector, inputting the dictionary data vector into the encoder of the BERT model, and obtaining a dictionary vector, wherein the dictionary vector is a multi-dimensional vector corresponding to the CLS mark.
[0075] Specifically, the target text vector and the dictionary vector are both vector datasets, and each vector in the vector dataset is a 768 multi-dimensional vector.
[0076] Using the BERT model to convert the text relationship dataset and the dictionary data into target text vectors and dictionary vectors can effectively capture the overall semantic information of the explanation text, avoid semantic fragmentation caused by character splitting; at the same time, it can accurately understand the logical relationship before and after the text, and realize the deep semantic modeling of the explanation content. In this way, a better semantic representation basis is provided for the subsequent natural language processing model, which significantly improves the understanding ability and processing effect of the model on the text semantics.
[0077] S503, match the text entity and the dictionary vector of the text relation data set to obtain a target entity dictionary vector, and then splice the target text vector and the target entity dictionary vector to obtain a target proper noun vector data set.
[0078] In the embodiment, as shown in the formula (1), the matching of the target entity and the dictionary vector to obtain the target entity dictionary vector comprises: Figure 7
[0079] S701, sort the dictionary vector in reverse order, and extract a target reverse dictionary vector corresponding to each text entity in the text relation data set.
[0080] Specifically, the reverse order sorting refers to preferentially arranging the words with more characters in the dictionary, so as to maximize the matching and effectively retain the semantic information.
[0081] In the embodiment, the extraction of the target reverse dictionary vector corresponding to each text entity in the text relation data set comprises: taking the dictionary vector containing single or multiple characters in the text entity in the reverse dictionary vector as the target reverse dictionary vector of the text entity.
[0082] S702, divide the target reverse dictionary vector according to the position of each character in each text entity in the target reverse dictionary vector to obtain a BMES four data set of each character, comprising:
[0083] (1) sequentially judge whether each character in each text entity has a corresponding dictionary vector in the target reverse dictionary vector, if yes, execute (2), if not, execute (3).
[0084] (2) if the current character is at the starting position of the corresponding dictionary vector, the current corresponding dictionary vector is taken as the B data set; if the current character is at the middle position of the corresponding dictionary vector, the current corresponding dictionary vector is taken as the M data set; if the current character is at the end position of the corresponding dictionary vector, the current corresponding dictionary vector is taken as the E data set; if the corresponding dictionary vector of the current character is a single character, the current corresponding dictionary vector is taken as the S data set.
[0085] (3) if the current character has no corresponding dictionary vector in the target reverse dictionary vector, the character is marked as "None".
[0086] S703, calculate the weight of the BMES four data set of each character, splice the BMES four data sets of each character according to the weight to obtain the dictionary vector of each text entity in the text relation data set, and all the text entity dictionary vectors of the text relation data set constitute the target entity dictionary vector.
[0087] In the embodiment, weights of the BMES four data sets of each character are calculated, including:
[0088] ;
[0089] ;
[0090] wherein, is the weight; is the sum of the appearance frequencies of all words in the union set of the BMES four data sets; is a word; is one of the BMES four data sets; is a word w in the statistical data; is a word embedding lookup table; is the union set of the BMES four data sets.
[0091] Although the BMES four data sets can express the meaning of each character in the target entity as a start, middle, end and single word, all words in the data set are assigned the same weight, and the semantic contribution difference of the words in the entity cannot be reflected, so in the embodiment, the use frequency of each word is obtained by using the historical word frequency of the literature, the key of the word is obtained, and the generalization ability of the model is effectively improved.
[0092] In the embodiment, the BMES four data sets of each character are spliced, including:
[0093] ;
[0094] wherein, is a joint feature vector formed by splicing the weights of the BMES four data sets; is the weight of the first data set ; is the weight of the second data set ; is the weight of the third data ; is the weight of the fourth data set ; is an original feature vector; is a feature vector obtained by splicing the weights of the BMES four data sets.
[0095] By prioritizing the matching of words with more characters through reverse ordering, the maximum matching is achieved, and the semantic fragmentation problem is solved, such as the complete matching of "low-carbon austenitic stainless steel". By dividing the target reverse dictionary vector into four BMES datasets for each character, the matching is directed at the structural role of the character in the entity, improving efficiency and relevance. By calculating the BMES dataset weight based on word frequency and structurally splicing, the vector fuses structural information and semantic importance, strengthening semantic expression. At the same time, BMES division and weight splicing convert entity structure features into quantifiable vectors, helping the model capture word formation rules and improve downstream task performance. Dynamic weight adjustment is compatible with complex entities containing rare characters, which can solve the problem of semantic ambiguity caused by equal weight and enhance the universality of the method.
[0096] By using a large language model to screen industry-specific terms in the Wikipedia dictionary and providing detailed explanations, the professional and accurate nature of the dictionary data is ensured, and the semantic richness and representation ability of the specific term vector are enhanced. With the help of the BERT model, the text relationship dataset and the dictionary data are converted into target text vectors and dictionary vectors, respectively, which can capture the context semantics, so that the vector not only contains literal information, but also incorporates deep semantic associations. Through matching and splicing, the target specific term vector dataset fuses the dynamic semantics of the text entity in the specific context and the standard field definition in the dictionary, making the vector representation of the specific term more rich and comprehensive. In this way, the specific term vector can more accurately reflect the relationship between entities, providing high-quality feature support for the evaluation model to evaluate entity relationships. The present embodiment effectively guarantees the quality of the target specific term vector dataset by rigorous dictionary construction, accurate vector conversion and fusion, combined with the screening of the evaluation model, and improves the field relevance and accuracy of the specific term vector.
[0097] S402, calculating a target non-specific term vector dataset according to the text relationship dataset and the target specific term vector dataset.
[0098] In the present embodiment, the target non-specific term vector dataset = text relationship dataset - target specific term vector dataset.
[0099] S403, using the evaluation module of the evaluation model to evaluate the target specific term dataset and the target non-specific term dataset, and taking the text relationship dataset that meets the evaluation standard as the large sample text dataset.
[0100] In the present embodiment, the evaluation module of the evaluation model comprises:
[0101] ;
[0102] ;
[0103] ;
[0104] ;
[0105] ;
[0106] wherein, is the concatenated feature vector; is the target non-proper noun vector dataset; is the target proper noun vector dataset; is the dimension space of the feature vector; is the query vector; is the weight matrix of the query vector; is the bias term of the query vector; is the key vector; is the weight matrix of the key vector; is the bias term of the key vector; is the dimension of the key vector; is the transpose of the query vector ; is the association score between the pair of entities ; is the end position index of the first entity in the sentence; is the index of the token in the first entity ; is the start position index of the first entity in the sentence; is the end position index of the second entity in the sentence; is the index of the token in the traversed object entity ; is the start position index of the second entity in the sentence; is the attention score between the th token of the subject entity and the th token of the object entity.
[0107] Specifically, when , the entity relationship is considered to be true, otherwise the entity relationship is considered to be false, and the text relationship dataset with the entity relationship being true is taken as the large sample text dataset.
[0108] By concatenating the target proper noun and the non-proper noun vector dataset into a feature vector, the entity itself and the context information are fused, and then the association score of the pair of entities is calculated by means of the attention mechanism , avoid the one-sidedness of single vector evaluation, make the true or false judgment of entity relationship more accurate, and screen out high-quality large sample text data sets. The introduction of attention score matrix and normalization processing reduces the interference of entities of different lengths on the results. No matter the length of the entity, the correlation score can be calculated by the attention score between the internal tokens. The results remain stable in various text scenarios and adapt to entity relationship evaluation of different types and lengths. The embodiment fully integrates double information to make the evaluation basis more comprehensive and improve the judgment accuracy.
[0109] In the embodiment, the binary cross-entropy loss function comprises:
[0110] ;
[0111] wherein, is the calculation result of the binary cross-entropy loss function; is the first index; is the second index; is the output value obtained by processing through the sigmoid activation function; is the label of the pair ; is the value of the row and the column in the attention score matrix.
[0112] The sigmoid function is used to convert the attention score into a probability value. The logarithmic loss is calculated for positive and negative sample labels respectively to accurately quantify the deviation between the prediction and the true label. The model can optimize the parameters and improve the accuracy of entity relationship judgment. At the same time, it uses differential loss calculation for positive and negative samples to strengthen the model's boundary awareness of "true" and "false" relationships and enhance the ability to distinguish positive and negative samples. The error is converted into a specific loss value, making the training process controllable and facilitating the adjustment of strategies according to the loss fluctuations to improve efficiency. Compared with the prior art, the embodiment is designed for binary classification and is suitable for entity relationship judgment scenarios. The training is more stable and converges faster. It can balance the attention to positive and negative samples, alleviate the sample imbalance problem, and improve the generalization ability. The formula is simple, the parameters are clear, the model is easy to debug and optimize, and the practicality is stronger.
[0113] The evaluation model forms a feature vector by splicing the target proper noun vector and the non-proper noun vector, combines the entity's own attributes with the context information, and then calculates the correlation score of the entity pair by means of the attention mechanism , which breaks through the limitation of single feature dimension; this fusion not only retains the core identification information of the entity, but also incorporates the semantic association clues in the context, enabling the model to deeply analyze the nature of the relationship from the interaction level of entity internal tokens, greatly improving the recognition accuracy of complex text relationships. Through dynamic calculation of the attention score matrix weight, the model can automatically adjust the attention weight of the entity token according to different text scenarios, giving higher attention to token pairs with close semantic association and effectively suppressing noise information. At the same time, combined with the training optimization of the binary cross-entropy loss function, the model can learn the general relationship judgment rules in large-scale data, significantly improving the evaluation generalization of the text relationship dataset. The evaluation model of the embodiment realizes the collaborative use of entity information and context information through the separation and fusion of special / non-special noun vectors, solves the evaluation one-sidedness caused by information fragmentation, and makes the relationship judgment more in line with the real semantics of the text; at the same time, the evaluation model can further distinguish the strength of the relationship through the continuous value score of , providing a more detailed basis for data set screening.
[0114] S304, taking the small sample text data set and the large sample text data set as a target text data set.
[0115] Through precise adaptation of prompt words and model capabilities, the extraction of large language models is maximized. Customizing prompt words for the context analysis capabilities of large language models avoids the problem of mismatch between general prompt words and model performance for models with weak context processing capabilities. First, the target entity of the target segment is obtained, and then the target entity is processed differently according to the number of target entities. When the number of target entities is 1, the large model is used to extract prompt words to perform relationship extraction on the text; when the number of target entities is greater than 1, the multi-entity relationship is extracted using the extraction prompt words, and then filtered through the evaluation model, taking into account the efficiency and data quality of large-scale extraction. For multi-entity scenarios, the evaluation model filtering step is added after large-scale prompt word extraction, and the model trained by the binary cross-entropy loss function quantitatively verifies the entity relationship, effectively filtering false relationships, ambiguous associations and other noise that may occur during large language model extraction. The final target text data set not only contains rich entity relationships, but also has high authenticity. The embodiment processes the number of entities in a bifurcated manner, maximizes efficiency in single-entity scenarios, and guarantees quality in multi-entity scenarios through the "extraction + evaluation" dual mechanism, avoiding resource redundancy and solving the data reliability problem in complex scenarios. The embodiment introduces an independent evaluation model in the multi-entity scenario, building a "large language model extraction + professional evaluation model verification" double closed loop, filtering biased data through quantitative scoring, making up for the limitations of relying solely on large language models, and making the quality of the target text data set more controllable and more in line with actual application needs.
[0116] In some optional implementations of the embodiment, the target text dataset is formatted in a dictionary or a lightweight data interchange format JSON.
[0117] In S104, a shortest path matching algorithm is used to match the target text dataset to obtain structured target text data, including:
[0118] (1) Data preprocessing
[0119] 1) Entity and attribute annotation: The target text dataset is structured to clearly identify the metal entities and corresponding performance attributes (such as "conductivity", "yield strength", and "toughness") in each text segment and assign a unique identifier to each.
[0120] 2) Missing information marking: The paragraphs with missing information are screened, and the missing performance attribute categories are recorded. For example, a paragraph contains only "HSLA steel - yield strength (600 MPa)", and the missing attributes such as "steel - toughness (such as impact energy)" are marked.
[0121] (2) Construction of graph structure
[0122] 1) Node definition: Each metal entity and its existing performance attribute combination is combined as a node in the graph, such as "HSLA steel - yield strength (600 MPa)" and "HSLA steel - toughness (27 J)" are independent nodes.
[0123] 2) Edge weight calculation: The "information correlation degree" between nodes is used as the weight of the edge. The correlation degree is calculated by text similarity (cosine similarity), and if two texts refer to the same metal entity or describe similar performance attributes, the weight is lower (indicating a shorter path); otherwise, the weight is higher.
[0124] 3) Initialization: The node with missing information is set as the starting point (such as "HSLA steel - yield strength (600 MPa)"), and the distance from the starting point to itself is set to 0, and the initial distance to other nodes is set to infinity.
[0125] 4) Path search: The shortest path from the starting point to other nodes is iteratively searched. Each time the node with the shortest current distance is selected, and the distances of its adjacent nodes are updated (if the path through the current node to the adjacent node is shorter, the distance value is updated).
[0126] 5) Determine the matching node: When the node containing the missing attribute is searched, record the weight corresponding to the shortest path, and the node with the smallest weight is the optimal matching node.
[0127] (3) Information fusion and supplementation
[0128] 1) Attribute migration: migrate the missing attribute information in the matching node pointed by the shortest path to the paragraph where the starting node is located.
[0129] 2) Conflict handling: if the attribute information of the matching node conflicts with the existing information, the node information with lower weight (i.e. higher correlation) is retained.
[0130] 3) Use the shortest path matching algorithm Dijkstra algorithm to combine the extracted information to form complete information, i.e. structured target text data.
[0131] In some optional implementations of the present embodiment, the structured target text data is stored in Excel, a separate row is set for each target entity, and its related data (such as process data, performance data, etc.) is stored in the corresponding column, ensuring clear display and easy analysis of the data.
[0132] Embodiment 2
[0133] 1. Obtain the target text and convert it to Markdown format:
[0134] (1) Obtain the target text: use the keywords "Steel", "Iron" and "Fe alloy" as retrieval conditions to retrieve the DOI (Document Identifier) of the relevant scientific research text from the Web of Science database, and then use the journal database to collect scientific research texts through the DOI number. The journal database includes but is not limited to Elsevier database, Nature journal database, AAAS Science database, etc.
[0135] As some optional implementations of the present embodiment, the target text can be obtained from a scientific research text about pipeline steel X80 steel controlled rolling and controlled cooling process by the above method.
[0136] (2) Convert to Markdown format:
[0137] 1) Application stage of optical character recognition (OCR) technology: convert the PDF format of the steel scientific research text collected in the collection stage into computer-readable Markdown format. The present invention uses optical character recognition (OCR) technology, such as MinerU, to convert each scientific research text in the steel scientific research text data set from PDF format to Markdown format, making the scientific research text more suitable for the next step of processing.
[0138] 2) Table icon parsing process: OCR technology parses the table icons in the PDF into a text HTML format that the computer can better understand. During the parsing process, a special table recognition algorithm (target detection model) is used to accurately identify the structure and content of the table and convert it into an HTML table tag form for better processing of table data in the future. The table is stored in a Markdown format file.
[0139] 3) Use regular matching technology to filter the contents of the Markdown file. Segment the text information by chapter, and fully retain the scientific research text information. At the same time, each table is disassembled into a "table title-table content" key-value pair form.
[0140] Text sentence processing: When using regular matching to split the paragraph text by periods, it is necessary to avoid misidentifying the decimal point "." as a period for splitting. The following formula is used to achieve this: re.split(r'(?<!\d)\.(?!\d)|[!?]', text), which retains the text information and splits it.
[0141] Table title extraction: By analyzing the text structure, it can be known that the table title is usually after a paragraph and before a table. Based on this rule, the following regular matching formula can be used to achieve it: "re.findall(r'([^\n]+)\s*', text, re.DOTALL)", which extracts the table title.
[0142] 2、Extract target entities
[0143] (1) Construct prompt word prompt1 to determine whether the text sentence contains the information to be extracted by a large language model: construct prompt word prompt1 according to the pre-set extraction information, and combine the large language model to determine the sentence; if the large language model determines that the sentence contains the information to be extracted, it is retained; otherwise, if the large language model determines that the sentence does not contain the required information, it is discarded.
[0144] As some optional embodiments of the present embodiment, the prompt word prompt1 is "As an expert in the steel industry, please answer the following text whether it contains the information to be extracted in the steel industry, such as steel name entity, steel processing technology entity and steel performance entity. If it contains, reply "Yes", if it does not contain, reply "No".
[0145] (2) Construct prompt word prompt2 to determine whether the table title contains the information to be extracted by a large language model: construct prompt word prompt2 according to the pre-set extraction information, and combine the large language model to question the meaning of the table title; if the meaning of the table title belongs to the pre-set extraction information category, retain the title and content of the table; otherwise, discard the table.
[0146] As some optional implementations of the present embodiment, the prompt word prompt2 is "As an expert in the field of steel, please determine whether the table title meaning belongs to the following three tables: 'component table', 'processing technology table', 'performance table'. If it belongs to, reply "Yes", if it does not belong to, reply "No".
[0147] (3) For the reserved sentences and table construction prompt word prompt3, and combined with the large language model, entity recognition is carried out on each sentence and each table to identify steel name entities. Since the large language model belongs to the generation model, the effect is not good compared with direct entity recognition, so the prompt word used in the present embodiment is to generate the original sentence, and @@ and ## are added before and after the steel name entity. Using regular matching, the steel name entity is extracted.
[0148] As some optional implementations of the present embodiment, the prompt word prompt3 is "As an expert in the field of steel, please accurately extract the steel name entity in the following text. The output format requires: completely retain the original sentence content, and add symbols " @@ " and " ## " before and after the extracted steel name entity, respectively, to ensure clear entity boundaries, for example: if the original sentence is "Today, Q235B steel and stainless steel are purchased", then the output is "Today, @@ Q235B ## steel and @@ stainless steel ##". Please strictly follow the format specification to perform entity annotation".
[0149] As some optional implementations of the present embodiment, regular matching is used to match the text sentences and tables through the re.findall(r"@@(.*?)##", text) regular matching expression to obtain the steel name entity (i.e. target entity), and the steel name entity is de-duplicated to record the number of steel name entities.
[0150] 3, Relationship extraction
[0151] (1) If the number of target entities is equal to 1, according to the target entity, a prompt word prompt4 is constructed for the target text to give an example learning (Few-Shot Learning), and combined with the large language model, entity recognition is carried out on each target text to identify the relevant data information of the target entity.
[0152] As some optional implementations of this embodiment, the target entity relation extraction prompt word prompt4 is "You are an expert in the steel industry, and your task is to identify steel name entities from text. Rules: Steel name entities: specific alloy grades or composition systems of steel (e.g., X70, X80, and Fe-Cr-Ni-Mo alloy systems). Exclusions: single metallic elements (e.g., iron, chromium) and non-steel alloys (e.g., aerospace aluminum alloys). Input text: The following is the input text for you to analyze: {text} Output requirements: must strictly follow the following return format: {{"metal_entities":[]}}".
[0153] As some optional implementations of this embodiment, the prompt word 'prompt5' for the target entity's process (final rolling temperature, cooling rate) and properties (yield strength, toughness) is: "You are an expert in the steel industry. Please perform a relation extraction task on the text {text} based on the given metal name entity {ent}. The following six attribute information must be accurately extracted (if an attribute is not mentioned in the text, the corresponding value should be null), and output in the specified JSON format: Composition: Elemental composition and proportion of the metallic material (the element symbol, content value, and unit must be completely extracted, for example, 'Fe 80%, C 0.5%')."
[0154] Final rolling temperature: The final temperature value during the metal rolling process (must include units, such as ℃, or room temperature, etc.) Cooling rate: The rate value during the cooling stage (must include units, such as ℃ / s, ℃ / min) Tensile strength: The tensile strength index in the mechanical properties of materials (must include the value and unit) Yield strength: The yield strength index in the mechanical properties of materials (must include the value and unit)
[0155] Toughness: An indicator related to a material's resistance to fracture (such as impact toughness, which must include numerical values and units).
[0156] Output format requirement: JSON
[0157] {{
[0158] "metalentity":"{ent}",
[0159] "composition":"(Extract content, enter null if none)",
[0160] "finalrollingtemperature":"(Extracted content, fill in null if none)",
[0161] "coolingrate":"(Extract content, fill in null if none)",
[0162] "tensile strength": "(extract content, or fill null if none)",
[0163] "yield strength": "(extract content, or fill null if none)",
[0164] "toughness": "(extract content, or fill null if none)"
[0165] }}
[0166] Execution points: numerical values need to be kept complete with original units and modifiers (such as "about", "≥", etc.)
[0167] Strictly follow the JSON syntax specification, use double quotes for strings, avoid redundant symbols
[0168] If the composition contains multiple elements, separate them with commas ", " (for example "Al95%, Cu3%, Mg2%")."
[0169] (2) If the number of target entities is greater than 1, extract data for each target entity using the above method. The relevant data extracted for each target entity is evaluated using the DBAA_MODEL evaluation model. According to the evaluation result, it is determined: if it belongs to the steel entity, the relevant data is retained, otherwise the relevant data is discarded.
[0170] Specifically, a proper noun dictionary is constructed, and dictionary data of the target entity is extracted from the proper noun dictionary. Specifically, the construction of the proper noun dictionary includes: using a large language model to filter the vocabulary in the Wikipedia dictionary, for example, selecting steel industry specific terms such as stainless steel, pipeline steel, cold rolling and forging, and their explanation information as the proper noun dictionary. For example: the explanation of "stainless steel" in the proper noun dictionary is: stainless steel is an iron-based alloy containing not less than 10.5% chromium, which can form a chromium oxide passivation film on the surface, thereby having the characteristics of resistance to atmospheric, acid and alkali corrosion. Usually add nickel, molybdenum and other elements to form austenite, ferrite and other types. Stainless steel has high strength, beautiful appearance and easy cleaning, and is widely used in kitchen utensils, construction, medical treatment and other fields.
[0171] As some optional implementations of the present embodiment, the DBAA_MODEL model is pre-trained using 800 sentences, with an accuracy of over 90%.
[0172] The relevant data extracted for each target entity is evaluated using the DBAA_MODEL evaluation model, including:
[0173] 1) Calculate the target non-proper noun vector dataset according to the text relationship dataset and the target proper noun vector dataset. For example, the text is "When austenitic stainless steel is annealed at 1050℃ and cooled at a rate of 5℃ / min, its tensile strength is about 650MPa, yield strength is about 300MPa, and impact toughness reaches 80J / cm²; when low-carbon austenitic stainless steel is annealed at 900℃ and the cooling rate is increased to 20℃ / min, its tensile strength can be increased to 720MPa, yield strength is increased to 350MPa, and impact toughness is reduced to about 60J / cm²", wherein austenitic stainless steel, tensile strength, yield strength and impact toughness are proper noun vector dataset, and BMES dataset of each character of each word is obtained by matching the dictionary, and then splicing.
[0174] 2) Evaluate the target proper noun dataset and the target non-proper noun dataset using the evaluation module of the evaluation model. For example: austenitic stainless steel and low-carbon austenitic stainless steel have corresponding performance entities, such as 1050℃, which is evaluated for austenitic stainless steel and is retained if greater than 0.6, and each performance entity in the above is evaluated with the metal entity, and the value of the performance entity is evaluated with the performance and is retained only if greater than 0.6.
[0175] According to an embodiment of the present application, the present application also provides an electronic device.
[0176] The electronic device is intended to represent a variety of forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent a variety of forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown in the figures, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the applications described and / or claimed in this document.
[0177] The electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0178] A plurality of components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0179] The computing unit 801 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs various methods and processes described above, such as the methods S101-S104. For example, in some embodiments, the methods S101-S104 can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded to the RAM 803 and executed by the computing unit 801, one or more steps of the methods S101-S104 described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the methods S101-S104 by any other appropriate means, such as by means of firmware.
[0180] Various implementations of the systems and techniques described above herein can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0181] Program code for carrying out methods of the present application can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, causes the machine to perform the functions / acts specified in the flow diagrams and / or block diagrams. The program code can execute entirely on a machine, partly on a machine, as a stand-alone software package, partly on a machine and partly on a remote machine or entirely on a remote machine or server.
[0182] According to embodiments of the present application, the present application has the following advantages compared with the prior art:
[0183] (1) The application of large language models to the steel industry data extraction field has achieved a new technological breakthrough. Compared with traditional conventional tools, the present application can be widely applicable to various types of scientific research texts such as academic papers, invention patents and industry standards, and has a significant advantage of universality.
[0184] (2) Compared with the traditional manual collection and extraction of steel data, the present application has higher accuracy, significantly reduces labor costs, and has stronger stability, effectively avoiding errors and fluctuations that may be caused by manual operation.
[0185] (3) Compared with the supervised deep learning method for extracting steel data, the present application avoids the complexity and weak interpretability of deep learning models as "black boxes", has stronger interpretability, is convenient for flexible modification of extraction targets according to actual needs, and is more competitive in terms of cost.
[0186] (4) The present application simplifies the task and enhances the accuracy by first extracting metal entities and then finding related performance and composition entities through head entities.
[0187] 1) Entity recognition task: The present application uses the generation task that large models are best at, allowing large models to generate and improve accuracy by 15% before and after the target.
[0188] 2) Relationship extraction task: For texts with more than one head entity in the text, the present application performs secondary verification on the extracted relationships through a large model to improve accuracy: the results of the secondary verification are evaluated and verified by an evaluation model, and the evaluation method uses a BERT model as a base model; the dictionary and dictionary explanation information are output as a CLS token vector through BERT embedding, and the dictionary explanation [CLS] is spliced with the proper nouns in the relationship to improve the accuracy of the evaluation model. Table 1 shows the accuracy of the model.
[0189] Table 1
[0190]
[0191] It should be noted that, for the aforementioned method embodiments, the acts performed as part of the methods are illustrative only and that the present application is not limited to the acts illustrated. As will be apparent, one skilled in the art can
[0192] It should be understood that the various forms of flow shown in the figures are not inclusive of all of the data that can be acquired, processed, and used by the present application. For example, the various steps recited in the present application can be performed in parallel or in a different order, or can be omitted or combined, as long as the desired results of the present application are achieved. Moreover, data can be acquired, processed, and used by the present application in a different manner than that shown in the figures.
[0193] The specific embodiments have been shown and described for purposes of illustrating the present application. It will be readily apparent to those skilled in the art that various modifications, combinations, sub-combinations, and alternatives of the present application can be made in light of the teachings of the present application without departing from the spirit and scope of the present application. Accordingly, the present application is not intended to be limited to the examples described herein but is to be accorded the full scope of the claims appended hereto.
Claims
1. A large language model-based automatic text data extraction method, characterized in that, The method comprises the following steps: obtaining target text, and converting the target text into a Markdown format text, and then processing the content of the Markdown format text by using a regular matching technology to obtain a text data set, wherein the text data set comprises text data and table data; constructing an entity extraction prompt word based on a large language model, extracting a target entity containing target data from the text data set by using the large language model and the entity extraction prompt word, and recording the number of target entities; constructing a relationship extraction prompt word based on the large language model, extracting a relationship from the text data set based on the target entity and the number of target entities by using the large language model and the relationship extraction prompt word, and obtaining a target text data set; performing matching on the target text data set by using a shortest path matching algorithm to obtain a structured target text data; the method of constructing a relationship extraction prompt word based on the large language model, extracting a relationship from the text data set based on the target entity and the number of target entities by using the large language model and the relationship extraction prompt word, and obtaining a target text data set, comprises the following steps: constructing a relationship extraction prompt word based on the context analysis capability of the large language model, wherein the relationship extraction prompt word comprises a small sample relationship extraction prompt word and a large sample relationship extraction prompt word; if the number of target entities is equal to 1, extracting a relationship from the text data set based on the target entity by using the large language model and the small sample relationship extraction prompt word to obtain a small sample text data set; if the number of target entities is greater than 1, extracting a relationship from the text data set based on the target entity by using the large language model and the large sample relationship extraction prompt word to obtain a text relationship data set, wherein the text relationship data set comprises text entities and text entity relationships; constructing an evaluation model, training the evaluation model by using a binary cross-entropy loss function, evaluating the text relationship data set by using the trained evaluation model, and taking the text relationship data set that meets the evaluation standard as a large sample text data set; and taking the small sample text data set and the large sample text data set as the target text data set; the method of constructing an evaluation model, training the evaluation model by using a binary cross-entropy loss function, evaluating the text relationship data set by using the trained evaluation model, and taking the text relationship data set that meets the evaluation standard as a large sample text data set, comprises the following steps: extracting a target proper noun vector data set from the text relationship data set by using the evaluation model; calculating a target non-proper noun vector data set based on the text relationship data set and the target proper noun vector data set; and evaluating the target proper noun data set and the target non-proper noun data set by using an evaluation module of the evaluation model, and taking the text relationship data set that meets the evaluation standard as a large sample text data set; the evaluation module of the evaluation model comprises: ; ; ; ; ; wherein, is the concatenated feature vector; is the target non-proper noun vector dataset; is the target proper noun vector dataset; is the dimension space of the feature vector; is the query vector; is the weight matrix of the query vector; is the bias term of the query vector; is the key vector; is the weight matrix of the key vector; is the bias term of the key vector; is the dimension of the key vector; is the transpose of the query vector ; is the association score between the pair of entities ; is the end position index of the first entity in the sentence; is the index of the token in the first entity ; is the start position index of the first entity in the sentence; is the end position index of the second entity in the sentence; is the index of the token in the traversed argument entity ; is the start position index of the second entity in the sentence; is the attention score between the token of the subject entity and the token of the argument entity ; ; 2. The method of claim 1, wherein, the method of constructing an entity extraction prompt word based on a large language model, extracting a target entity containing target data from a text data set by using the large language model and the entity extraction prompt word, and recording the number of target entities, comprises the following steps: The entity extraction prompt word is constructed according to the context analysis capability of the large language model, and the entity extraction prompt word includes a judgment prompt word and an extraction prompt word; Based on the judgment prompt word, whether the text data set contains target data is judged by the large language model, and the data set containing the target data is used as a text data set to be extracted; The entity is extracted from the text data set to be extracted by using the large language model and the extraction prompt word, different special characters are added before and after the entity respectively, the entity with the special characters is used as a target entity, and the number of target entities is recorded. The target entity includes a component entity, a process entity and a performance entity.
3. The method of claim 1, wherein, The evaluation model is used to extract a target proper noun vector data set from the text relationship data set, and the method comprises the following steps: A proper noun dictionary is constructed, and dictionary data of the target entity is extracted from the proper noun dictionary; The BERT model is used to convert the text relationship data set and the dictionary data into a target text vector and a dictionary vector respectively; The text entity and the dictionary vector of the text relationship data set are matched to obtain a target entity dictionary vector, and the target text vector and the target entity dictionary vector are spliced to obtain a target proper noun vector data set.
4. The method of claim 3, wherein, The BERT model is used to convert the text relationship data set and the dictionary data into a target text vector and a dictionary vector respectively, and the method comprises the following steps: The text relationship data set is converted into a target text vector by the encoder of the BERT model, wherein the target text vector is a multi-dimensional vector; The dictionary data is input into the BERT model, the position encoding is added in the dictionary data by the Embedding layer of the BERT model, and the dictionary data is converted into a dictionary data vector, and the dictionary data vector is input into the encoder of the BERT model to obtain a dictionary vector, wherein the dictionary vector is a multi-dimensional vector corresponding to the CLS mark.
5. The method of claim 3, wherein, The text entity and the dictionary vector of the text relationship data set are matched to obtain a target entity dictionary vector, and the method comprises the following steps: The dictionary vector is sorted in reverse order, and a target reverse dictionary vector corresponding to each text entity in the text relationship data set is extracted; The target reverse dictionary vector is divided according to the position of each character in the target reverse dictionary vector to obtain a BMES four data set of each character; The weight of the BMES four data set of each character is calculated, and the BMES four data sets of each character are spliced according to the weight to obtain a text entity dictionary vector of the text relationship data set; and all text entity dictionary vectors of the text relationship data set constitute a target entity dictionary vector.
6. The method of claim 5, wherein, The weight of the BMES four data set of each character is calculated, and the method comprises the following steps: ; ; The BMES four data sets of each character are spliced, and the method comprises the following steps: ; wherein, is a weight; is the sum of the frequency of occurrence of all words in the union of the four BMES datasets; is a word; is one of the four BMES datasets; is a word w in the statistical data; is a word embedding lookup table; is the union of the four BMES datasets; is the joint feature vector formed by concatenating the weights of the four BMES datasets; is the weight of the first dataset ; is the weight of the second dataset ; is the weight of the third data ; is the weight of the fourth dataset ; is the original feature vector; is the feature vector obtained by concatenating the weights of the four BMES datasets.
7. An electronic device, comprising at least one processor; and a memory connected in communication with the at least one processor; characterized in that, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method in any one of claims 1-6.
Citation Information
Patent Citations
Information extraction method and device based on large language model, equipment and storage medium
CN119415669A