Water conservancy numerical value context information extraction method based on cascade framework
By adopting a cascade framework method in the field of water conservancy informatization, combining pre-trained models and multiple markers, the problem of poor numerical information extraction in the existing technology is solved, and accurate extraction of numerical context information and acquisition of high-quality data is achieved.
Patent Information
- Application Number
- CN202411808201.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-25
AI Technical Summary
The existing numerical information extraction methods are not effective in the field of water conservancy informatization, and it is difficult to completely extract the numerical information contained in the text, resulting in low data quality.
Using a cascading framework-based method, semantic representation is obtained through pre-training models, combined with numerical markers, units and modifier extractors, objects and relationship markers, numerical values, units, modifiers, objects and relationships are gradually identified and extracted.
The accurate extraction of numerical context information in texts in the water conservancy field has been achieved, data quality and utilization efficiency have been improved, and long-tail problems have been avoided.
Smart Images

Figure CN119884206A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a method for extracting water conservancy numerical context information based on a cascade framework. Background Art
[0002] In recent years, with the development of water conservancy informatization, the automation level in water conservancy project management, hydrological forecasting, water resources management and other fields has become increasingly higher, which has brought new challenges to the process of water conservancy informatization.
[0003] Hydrological data contains a large amount of numerical information, such as rainfall, water level, flow, etc. These data often exist in a large amount of text information, which makes it difficult to effectively extract and utilize them. With the development of computer technology, some rule-based methods have been proposed for numerical information extraction, but the formulation process of these rules is relatively cumbersome, and the extraction results directly depend on pre-defined rules or rule dictionaries, which are difficult to adapt to different text formats and data types. At present, the most commonly used method for numerical information extraction is the sequence annotation model, which belongs to a type of deep learning and can effectively extract numerical information. The sequence annotation model divides the text into sequences and annotates each sequence to identify the numerical information in the text. However, most models use the QVR (Quantity-Value Representation) structure, which believes that numerical information contains three semantic slots such as numbers, units, and variability. Although this representation is easy to extract, it has a coarse granularity and is prone to ignoring relevant contextual information.
[0004] In the current numerical information extraction model based on deep learning, a mainstream method is to learn numerical values and their contextual relationships through the BERT pre-training model. BERT is a pre-trained language representation model based on Transformer. It is pre-trained through massive text data to learn word vectors and contextual relationships between words. In the task of numerical information extraction, the BERT-based pre-training model can effectively capture the numerical information in the text, thereby improving the model's ability to understand and extract numerical information. However, in the task of numerical information extraction, there are still a large number of low-frequency entities and relationships, such as rare river names, reservoir names, etc. These low-frequency entities and relationships appear less frequently in the training data, making it difficult for the model to effectively learn them, resulting in a long-tail problem.
[0005] Existing numerical information extraction methods mostly focus on the extraction of numerical values and their unit information. These methods have good performance in data analysis, but they are not so effective in the field of water conservancy informatization. One of the main reasons is that the text in the field of water conservancy informatization not only contains numerical values and their units, but also involves a large number of entities, semantic features and contextual information. Therefore, the existing model may not be able to fully extract the complete numerical information contained in the text, resulting in low-quality application of a large amount of data. Based on this, a fine-grained numerical information extraction model can be trained through a cascade framework. The cascade framework can decompose a complex task into multiple simple subtasks and solve these subtasks in sequence in a certain order. Each subtask focuses on solving one aspect of the problem, and then passes the result to the next subtask until the entire task is completed. In this way, the model can effectively understand the numerical information in the text. The cascade counting method used in the framework only generates a limited number of negative samples, so the long tail problem can be avoided. Summary of the invention
[0006] Purpose of the invention: The present invention proposes a method for extracting water conservancy numerical context information based on a cascade framework, which overcomes the problems in the existing technical solutions, such as over-reliance on the formulation of rules or ignoring the integrity of numerical related context information.
[0007] Technical solution: The method for extracting water conservancy numerical context information based on a cascade framework described in the present invention comprises the following steps:
[0008] (1) Use the pre-trained model to obtain the semantic representation of the input paragraph text in the water conservancy field;
[0009] (2) using a numerical tagger to identify numerical values in an input paragraph; the numerical tagger is an integrated model including a CRF layer and a PointerNet layer; the PointerNet layer detects the start and end positions of numerical values respectively through two binary classifiers; the CRF layer regards numerical recognition as a sequence labeling problem and uses the BIOS labeling mode for prediction; and integrating the results of PointerNet and CRF to obtain the best numerical recognition result;
[0010] (3) The unit and modifier extractor is used to identify the unit corresponding to each numerical value through the unit extraction rule method; for each candidate numerical tag, the numerical n-gram context tag is selected and connected as the model input, and the modifier is classified according to the context information;
[0011] (4) Based on the extraction of numerical values from text, the object and relationship tagger takes into account the semantic features of the numerical values and predicts the entity, attribute, and contextual information of the numerical values. At the same time, the span prediction system based on two-way question and answer is used to determine the relationship classification between objects and numerical values.
[0012] Furthermore, the implementation process of step (1) is as follows:
[0013] The input text paragraph H is converted into the semantic representation X of the model. For input paragraphs exceeding the predefined maximum length, they are split into multiple parts by periods and encoded separately; H=Encoder(X) is used, and L is used to represent the length of the input paragraph.
[0014] Furthermore, the PointerNet layer in step (2) detects the starting and ending positions of the value through two binary classifiers respectively, and the implementation process is as follows:
[0015] After obtaining the encoding of the text paragraph, the PointerNet layer uses two identical binary classifiers to detect the starting and ending positions of the value respectively; a threshold score is set, and if the probability of the current tag exceeds this threshold score, it is assigned to 1, otherwise it is assigned to 0; the loss function of the quantifier tagger is as follows:
[0016]
[0017] Where L represents the length of the input paragraph, represents the true label of the i-th interval;
[0018] Each token is input into these two binary classifiers to predict whether the current token corresponds to the start or end position of a numerical segment; for a given context h i ∈H, the probability that the i-th token is identified as the starting position or the ending position of the value is calculated by the following formula:
[0019]
[0020] in, and represents the probability of predicting the start and end positions of the current token, W start and W end represents the weight matrix for identifying the start and end positions, b is the bias matrix, σ is the sigmoid activation function; and the threshold score is 0.7.
[0021] Furthermore, the CRF layer in step (2) regards numerical recognition as a sequence labeling problem and uses the BIOS label mode for prediction. The implementation process is as follows:
[0022] The CRF layer marks the numerical region output by the PointerNet layer in sequence, regards numerical recognition as a sequence labeling task, and selects BIOS as the label system; for a given representation sequence H = (h 1 ,h 2 ,…,h L ), a probability-based sequence detection conditional random field model is used. Given the context word representation H, the conditional probability distribution P(Y|H) of the label sequence Y is maximized during the training process. During decoding, if the state transition is illegal, its transition cost is set to infinity. Based on the maximum score in the decoding process, the expected label sequence Y=(y 1 ,y 2 ,…,y L );
[0023] First, the prediction result of the PointerNet layer is taken as the final result. If the value predicted by the CRF layer does not exist in the PointerNet result, it is added to the final result. Through weighted averaging, the weights are dynamically adjusted according to the outputs of the two modules to obtain the best value recognition result.
[0024] Furthermore, the unit extraction rule method implementation process of step (3) is as follows:
[0025] S1: Get the set V of all units that have appeared in the training set and the test set, and get the numerical string Q as input;
[0026] S2: Initialize pointer p to n, where n represents the length of Q, i.e., points to the last character of the numerical string Q;
[0027] S3: Loop through the characters in Q from i=1 to n:
[0028] If Q from the i-th character to the last character, that is, Q[i:n] is in the unit set, then return Q from the beginning to the i-th character Q[0:i], that is, find the unit corresponding to the value;
[0029] If Q[i] is a space, then update the pointer p to i+1 to eliminate the effect of the space on determining the unit result;
[0030] S4: After the loop ends, assign s to p, where s represents the starting position index of the first unit string in Q starting from the end of Q;
[0031] S5: Then enter a loop, starting from the end of Q, and traverse forward character by character; as long as s>0 and Q[s-1] is a character, that is, not other special characters, s is reduced by 1;
[0032] S6: If s>0, it means that the starting position of the unit string in the numerical string Q is found, then p is updated to s;
[0033] S7: Returns Q[p:n], that is, from the determined position p to the end of the value Q, that is, the extracted unit.
[0034] Furthermore, the implementation process of step (3) is as follows:
[0035] Unit extraction adopts a rule-driven strategy to build a database covering a wide range of units. The unit is determined by scanning the measurement string character by character, comparing it to the unit entry in the database, and looking for the longest suffix match. When direct matching fails, the algorithm implements a backtracking mechanism to capture potential units immediately before non-alphabetic characters to further optimize the extraction effect.
[0036] Modifier classifier selects metric tag x i The surrounding n-gram context {x i-n ,x i-n+1 ,…,x i ,x i+1 ,x i+n}, including the metric token itself, which is encoded using the BERT deep learning model to obtain c i :
[0037] c i =BERT([x i-n ;…;x i ;…;x i+n ])
[0038] Classifier for c i Apply the softmax function to calculate the probability distribution of each category and select the label with the highest probability as x i Types of modifiers:
[0039]
[0040] Furthermore, the implementation process of step (4) is as follows:
[0041] The object tagger configures a separate tagger for each possible relationship, and each tagger aims to discover the "entities" and "attributes" connected to the identified values; different from using the representation vector h i As an input numeric tagger, the object tagger also considers the semantic features of numeric values; when identifying the start and end positions of relational objects, the representation vector of the numeric value is Taking this into consideration, the ability to capture information around the value is enhanced; given the current mark h i For each context representation, the specific marking operation is as follows:
[0042]
[0043] in, and represents the probability of predicting the start and end positions of the current tag, is the representation of the kth quantity identified by the model encoder;
[0044] The relation tagger determines the relationship classification between objects and values through a span prediction system based on bidirectional question answering; for a given relation classification RC instance (c, e 1 ,e 2 )→r, through the two templates constructed and Convert to QA instance and generate QA dataset.
[0045] Furthermore, the process of classifying the relationship between objects in step (4) is as follows:
[0046] For each relationship classification, entity e 1 and entity e 2 Design two templates based on the keywords in the question and
[0047] For a given relation classification RC instance (c, e 1 ,e 2 )→r, and then converted into QA instances through the two constructed templates to generate the QA dataset:
[0048] Use r's forward template t r (e 1 )Generate a QA instance:
[0049] Use the reverse template t of r r (e 2 )Generate a QA instance:
[0050] Among them, c is a context, e 1 and e 2 corresponding to the head and tail entities, It is a relation classification in the predefined relation set R;
[0051] Based on the generated QA training data, a pre-trained language model based on BERT-Large is used to train a span prediction QA model.
[0052] Use a global threshold τ to distinguish between answerable and unanswerable questions, and set individual thresholds for each relationship classification. Individual threshold Adjustments are made based on the characteristics of the question set generated by each template, allowing the model to more accurately determine the answer to each question.
[0053] Furthermore, the context information of the numerical value in step (4) includes numerical value, unit, modifier, object, and relationship.
[0054] Beneficial effects: Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention realizes the accurate extraction of numerical context information by cascading multiple key components, providing a new method for the informatization construction in the water conservancy field; the present invention provides an efficient and accurate numerical context information extraction tool, which can help staff better understand and utilize the numerical knowledge in water conservancy-related texts during the process of water conservancy informatization. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of the present invention;
[0056] Figure 2 This is a structural diagram of the water conservancy numerical context information extraction model based on the cascade framework proposed by the present invention;
[0057] Figure 3 This is a flow chart of the unit extraction rule method proposed in the present invention. DETAILED DESCRIPTION
[0058] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0059] like Figure 1 , Figure 2 As shown, the present invention proposes a method for extracting water conservancy numerical context information based on a cascade framework, and the specific implementation process is as follows:
[0060] Step 1: Text preprocessing: Preprocess the input text paragraphs for subsequent model processing.
[0061] For input text processing, the upper limit of the length of a single sentence is set to 350 characters. Input paragraphs exceeding the preset maximum length are split into multiple segments by periods and encoded separately.
[0062] Choose to use the pre-trained language model BERT to encode the text fragments and obtain their semantic representation H; concatenate the encoded fragments into a complete paragraph representation H.
[0063] Step 2: Model encoder. It is used to convert the input text paragraph H into the semantic representation X of the model. For input paragraphs exceeding the predefined maximum length, they are split into multiple parts by periods and encoded separately. The semantic representation will be further used in the following tagging module. The present invention adopts H = Encoder (X) and uses L to represent the length of the input paragraph.
[0064] Step 3: Numeric tagger. Used to identify the numerical value in the input paragraph. This module is an integrated model that contains a CRF layer and a PointerNet layer. The PointerNet layer detects the start and end positions of the numerical value through two binary classifiers, while the CRF layer treats numerical recognition as a sequence labeling problem and uses the BIOS label mode for prediction. Finally, the results of PointerNet and CRF are integrated to obtain the best numerical recognition results.
[0065] After obtaining the encoding of the text paragraph, two identical binary classifiers are used in the PointerNet layer to predict the start and end positions of the value respectively, and the threshold score is set to 0.7. If the probability of the current tag exceeds this threshold score, it is assigned to 1, otherwise it is assigned to 0. The loss function of the quantifier tagger is as follows:
[0066]
[0067] Where L represents the length of the input paragraph, represents the true label of the i-th interval.
[0068] Each token is input into these two binary classifiers to predict whether the current token corresponds to the start or end position of a numerical segment. i ∈H, the probability that the i-th token is identified as the starting position or the ending position of the value can be calculated by the following formula.
[0069]
[0070] in, and represents the probability of predicting the start and end positions of the current token, W start and W end Represents the weight matrix for identifying the start and end positions, b is the bias matrix, and σ is the sigmoid activation function.
[0071] The CRF layer sequentially labels the numerical region output by the PointerNet layer, regards numerical recognition as a sequence labeling task, and selects BIOS (Beginning, Inside, Outside, Single) as the label system. For a given representation sequence H = (h 1 ,h 2 ,…,h L), a probability-based sequence detection conditional random field (CRF) model is used, which defines the conditional probability distribution P(Y|H) of the label sequence Y given the above context word representation H, and maximizes the logarithmic probability during training. During decoding, if the state transition is illegal, its transition cost is set to infinity. Based on the maximum score during decoding, the expected label sequence Y = (y 1 ,y 2 ,…,y L ).
[0072] Since the CRF layer tends to extract shorter spans, while the PointerNet layer tends to do the opposite, and the entity distribution in the dataset has long and short spans, an integrated model is used. The prediction result of the PointerNet layer is first used as the final result. If the value predicted by the CRF layer does not exist in the PointerNet result (i.e., there is no overlap), it is added to the final result. By weighted averaging, the weights are dynamically adjusted according to the outputs of the two modules to obtain the best value recognition results, and finally the boundaries of the value entity are output, thereby improving the overall performance.
[0073] Step 4: Unit and modifier extractor. Used to identify the unit and modifier corresponding to each predicted value. Unit extraction uses rules to efficiently match units in the text, while modifier classification uses the powerful language understanding ability of the BERT model to select numeric n-gram context tags and connect them as model input, and classify modifiers based on context information.
[0074] Unit extraction uses a rule-driven strategy. A database covering a wide range of units is built to ensure comprehensive coverage of common units. The unit is determined by scanning the measurement string character by character, matching it to the unit entry in the database, and looking for the longest suffix match. The algorithm also has the ability to handle the presence of spacing characters between the unit and the measurement, and ensures the accuracy of unit recognition through a flexible search starting point adjustment strategy. When a direct match fails, the algorithm implements a backtracking mechanism to capture potential units immediately preceding non-alphabetic characters to further optimize the extraction effect.
[0075] Modifier classifier selects metric tag x i The surrounding n-gram context {x i-n ,x i-n+1 ,…,x i ,x i+1 ,x i+ n } (including the measurement tag itself), and encode it using the BERT deep learning model to obtain c i .
[0076] c i =BERT([xi-n ;…;x i ;…;x i+n ])
[0077] Classifier for c i Apply the softmax function to calculate the probability distribution of each category and select the label with the highest probability as x i The modifier type.
[0078]
[0079] The unit extraction rule method is as follows Figure 3 As shown, it includes the following steps:
[0080] 1) First, obtain the set V of all units that have appeared in the training set and the test set, and obtain the numerical string Q as input.
[0081] 2) Initialize pointer p to n, where n represents the length of Q, that is, it points to the last character of the numerical string Q.
[0082] 3) Loop through the characters in Q from i=1 to n:
[0083] If Q from the i-th character to the last character (i.e. Q[i:n]) is in the unit set, then return Q from the beginning to the i-th character (i.e. Q[0:i]), which means that the unit corresponding to the value is found.
[0084] If Q[i] is a space, then the pointer p is updated to i+1. This step may be to handle the situation where the value contains spaces, so that the influence of spaces on the results can be excluded when the units are determined later.
[0085] 4) After the loop ends, assign s to p. s represents the starting position index of the first occurrence of the unit string in Q, starting from the end of Q.
[0086] 5) Then enter a loop, as long as s>0 and Q[s-1] is a character (that is, not a space or other special character), s is reduced by 1. The purpose of this loop is to find the starting position of the last consecutive character from the back to the front to further determine the accurate range of the unit.
[0087] 6) If s>0, it means such a position has been found, then update p to s.
[0088] 7) Finally, Q[p:n] is returned, that is, from the determined position p to the end of the value Q, which is the extracted unit.
[0089] Step 5: Object and Relationship Taggart. This is used to identify the entity, attribute, and context of each detected value, and to determine the relationship classification between them. This is achieved through a set of taggers that not only follow the architecture of the value tagger, but also integrate the semantic features of the value. In order to improve the accuracy and comprehensiveness of recognition. In terms of relation extraction, two templates of the given RC instance association relationship r are used to generate bidirectional QA instances for span prediction, converting the relation extraction task into a span prediction problem similar to question answering, thus improving the prediction ability on complex relations.
[0090] The object tagger uses a similar structure to the value tagger, but is optimized to identify objects in relations. It configures a separate tagger for each possible relation, each of which aims to discover the "entities", "attributes", etc. that are connected to the identified value. i As an input to the numerical tagger, the object tagger also considers the semantic features of the numerical value. When identifying the start and end positions of the relational object, the representation vector of the numerical value is Taking this into consideration enhances the ability to capture information around the value. Given the current mark h i For each context representation, the specific marking operation is as follows:
[0091]
[0092] in, and represents the probability of predicting the start and end positions of the current tag, is the representation of the kth quantity recognized by the model encoder.
[0093] Different from the traditional view of relation extraction as a classification problem, the relation tagger determines the relation classification between objects and values through a span prediction system based on two-way question answering. 1 ,e 2 )→r, through the two templates constructed and Convert to QA instance and generate QA dataset.
[0094] Relation classification "(c, entity e 1 ,Entity e 2 ) → with attributes", the two templates constructed should be:
[0095] (c,e 1 What is the property of? )→e 2
[0096] (c,e2 What is the corresponding object? )→e 1
[0097] The relationship classification "(c, entity e 1 ,Entity e 2 ) → has a value", the two templates constructed should be:
[0098] (c,e 1 What is the value of? )→e 2
[0099] (c,e 2 What is the corresponding attribute? )→e 1
[0100] Use the QA training data generated above to train the span prediction QA model using a pre-trained language model based on BERT-Large.
[0101] The prediction results of the two question-answering instances are merged using a logical OR operation. If any of the predicted spans is compatible with the expected entity (i.e., one span contains the other), the relationship is considered to be established, otherwise there is no relationship.
[0102] In the above steps, step 1 is the process of text preprocessing, and steps 2, 3, 4, and 5 are the processes of using the cascade framework to divide the entire numerical context information extraction task into subtasks. Numerical context information includes: numerical value, unit, modifier, object, relationship, etc.
[0103] The present invention first performs specific preprocessing on the input text to facilitate the subsequent acquisition of its semantic representation in the model encoder, and then uses the numerical tagger to obtain the best numerical recognition results using an integrated module to obtain the numerical values appearing in the text. Based on the recognition results, the object and relationship tagger uses a sequence labeling model that is specially optimized to identify objects in the text, and converts traditional RC classification into QA questions to identify the association relationship between entities. At the same time, through a rule-based method, units and modifiers related to numerical values are extracted. Finally, the above results are merged to form the final extraction output.
[0104] Example: For the text to be extracted "Wudingmen Regulating Gate is a medium-sized sluice gate with a total of 6 holes, each hole has a net width of 8m, and a designed flood discharge of 450m 3 / s.”, the model encoder first obtains the semantic representation of this text segment, and then identifies all possible numerical values through a numerical tokenizer: "6", "8", "450". At the same time, the unit and modifier extractor checks whether each segment is an element in a list of known units. If so, it marks it as a unit. For example, "6 holes" is split into "6" and "holes", and a classifier is used to classify the semantic representation of the numerical value to identify whether it is a modifier, and then the modifier identified by the classifier is associated with the numerical value. Through Predict the modifier of the current token. For example, the modifier of "The total number of gates is 6 holes" is "total".
[0105] For each detected numerical value, identify its corresponding entity, attribute, and determine the relationship between them. For example, the entity identified for "6" is "Wudingmen Regulating Sluice", and the attribute is "number of holes". Define two relationship classifications: has attribute, has numerical value. For each detected entity and attribute, two templates of the associated relationship r are used to generate bidirectional QA instances to train the span prediction QA model for relation extraction. For example, for the relationship "has attribute", the following bidirectional QA instances can be generated: "What is the attribute of Wudingmen Regulating Sluice?" and "What is the entity corresponding to the attribute of the number of holes?". Through a span prediction system based on bidirectional Q&A, set respective thresholds for each type of question template, and use the OR operation to merge the two QA answers. If any of the returned spans is compatible with the expected span, return the relationship to determine the relationship classification between objects, and thus obtain the relationships "Wudingmen Regulating Sluice - has attribute -> number of holes", "number of holes - has numerical value -> 6". Finally, concatenate the output results of each step, and use {"numerical": "6", "unit": "holes", "modifier": "total", "entity": "Wudingmen Regulating Sluice", "attribute": "number of holes", "relationship": {"has attribute": {"entity": "Wudingmen Regulating Sluice", "attribute": "number of holes"}, "has numerical value": {"attribute": "number of holes", "numerical": "6"}}} as the final extraction result.
[0106] The above is only the preferred implementation manner of the present invention. It should be pointed out that for those of ordinary skill in the art of this technology, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for extracting water conservancy numerical context information based on a cascade framework, characterized in that: The method comprises the following steps: (1) Use the pre-trained model to obtain the semantic representation of the input paragraph text in the water conservancy field; (2) using a numerical tagger to identify numerical values in an input paragraph; the numerical tagger is an integrated model including a CRF layer and a PointerNet layer; the PointerNet layer detects the start and end positions of numerical values respectively through two binary classifiers; the CRF layer regards numerical recognition as a sequence labeling problem and uses the BIOS labeling mode for prediction; and integrating the results of PointerNet and CRF to obtain the best numerical recognition result; (3) The unit and modifier extractor is used to identify the unit corresponding to each numerical value through the unit extraction rule method; for each candidate numerical tag, the numerical n-gram context tag is selected and connected as the model input, and the modifier is classified according to the context information; (4) Based on the extraction of numerical values from text, the object and relationship tagger takes into account the semantic features of the numerical values and predicts the entity, attribute, and contextual information of the numerical values. At the same time, the span prediction system based on two-way question and answer is used to determine the relationship classification between objects and numerical values.
2. According to the method for extracting water conservancy numerical context information based on cascade framework in claim 1, it is characterized in that: The implementation process of step (1) is as follows: The input text paragraph H is converted into the semantic representation X of the model. For input paragraphs exceeding the predefined maximum length, they are split into multiple parts by periods and encoded separately; H=Encoder(X) is used, and L is used to represent the length of the input paragraph.
3. According to the method for extracting water conservancy numerical context information based on cascade framework in claim 1, it is characterized in that: The PointerNet layer in step (2) detects the starting and ending positions of the value through two binary classifiers respectively. The implementation process is as follows: After obtaining the encoding of the text paragraph, the PointerNet layer uses two identical binary classifiers to detect the starting and ending positions of the value respectively; a threshold score is set, and if the probability of the current tag exceeds this threshold score, it is assigned to 1, otherwise it is assigned to 0; the loss function of the quantifier tagger is as follows: Where L represents the length of the input paragraph, represents the true label of the i-th interval; Each token is input into these two binary classifiers to predict whether the current token corresponds to the start or end position of a numerical segment; for a given context h i ∈H, the probability that the i-th token is identified as the starting position or the ending position of the value is calculated by the following formula: in, and represents the probability of predicting the start and end positions of the current token, W start and W end Represents the weight matrix for identifying the start and end positions, b is the bias matrix, and σ is the sigmoid activation function.
4. According to the method for extracting water conservancy numerical context information based on cascade framework in claim 1, it is characterized in that: The CRF layer in step (2) regards numerical recognition as a sequence labeling problem and uses the BIOS label mode for prediction. The implementation process is as follows: The CRF layer sequentially labels the numerical region output by the PointerNet layer, regards numerical recognition as a sequence labeling task, and selects BIOS as the label system; for a given representation sequence H = (h1, h2, ..., h L ), a probability-based sequence detection conditional random field model is used. Given the context word representation H, the conditional probability distribution P(Y|H) of the label sequence Y is maximized during the training process. During decoding, if the state transition is illegal, its transition cost is set to infinity. Based on the maximum score in the decoding process, the expected label sequence Y = (y1, y2, ..., y L ); First, the prediction result of the PointerNet layer is taken as the final result. If the value predicted by the CRF layer does not exist in the PointerNet result, it is added to the final result. Through weighted averaging, the weights are dynamically adjusted according to the outputs of the two modules to obtain the best value recognition result.
5. According to the method for extracting water conservancy numerical context information based on cascade framework in claim 1, it is characterized in that: The implementation process of the unit extraction rule method in step (3) is as follows: S1: Get the set V of all units that have appeared in the training set and the test set, and get the numerical string Q as input; S2: Initialize pointer p to n, where n represents the length of Q, i.e., points to the last character of the numerical string Q; S3: Loop through the characters in Q from i=1 to n: If Q from the i-th character to the last character, that is, Q[i:n] is in the unit set, then return Q from the beginning to the i-th character Q[0:i], that is, find the unit corresponding to the value; If Q[i] is a space, then update the pointer p to i+1 to eliminate the effect of the space on determining the unit result; S4: After the loop ends, assign s to p, where s represents the starting position index of the first unit string in Q starting from the end of Q; S5: Then enter a loop, starting from the end of Q, and traverse forward character by character; as long as s>0 and Q[s-1] is a character, that is, not other special characters, s is reduced by 1; S6: If s>0, it means that the starting position of the unit string in the numerical string Q is found, then p is updated to s; S7: Returns Q[p:n], that is, from the determined position p to the end of the value Q, that is, the extracted unit.
6. According to the method for extracting water conservancy numerical context information based on cascade framework in claim 1, it is characterized in that: The implementation process of step (3) is as follows: Unit extraction adopts a rule-driven strategy to build a database covering a wide range of units. The unit is determined by scanning the measurement string character by character, comparing it to the unit entry in the database, and looking for the longest suffix match. When direct matching fails, the algorithm implements a backtracking mechanism to capture potential units immediately before non-alphabetic characters to further optimize the extraction effect. Modifier classifier selects metric tag x i The surrounding n-gram context {x i-n ,x i-n+1 ,…,x i ,x i+1 ,x i+n }, including the metric token itself, which is encoded using the BERT deep learning model to obtain c i : c i =BERT([x i-n ;…;x i ;…;x i+n ]) Classifier for c i Apply the softmax function to calculate the probability distribution of each category and select the label with the highest probability as x i Types of modifiers:
7. The method for extracting water conservancy numerical context information based on a cascade framework according to claim 1 is characterized in that: The implementation process of step (4) is as follows: The object tagger configures a separate tagger for each possible relationship, and each tagger aims to discover the "entities" and "attributes" connected to the identified values; different from using the representation vector h i As input to the numerical tagger, the object tagger also considers numerical semantic features; When identifying the start and end positions of the relationship object, the representation vector of the value Taking this into consideration, the ability to capture information around the value is enhanced; given the current mark h i For each context representation, the specific marking operation is as follows: in, and represents the probability of predicting the start and end positions of the current tag, is the representation of the kth quantity identified by the model encoder; The relation tagger determines the relationship classification between objects and values through a span prediction system based on two-way question answering; for a given relation classification RC instance (c, e1, e2) → r, the two templates constructed and Convert to QA instance and generate QA dataset.
8. The method for extracting water conservancy numerical context information based on a cascade framework according to claim 1 is characterized in that: The process of classifying the relationship between objects in step (4) is as follows: For each relationship classification, two templates are designed with entity e1 and entity e2 as keywords in the question. and For a given relation classification RC instance (c, e1, e2) → r, it is converted into a QA instance through the two constructed templates to generate a QA dataset: Use r's forward template t r (e1) Generate QA instance: Use the reverse template t of r r (e2) Generate QA instance: Where c is a context, e1 and e2 correspond to the head and tail entities, It is a relation classification in the predefined relation set R; Based on the generated QA training data, a pre-trained language model based on BERT-Large is used to train a span prediction QA model. Use a global threshold τ to distinguish between answerable and unanswerable questions, and set individual thresholds for each relationship classification. Individual threshold Adjustments are made based on the characteristics of the question set generated by each template, allowing the model to more accurately determine the answer to each question.
9. The method for extracting water conservancy numerical context information based on a cascade framework according to claim 1 is characterized in that: The context information of the numerical value in step (4) includes numerical value, unit, modifier, object, and relationship.
10. The method for extracting water conservancy numerical context information based on a cascade framework according to claim 3 is characterized in that: The threshold score is 0.7.