Method for long document text and structured attribute joint classification based on conditional modulation
By employing sliding overlapping window segmentation and conditional modulation techniques, the problems of local key semantic loss and poor robustness in the joint classification of long document text and structured attributes were solved, achieving deep fusion and stable classification results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-06-23
- Publication Date
- 2026-07-21
AI Technical Summary
Existing methods for jointly classifying long document text and structured attributes suffer from several problems, including the easy loss of key semantics in long documents, insufficient deep cross-modal fusion, and poor robustness when structured attributes are missing.
Long document text is processed in segments by sliding overlapping windows, structured attribute data is cleaned and aligned, gated variables are constructed, scaling vectors and offset vectors are generated for conditional modulation, and a classifier is used for training and aggregation to obtain a joint representation.
It effectively preserves key semantics in long documents, improves the stability and classification accuracy of the model in scenarios where structured attributes are missing, and achieves deep fusion and robustness.
Smart Images

Figure CN122432830A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, specifically to a method for joint classification of long document text and structured attributes based on conditional modulation. Background Technology
[0002] With the development of joint modeling and classification techniques for multi-source heterogeneous data, joint classification of long document text and structured attribute data has become an important application scenario. Long document text carries contextual semantics, narrative logic, and cross-paragraph relational information, while structured attribute data carries numerical, statistical, and state information. The two are highly complementary in classification tasks, and how to effectively integrate the two types of data to improve classification accuracy and stability is an important research direction in the current field.
[0003] The relevant technologies mainly adopt two typical schemes: one is the multi-source heterogeneous data fusion and classification scheme, which follows the process of multi-source data collection, classification preprocessing, feature extraction and selection, fusion modeling, and classification output, with multi-branch feature extraction and cross-modal fusion as the core framework; the other is the text and structured attribute joint modeling scheme, which has evolved from using only structured attributes, to using only text information, to joint modeling of the two, extracting text semantic representation and attribute features respectively, then fusing them, and finally completing the classification output.
[0004] However, the above solutions have obvious shortcomings in practical applications: when processing long document text, local key semantics are easily lost due to truncation, compression or coarse-grained representation; text and structured attribute information are mostly limited to feature splicing, representation splicing or decision-level fusion, making it difficult to achieve deep collaborative modeling; the model assumes that both types of data are complete, and its stability is insufficient when structured attributes are missing or incomplete, making it unable to adapt to complex data scenarios. Summary of the Invention
[0005] (a) Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a joint classification method for long document text and structured attributes based on conditional modulation. This method solves the technical problems of existing joint classification methods for long document text and structured attributes, such as easy loss of local key semantics in long documents, insufficient deep fusion across modalities, and poor robustness when structured attributes are missing.
[0006] (II) Technical Solution To achieve the above objectives, the present invention provides the following technical solution: A joint classification method for long document text and structured attributes based on conditional modulation includes: Obtain classification samples containing long document text data, structured attribute data, and category labels; Long document text data is cleaned and segmented using a sliding overlapping window to obtain multiple text windows; The structured attribute data is aligned with the cleaned long document text, missing attribute values are filled and attributes are filtered, and a gating variable is constructed to adapt to the scenario of missing attributes, so as to obtain the processed structured attribute data. Input each text window into the text encoding model to obtain a window-level text representation; The processed structured attribute data is normalized and encoded to obtain a structured conditional representation; Scaling and offset vectors are generated based on structured conditional representations, and feature-wise conditional modulation is performed on the window-level text representation in combination with gating variables to obtain a joint representation; The joint representation is input into the classifier to obtain the window-level classification probability; Aggregate the window-level classification probabilities and train the classifier by combining the class labels until convergence; The trained classifier is used to classify the samples to be classified and obtain the classification results.
[0007] Preferably, the cleaning of long document text data includes character encoding normalization, whitespace normalization, control character removal, page number removal, and proprietary identifier anonymization.
[0008] Preferably, before obtaining the joint representation, the method further includes: The modulation intensity control factor is calculated based on the integrity of the structured attributes, and the scaling vector and offset vector are adaptively adjusted using the modulation intensity control factor.
[0009] Preferably, when encoding the processed structured attribute data, layer normalization and higher-order mapping are used to make the structured conditional representation and the window-level text representation have the same dimension.
[0010] Preferably, the aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation, and the window-level classification probabilities are weighted and aggregated based on window importance.
[0011] Preferably, the aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation. Top-K high-contribution windows are selected based on window importance, and weighted aggregation is performed only on high-contribution windows.
[0012] Preferably, after obtaining the category classification result, the method further includes: The integral gradient method is used to calculate the contribution value of long document text data of the sample to be classified, and the text segment with the greatest impact on the category classification result is determined and output based on the contribution value.
[0013] A long document text and structured attribute joint classification system based on conditional modulation includes: The data acquisition module is used to acquire classification samples containing long document text data, structured attribute data, and category labels; The text preprocessing module is used to clean long document text data and segment it using a sliding overlapping window to obtain multiple text windows; The attribute processing module is used to align structured attribute data with the cleaned long document text, fill in missing attribute values and filter attributes, and construct gate variables to adapt to scenarios with missing attributes, and obtain the processed structured attribute data. The text encoding module is used to input each text window into the text encoding model to obtain a window-level text representation; The attribute encoding module is used to normalize and encode the processed structured attribute data to obtain a structured conditional representation. The conditional modulation module is used to generate scaling and offset vectors based on the structured conditional representation, and to perform feature-by-feature conditional modulation on the window-level text representation in combination with gating variables to obtain a joint representation; The classification probability acquisition module is used to input the joint representation into the classifier to obtain the window-level classification probability; The model training module is used to aggregate window-level classification probabilities and train the classifier by combining the class labels until convergence. The classification reasoning module is used to classify samples to be classified using the trained classifier and obtain the category classification results.
[0014] A storage medium storing a computer program, wherein the computer program causes a computer to perform the conditional modulation-based joint classification method for long document text and structured attributes as described above.
[0015] An electronic device, the electronic device comprising: Processor and memory; The memory stores program instructions; The processor is configured to run the program instructions to perform the conditional modulation-based long document text and structured attribute joint classification method as described above.
[0016] (III) Beneficial Effects This invention provides a joint classification method for long document text and structured attributes based on conditional modulation. Compared with existing technologies, it has the following advantages: This invention cleanses long document text data and employs sliding overlapping windows for segmentation, avoiding truncation or coarse-grained compression, effectively preserving scattered local key semantics, and providing a stable semantic foundation for classification. Aligning, filling, filtering, and constructing gating variables for structured attribute data standardizes data quality and maintains processing stability even when attributes are missing. Encoding text windows yields window-level text representations, and encoding structured attributes yields structured conditional representations, achieving a standardized mapping between the two data representation spaces. Based on the structured conditional representations, scaling and offset vectors are generated, and combined with gating variables, feature-wise conditional modulation of the text representations is applied to form a deeply fused joint representation, improving collaborative modeling capabilities and the discriminative power of the joint representation. Aggregating window-level classification probabilities integrates multi-region discriminative information, reducing the impact of single-window fluctuations. Training a classifier with category labels and using it for actual classification improves model generalization ability, enabling the method to achieve higher classification accuracy, stability, and robustness in long document scenarios. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a joint classification method for long document text and structured attributes based on conditional modulation, provided in an embodiment of the present invention; Figure 2 A technical path diagram for a joint classification method of long document text and structured attributes based on conditional modulation provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0019] Component labeling explanation: 100 – Electronic device, 101 – Memory, 102 – Processor, 103 – Display Detailed Implementation To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] The technical solution in this application is to solve the above-mentioned technical problems, and the general idea is as follows: First, improve the ability to preserve key semantics in long documents. To address the problem that existing methods often lose key semantic information due to truncation, compression, or coarse-grained representation when processing long document text, this invention performs windowing processing and subsequent aggregation modeling on long document text. This allows for the effective preservation and integration of local discriminative information scattered in different locations, thereby improving the overall classification capability in long document scenarios.
[0021] Second, improve the ability to deeply integrate textual information with structured attribute information. To address the problem that existing methods often remain at the stage of feature splicing, representation splicing, or decision-level fusion, making it difficult to effectively involve structured attributes in text representation learning, this invention introduces a conditional modulation mechanism. This mechanism enables structured attribute information to influence text representation during the text representation learning process, thereby enhancing the collaborative modeling capability between text information and structured attribute information and improving the discriminativeness and effectiveness of the joint representation.
[0022] Third, improve the robustness of models in scenarios where structured attributes are missing or incomplete. To address the issue that existing joint modeling methods typically assume both textual and structured attribute information are complete, which can easily affect model stability if structured attributes are missing or incomplete, this invention introduces a control mechanism for missing scenarios. This mechanism enables the model to perform joint modeling when structured attributes are complete, and maintains stable classification ability even when structured attributes are missing or incomplete, thereby improving the applicability and robustness of the method under complex data conditions.
[0023] Fourth, in the preferred embodiment, the utilization efficiency of key windows is improved. To address the issue that different windows in long documents contribute inconsistently to classification results and that existing methods struggle to fully utilize information from high-contribution windows, this invention, in a preferred embodiment, can further improve the utilization efficiency of key windows and reduce the interference of low-contribution windows on the overall classification results, thereby enhancing the stability and accuracy of the overall classification results.
[0024] In some embodiments, the present invention may further analyze the role of high-contribution text segments in the classification results, thereby providing additional supporting evidence for the classification results.
[0025] It should be noted that the joint classification method for long document text and structured attributes based on conditional modulation proposed in this invention is applicable to sample classification tasks that simultaneously contain long document text information and structured attribute information. The method is not limited to a single application domain and can be applied in the following technical scenarios: (1) Enterprise report text scenario Long document text can be an enterprise's annual report, quarterly report, explanatory text, or disclosure text; structured attributes can be financial indicators, governance indicators, audit indicators, statistical indicators, or derived attributes corresponding to the enterprise.
[0026] (2) Legal document scenario Long document text can be a judgment, complaint, response, legal opinion, or other case documents; structured attributes can be case type, procedural stage, amount involved, party attributes, or other structured case information.
[0027] (3) Customer service work order scenario Long document text can be work order descriptions, service records, fault reports, operation and maintenance logs, or event descriptions; structured attributes can be user attributes, device status, time characteristics, statistical indicators, or historical interaction attributes.
[0028] (4) Regulatory reporting and compliance document scenarios Long document text can be declaration instructions, compliance reports, verification instructions, or appeal texts; structured attributes can be declaration category, inspection indicators, risk level, status label, or other structured attributes.
[0029] (5) Medical document scenario Long document text can be electronic medical records, progress notes, discharge summaries, or clinical text written by doctors; structured attributes can be laboratory indicators, vital signs, diagnostic codes, medication information, or other patient attributes.
[0030] The above scenarios are only used to illustrate the applicability of the method of the present invention. The core of the present invention lies in: for classification tasks involving long document text and structured attributes, by using long document windowing, structured attribute conditional modulation, and window importance modeling and aggregation, the overall classification of target samples is achieved.
[0031] Example 1: like Figure 1 As shown, this embodiment of the invention provides a joint classification method for long document text and structured attributes based on conditional modulation, including: S1. Obtain classification samples containing long document text data, structured attribute data, and category labels; S2. Clean the long document text data and use a sliding overlapping window to segment it and obtain multiple text windows; S3. Align the structured attribute data with the cleaned long document text, fill in missing attribute values and filter attributes, and construct a gating variable to adapt to the scenario of missing attributes, and obtain the processed structured attribute data. S4. Input each text window into the text encoding model to obtain the window-level text representation; S5. Normalize and encode the processed structured attribute data to obtain a structured conditional representation; S6. Generate scaling and offset vectors based on structured conditional representation, and perform feature-wise conditional modulation on window-level text representation in combination with gating variables to obtain joint representation; S7. Input the joint representation into the classifier to obtain the window-level classification probability; S8. Aggregate the window-level classification probabilities and train the classifier by combining the class labels until convergence. S9. Using the trained classifier, classify the samples to be classified and obtain the classification results.
[0032] This invention preserves key semantics of long documents by segmenting them through sliding overlapping windows, and improves model robustness by combining gating variables to adapt to scenarios with missing attributes. It achieves deep fusion of text and structured attributes through feature-wise conditional modulation, avoiding the limitations of traditional splicing. Through weighted aggregation and model training, it significantly improves the accuracy and stability of joint classification of long documents.
[0033] like Figure 2 As shown, Figure 2 A technical roadmap for a joint classification method of long document text and structured attributes based on conditional modulation is disclosed.
[0034] To better understand the above technical solution, the following will refer to the appendix to the instruction manual. Figure 2 The above technical solutions are explained in detail using the operation and maintenance event reporting scenario as an example.
[0035] In step S1, a classification sample containing structured attribute data and category labels from long document text data is obtained.
[0036] To clarify, in the context of operation and maintenance incident reporting, long document text data refers to the narrative text within the operation and maintenance incident report, while structured attribute data refers to the structured operational attributes related to the corresponding device, system, or incident object. The long document text data may include fault descriptions, incident details, handling records, log summaries, manual analysis explanations, and recovery process descriptions; the structured attribute data may include device type, device model, firmware version, incident occurrence time, number of alarms, fault codes, key operational indicator statistics, historical fault frequency, and system status attributes.
[0037] Meanwhile, based on a preset classification objective, each sample is assigned a supervisory label to construct a sample set. In one implementation, the supervisory label can be used to characterize whether the maintenance event belongs to the target event type, such as whether it belongs to the event requiring escalation; correspondingly, the label value can be represented as a target category sample and a non-target category sample.
[0038] Correspondingly, multiple classification samples containing long document text data, structured attribute data, and category labels can constitute the following sample set: In the formula, Represents a sample set; Indicates the total number of samples; Indicates the first The long document text corresponding to each sample; Indicates the first The structured attribute vector corresponding to each sample; Indicates the first The supervised labels for each sample; where 1 represents a target category sample and 0 represents a non-target category sample. The long document text data can be long text such as report text, explanatory text, or disclosure text; the structured attributes can be numerical, statistical, categorical, state, or derived attribute data.
[0039] Furthermore, the sample set can be divided into a training set, a validation set, and a test set: in, This represents the training set, used for training model parameters. This represents the validation set, used for classification threshold optimization. This represents the test set, used for model performance evaluation.
[0040] It should be noted that in this embodiment, long document text data can be in common formats such as TXT and DOCX, and structured attribute data can be stored in CSV format. The long document text data and structured attribute data are matched one-to-one through the unique identifier of the sample to ensure the integrity of the sample. The category label uses binary labels (0 or 1) only to distinguish the sample category.
[0041] In step S2, the long document text data is cleaned and segmented using a sliding overlapping window to obtain multiple text windows.
[0042] In an optional implementation, the cleaning of long document text data includes character encoding normalization, whitespace normalization, control character removal, page number removal, and proprietary identifier anonymization.
[0043] Specifically, this step performs cleaning and standardization on the original long document text to obtain the cleaned text: in, Indicates the first The original long document text of each sample; This represents the cleaned long document text; This refers to text cleaning functions. These functions include character encoding normalization, whitespace normalization, control character removal, page number removal, format unification, and proprietary identifier anonymization.
[0044] Since long document texts are typically quite long, and text encoding models have input length limitations, the cleaned text is segmented using a sliding window approach to obtain multiple text windows: In the formula, Indicates the first A set of windows for each sample; Indicates the first The first sample One window; Indicates the first The total number of windows obtained after segmenting a sample; This represents a piecewise function for a sliding window. Indicates the maximum length of a single window; This indicates the sliding step size. The sliding window segmentation is used to preserve local risk semantics scattered across different paragraphs without truncating the entire text.
[0045] In step S3, the structured attribute data is aligned with the cleaned long document text, missing attribute values are filled and attributes are filtered, and a gating variable is constructed to adapt to the scenario of missing attributes, thereby obtaining the processed structured attribute data.
[0046] This step uses device identification and event time as a benchmark to align structured attribute data with the cleaned long document text, ensuring a one-to-one correspondence between text data and attribute data for the same sample, avoiding subsequent processing errors caused by data misalignment; and when some samples have missing structured attributes, the missing values are filled in: In the formula, Indicates the first The first sample The original values of each structured attribute; Indicates the first Imputation statistics for each structured attribute in the training set; This represents the eigenvalues after filling in the blanks; The dimension representing the structured attributes, i.e., the number of structured attributes contained in each sample; Indicates the first The first sample The missing indicator variable of a structured attribute, when When indicates that the attribute originally existed, when This indicates that the attribute was originally missing; Indicates the first The structured attribute vector after imputation of each sample.
[0047] Furthermore, construct binary gated variables: In the formula, Indicates the first The gate variable for each sample; when When it means that the sample originally possesses usable structured attributes; when The time interval indicates that the original sample did not possess any usable structured attributes. The gate variable is used to control whether the conditional modulation branch in the subsequent step S6 is enabled, so as to ensure that the model can still maintain its text-based classification ability when structured attributes are missing.
[0048] In addition, the candidate structured attributes are screened to remove variables that are highly correlated, highly collinear, or have insufficient statistical significance, resulting in the final set of structured attributes: in This represents an attribute filtering function; This represents the filtered structured attribute vector; Represents the set of real numbers. This represents the structured attribute dimensions after filtering.
[0049] In step S4, each text window is input into the text encoding model to obtain a window-level text representation.
[0050] This step inputs each text window into the text encoding model to obtain a window-level text representation. In the formula, Indicates the first The first sample The text representation vector of each text window. Indicates the dimension of the text representation; This represents a text encoding model. Specifically, the window-level text representation is used to characterize the contextual semantics and local discriminative cues within the corresponding window.
[0051] For example, the text encoding model mentioned above can be the BERT-base model or similar text encoding models such as RoBERTa and ALBERT; there is no absolute limitation here.
[0052] In step S5, the processed structured attribute data is normalized and encoded to obtain a structured conditional representation.
[0053] In an optional implementation, layer normalization and higher-order mapping are used when encoding the processed structured attribute data to make the structured conditional representation and the window-level text representation have the same dimension.
[0054] Specifically, this step first performs layer normalization on the filtered and filled structured attribute vectors, and then performs high-order representation encoding: In the formula, Represents the normalized structured attribute vector; Indicates the layer normalization function; Indicates the first Structured conditional representation of each sample; This represents a structured attribute encoder. The structured conditions are used to carry structured attribute information and serve as input to the subsequent conditional modulation module.
[0055] Understandably, by inputting the normalized structured attribute vector into the fully connected network, and after layer normalization (eliminating the gradient vanishing problem), the attribute vector is mapped to the same dimension as the window-level text representation through a higher-order mapping (using a quadratic polynomial mapping), thus obtaining the structured conditional representation. This ensures that the structured conditional representation and the window-level text representation can achieve feature-wise modulation, providing a basis for dimension matching for deep fusion.
[0056] In step S6, scaling vectors and offset vectors are generated based on the structured conditional representation, and feature-wise conditional modulation is performed on the window-level text representation in combination with gating variables to obtain a joint representation.
[0057] This step, based on the structured conditional representation, generates scaling and offset vectors that act on the text representation: In the formula, Indicates the first A scaling vector for each sample; Indicates the first The offset vector of each sample; Represents a gated variable; Indicates the modulation intensity scaling factor; Represents the hyperbolic tangent function; , , , Indicates the parameter to be learned; This represents a vector of all 1s with the same dimension as the text representation. When... At that time, the scaling vector degenerates into unit modulation, and the offset vector degenerates into zero modulation.
[0058] Furthermore, the gated variables constructed in step S3 are combined with... ,when At that time, feature-wise conditional modulation is performed on the window-level text representation to obtain the joint representation: In the formula, Indicates the first The first sample The modulated joint representation of each window (i.e., modulated text features). This represents element-wise multiplication; This represents the original window-level text representation (i.e., the text features before modulation). and These represent the scaling vector and the offset vector, respectively. It is understandable that when... At that time, the modulation degenerates into the identity transformation, that is .
[0059] Through the above processing, structured attribute information is introduced into the text representation learning stage, thereby achieving deep conditional fusion of text semantic information and structured attribute information, rather than simple end splicing.
[0060] It is important to avoid over- or under-modulation issues when attributes are missing or of unstable quality, thereby improving the model's robustness under complex data conditions.
[0061] In an optional implementation, this step further includes, before obtaining the joint representation: The modulation intensity control factor is calculated based on the integrity of the structured attributes, and the scaling vector and offset vector are adaptively adjusted using the modulation intensity control factor.
[0062] Specifically, based on the gated variables, a modulation intensity control factor is further constructed according to the completeness of the structured attributes. First, the completeness of the structured attributes is defined: in, Indicates the first Completeness of the structured attributes of each sample; Indicates the first After the first sample screening Missing indicator variables for each attribute; This indicates the attribute dimensions after filtering.
[0063] Furthermore, sample-level modulation intensity parameters are generated based on the completeness: in, Indicates the first Modulation intensity parameters of each sample; Represents the Sigmoid function; and This represents the parameter to be learned.
[0064] At this point, the scaling vector and offset vector can be rewritten as: In step S7, the joint representation is used to obtain the window-level classification probability from the input classifier.
[0065] This step inputs the modulated joint representation into the classifier to obtain the window-level classification output: In the formula, Indicates the first The first sample The binary classification output score for each window; and Indicates the classifier parameters; Indicates a random deactivation operation; Indicates the first The first sample The modulated joint representation of the windows; the superscript T indicates transpose.
[0066] Furthermore, a Sigmoid transformation is performed on the binary classification output score to obtain the predicted probability that the window belongs to the target category: in, Indicates the first The first sample The predicted probability that each window belongs to the target category.
[0067] In step S8, the window-level classification probabilities are aggregated, and the classifier is trained by combining the class labels until convergence.
[0068] Since a long document is typically broken down into multiple windows, the window-level output probabilities are aggregated to obtain the overall result probability for the corresponding sample. Generally, this step involves performing an average aggregation of the output probabilities of all windows: in, Indicates the first The overall target category probability of each sample; Indicates the first The first sample The predicted probability that each window belongs to the target category; Indicates the first The total number of windows for each sample.
[0069] Furthermore, the classification threshold is optimized on the validation set to determine the optimal classification threshold: in, Indicates the optimal classification threshold; This indicates that the validation set is based on a threshold. The calculated evaluation metrics may be one or more of the following: accuracy, F1 score, recall, precision, balanced accuracy, or Youden index.
[0070] In some preferred embodiments, to improve the utilization efficiency of critical windows and reduce interference from low-contribution windows, the aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation, and the window-level classification probabilities are weighted and aggregated based on window importance: Alternatively, window importance can be calculated based on window-level text representation and structured conditional representation, and Top-K high-contribution windows can be selected based on window importance, with weighted aggregation performed only on high-contribution windows.
[0071] (1) Calculate window importance based on window representation, and perform weighted aggregation of window-level output probabilities according to window importance: in, Indicates the first The first sample The original importance score of each window is used to characterize the degree to which the window contributes to the overall classification result; Indicates the first The first sample The modulated joint representation of each window; Indicates the first Structured conditional representation of each sample; and These represent window representation mapping parameters and structured conditional mapping parameters, respectively. Indicates the bias term; This indicates that the hidden representation will be projected as a weight vector of scalar fractions.
[0072] Furthermore, the original window importance scores are normalized to obtain the window weights: in, No. The first sample Normalized weights for each window; Indicates the first The total number of windows for each sample; This represents the window index variable.
[0073] Perform weighted aggregation on all windows to integrate window semantic information across the entire long document. The overall target category probability of a sample can be expressed as: in, Indicates the first The overall target category probability of each sample; Indicates the first The first sample The weight of each window; Indicates the first The first sample The predicted probability that each window belongs to the target category; Indicates the first The total number of windows for each sample.
[0074] By using the above-mentioned full-window weighted aggregation method, the semantic information of each window in the entire long document can be preserved, and the different windows can be integrated differently according to their contribution to the classification results, thereby forming an overall judgment of the entire long document.
[0075] (2) Filter the Top-K high-contribution windows based on window weight: in, Indicates the first The set of high-contribution window indexes selected for each sample; This indicates the number of high-contribution windows that are retained.
[0076] Weighted aggregation is performed only on the Top-K high-contribution windows, the first The overall target category probability of a sample can be expressed as: in, Indicates the first A set of high-contribution windows for each sample. This implementation preserves key local semantics that play a major role in the final classification result and reduces the interference of low-contribution and noisy windows on the overall result.
[0077] The final classification result can be represented as: in, Indicates the first The final classification result of each sample; Indicates the classification threshold; when When it is indicated that a sample is determined to be a target category sample, when This indicates that the sample is not classified as the target category.
[0078] Optionally, the cross-entropy loss function is used to calculate the loss value between the final classification result and the category label. The Adam optimizer is used to jointly optimize the classifier, text encoding model, and conditional modulation parameters until convergence, then training is stopped, and the trained classifier is obtained.
[0079] In step S9, the trained classifier is used to classify the samples to be classified and obtain the category classification results.
[0080] It's easy to understand that the samples to be classified only contain long document text data and structured attribute data, but not category labels. Similarly, the long document text data of the samples to be classified corresponds to the narrative text in the operation and maintenance event report (which may include fault descriptions, event details, handling records, etc.), and the structured attribute data corresponds to the structured operational attributes related to the device, system, or event object.
[0081] The processing flow of steps S2-S7 above is executed on the sample to be classified. Then, the overall classification probability of the sample to be classified is obtained according to the aggregation method in step S8, and then compared with the classification threshold. When the overall classification probability is greater than or equal to the classification threshold, it is determined to be a target class sample; otherwise, it is determined to be a non-target class sample, and the joint classification is completed.
[0082] The calculation process is as follows: Gradient calculation is performed on each character of the narrative text of the operation and maintenance event report based on the output probability of the classifier. The contribution value of each character is accumulated by the integral gradient method. The larger the absolute value of the contribution value, the greater the influence of the character on the category classification result. Then, based on the size of the contribution value, the continuous character segments with the largest absolute value of the contribution value (such as key fault features in the fault description, core handling nodes in the handling record, etc.) are selected as the text segments with the greatest influence on the category classification result and output, thereby realizing the interpretability of the classification result. This operation can improve the practicality of the technical solution in the operation and maintenance event reporting scenario and focus on the optimization of interpretability at the technical level.
[0083] Specifically, the integral gradient method is used to calculate the contribution of each input dimension in the input sample to the target output: in, Indicates input sample The Attribution values corresponding to each dimension; Indicates the first An input sample to be explained. express The One dimension; Indicates the reference baseline input. express The One dimension; This represents the model output function for the target category; This represents the integral path coefficient.
[0084] Furthermore, the attribution values of each token within the same text segment are aggregated to obtain a segment-level contribution score: in, Indicates the first The first sample The contribution score of each text segment; This represents the set of tokens corresponding to this segment.
[0085] Based on the fragment-level contribution scores, high-contribution text fragments that have a significant impact on the overall classification results can be extracted.
[0086] Example 2: This invention provides a joint classification system for long document text and structured attributes based on conditional modulation, comprising: The data acquisition module is used to acquire classification samples containing long document text data, structured attribute data, and category labels; The text preprocessing module is used to clean long document text data and segment it using a sliding overlapping window to obtain multiple text windows; The attribute processing module is used to align structured attribute data with the cleaned long document text, fill in missing attribute values and filter attributes, and construct gate variables to adapt to scenarios with missing attributes, and obtain the processed structured attribute data. The text encoding module is used to input each text window into the text encoding model to obtain a window-level text representation; The attribute encoding module is used to normalize and encode the processed structured attribute data to obtain a structured conditional representation. The conditional modulation module is used to generate scaling and offset vectors based on the structured conditional representation, and to perform feature-by-feature conditional modulation on the window-level text representation in combination with gating variables to obtain a joint representation; The classification probability acquisition module is used to input the joint representation into the classifier to obtain the window-level classification probability; The model training module is used to aggregate window-level classification probabilities and train the classifier by combining the class labels until convergence. The classification reasoning module is used to classify samples to be classified using the trained classifier and obtain the category classification results.
[0087] This invention preserves key semantics of long documents by segmenting them through sliding overlapping windows, and improves model robustness by combining gating variables to adapt to scenarios with missing attributes. It achieves deep fusion of text and structured attributes through feature-wise conditional modulation, avoiding the limitations of traditional splicing. Through weighted aggregation and model training, it significantly improves the accuracy and stability of joint classification of long documents.
[0088] In an optional implementation, the cleaning of long document text data includes character encoding normalization, whitespace normalization, control character removal, page number removal, and proprietary identifier anonymization.
[0089] In an optional implementation, before obtaining the joint representation, the method further includes: The modulation intensity control factor is calculated based on the integrity of the structured attributes, and the scaling vector and offset vector are adaptively adjusted using the modulation intensity control factor.
[0090] In an optional implementation, layer normalization and higher-order mapping are used when encoding the processed structured attribute data to make the structured conditional representation and the window-level text representation have the same dimension.
[0091] In an optional implementation, the aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation, and the window-level classification probabilities are weighted and aggregated based on window importance.
[0092] In an optional implementation, the aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation. Top-K high-contribution windows are selected based on window importance, and weighted aggregation is performed only on high-contribution windows.
[0093] In an optional implementation, after obtaining the category classification result, the method further includes: The integral gradient method is used to calculate the contribution value of long document text data of the sample to be classified, and the text segment with the greatest impact on the category classification result is determined and output based on the contribution value.
[0094] Example 3: This invention provides a storage medium storing a computer program that causes a computer to execute a long document text and structured attribute joint classification method based on conditional modulation as provided in any embodiment of this invention.
[0095] In embodiments of the present invention, any combination of one or more storage media may be used. The storage medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, RAM, ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in connection with an instruction execution system, apparatus, or device.
[0096] Example 4: This invention provides an electronic device. Figure 3 The diagram shown illustrates the structure of an electronic device 100 provided in an embodiment of the present invention. In some embodiments, the electronic device may be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), or other terminal device. Furthermore, the conditional modulation-based long document text and structured attribute joint classification method provided in this embodiment can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. This embodiment does not limit the specific application scenarios of the conditional modulation-based long document text and structured attribute joint classification method.
[0097] like Figure 3 As shown, the electronic device 100 provided in this embodiment of the invention includes a memory 101 and a processor 102.
[0098] The memory 101 is used to store computer programs; preferably, the memory 101 includes various media that can store program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk.
[0099] Specifically, memory 101 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Electronic device 100 may further include other removable / non-removable, volatile / non-volatile computer system storage media. Memory 101 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0100] The processor 102 is connected to the memory 101 and is used to execute the computer program stored in the memory 101 so that the electronic device 100 executes the long document text and structured attribute joint classification method based on conditional modulation provided in any embodiment of the present invention.
[0101] In an optional implementation, the processor 102 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, evaluation index gate or transistor logic devices, or evaluation index hardware components.
[0102] In an optional embodiment, the electronic device 100 of the present invention may further include a display 103. The display 103 is communicatively connected to the memory 101 and the processor 102, and is used to display a GUI interactive interface related to the joint classification method of long document text and structured attributes based on conditional modulation.
[0103] It is understood that the long document text and structured attribute joint classification system, storage medium and electronic device based on conditional modulation provided in the embodiments of the present invention correspond to the long document text and structured attribute joint classification method based on conditional modulation provided in the embodiments of the present invention. The explanation, examples and beneficial effects of the relevant contents can be referred to the corresponding parts of the method, and will not be repeated here.
[0104] In summary, compared with existing technologies, it has the following beneficial effects: 1. Improve the ability to preserve key semantic information in long documents. This invention employs a sliding window approach to overlap and segment long document text, enabling the preservation and extraction of local discriminative information scattered across different locations without directly truncating the entire document. Compared to common methods such as direct truncation, overall compression, or coarse-grained representation, this invention more effectively reduces the risk of losing key local information in long documents, thereby providing a more comprehensive semantic foundation for overall classification.
[0105] 2. Enhance the ability to deeply integrate textual information with structured attribute information. This invention does not simply perform feature concatenation, representation concatenation, or decision-level fusion of textual information and structured attribute information. Instead, it generates modulation parameters that act on the window-level text representation through structured attribute encoding and performs feature-wise conditional modulation on the text representation, enabling structured attribute information to directly participate in text modeling during the text representation learning stage. Therefore, this invention enhances the deep synergistic effect between textual information and structured attribute information, improving the discriminativeness and effectiveness of the joint representation.
[0106] 3. Improve robustness in scenarios where structured attributes are missing or incomplete. To address situations where some samples lack structured attributes, have incomplete alignment, or insufficient usability, this invention controls the activation of conditional modulation branches through gating variables. In a preferred embodiment, the modulation intensity is adaptively adjusted based on the completeness of structured attributes. This allows the model to fully utilize attribute information when structured attributes are complete, and maintain stable classification ability even when structured attributes are missing or incomplete. Therefore, this invention improves the applicability and robustness of the model under complex data conditions.
[0107] 4. Improve the stability of overall classification results In this embodiment of the invention, after obtaining the window-level output results, the outputs of each window are aggregated as a whole to form the overall classification result of the corresponding sample. In the main implementation, by performing average aggregation on the probabilities of all window outputs, local discrimination information at different locations in the entire long document can be integrated as a whole, reducing the impact of fluctuations in a single window on the final result, thereby improving the stability of the overall classification result.
[0108] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0109] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A joint classification method for long document text and structured attributes based on conditional modulation, characterized in that, include: Obtain classification samples containing long document text data, structured attribute data, and category labels; Long document text data is cleaned and segmented using a sliding overlapping window to obtain multiple text windows; The structured attribute data is aligned with the cleaned long document text, missing attribute values are filled and attributes are filtered, and a gating variable is constructed to adapt to the scenario of missing attributes, so as to obtain the processed structured attribute data. Input each text window into the text encoding model to obtain a window-level text representation; The processed structured attribute data is normalized and encoded to obtain a structured conditional representation; Scaling and offset vectors are generated based on structured conditional representations, and feature-wise conditional modulation is performed on the window-level text representation in combination with gating variables to obtain a joint representation; The joint representation is input into the classifier to obtain the window-level classification probability; Aggregate the window-level classification probabilities and train the classifier by combining the class labels until convergence; The trained classifier is used to classify the samples to be classified and obtain the classification results.
2. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, The cleaning of long document text data includes character encoding normalization, whitespace normalization, control character removal, page number removal, and proprietary identifier anonymization.
3. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, Before obtaining the joint representation, the process also includes: The modulation intensity control factor is calculated based on the integrity of the structured attributes, and the scaling vector and offset vector are adaptively adjusted using the modulation intensity control factor.
4. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, When encoding the processed structured attribute data, layer normalization and higher-order mapping are used to make the structured conditional representation and the window-level text representation have the same dimension.
5. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, The aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation, and the window-level classification probabilities are weighted and aggregated based on window importance.
6. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, The aggregation of window-level classification probabilities includes: Window importance is calculated based on window-level text representation and structured conditional representation. Top-K high-contribution windows are selected based on window importance, and weighted aggregation is performed only on high-contribution windows.
7. The long document text and structured attribute joint classification method as described in claim 1, characterized in that, After obtaining the category classification result, the following is also included: The integral gradient method is used to calculate the contribution value of long document text data of the sample to be classified, and the text segment with the greatest impact on the category classification result is determined and output based on the contribution value.
8. A joint classification system for long document text and structured attributes based on conditional modulation, characterized in that, include: The data acquisition module is used to acquire classification samples containing long document text data, structured attribute data, and category labels; The text preprocessing module is used to clean long document text data and segment it using a sliding overlapping window to obtain multiple text windows; The attribute processing module is used to align structured attribute data with the cleaned long document text, fill in missing attribute values and filter attributes, and construct gate variables to adapt to scenarios with missing attributes, and obtain the processed structured attribute data. The text encoding module is used to input each text window into the text encoding model to obtain a window-level text representation; The attribute encoding module is used to normalize and encode the processed structured attribute data to obtain a structured conditional representation. The conditional modulation module is used to generate scaling and offset vectors based on the structured conditional representation, and to perform feature-by-feature conditional modulation on the window-level text representation in combination with gating variables to obtain a joint representation; The classification probability acquisition module is used to input the joint representation into the classifier to obtain the window-level classification probability; The model training module is used to aggregate window-level classification probabilities and train the classifier by combining the class labels until convergence. The classification reasoning module is used to classify samples to be classified using the trained classifier and obtain the category classification results.
9. A storage medium, characterized in that, It stores a computer program, wherein the computer program causes the computer to perform the long document text and structured attribute joint classification method based on conditional modulation as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The electronic device includes: Processor and memory; The memory stores program instructions; The processor is configured to run the program instructions to perform the long document text and structured attribute joint classification method based on conditional modulation as described in any one of claims 1 to 7.