Construction method of chinese poetry-semantic knowledge graph
By constructing a Chinese poetry-semantic knowledge graph, splitting poems into multiple style feature sub-channels, generating fuzzy attribution vectors, and performing graph inference, the problem of inaccurate style identification in traditional methods is solved, achieving highly accurate and interpretable style attribution, which is suitable for classical literature research and digital applications.
Patent Information
- Application Number
- CN202511693846.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-11-18
AI Technical Summary
Traditional methods struggle to accurately identify stylistic features in classical Chinese poetry, especially when poets have highly similar styles or when the texts are extremely short. Existing methods often fail to make accurate judgments and cannot perform systematic style identification or interpretable reasoning.
By constructing a Chinese poetry-semantic knowledge graph, multiple samples of classical Chinese poems are obtained, which are then divided into multiple style feature sub-channels. Heterogeneous feature extraction is performed to construct a style space and generate fuzzy attribution vectors. Attribution inference is performed using a style fingerprint projection learning model and graph structure. Fuzzy attribution judgment and graph self-update mechanism are introduced to achieve high accuracy and interpretability of style attribution.
It achieves high accuracy and interpretability in attributing classical Chinese poetry styles, and is applicable to attribution reasoning for works by poets whose attribution is questionable, during stylistic transition periods, or in periods of discontinuity. It enhances the robustness and generalization ability of the system, and can identify mixed and evolving styles, making it suitable for scenarios such as the digitization of classical literature and the study of stylistic evolution.
Smart Images

Figure CN121146034B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph reasoning technology, specifically to a method for constructing a Chinese poetry-semantic knowledge graph. Background Technology
[0002] In recent years, the digital storage and research of classical Chinese poetry has gradually gained attention. A large number of suspected poems have been discovered during the collation of various ancient books and the construction of databases, and there is considerable controversy over their author attribution or authenticity. However, traditional analysis methods based on keyword matching or statistical frequency are difficult to systematically identify the "stylistic features" of poems, especially when poets have highly similar styles or the texts are very short, existing methods often fail to make accurate judgments.
[0003] Classical Chinese poetry possesses unique metrical structures and aesthetic imagery. For example, the use of tones and rhymes, allusions and metonymy, and symbolic combinations constitute the poets' unique linguistic style and cultural cognitive patterns. These deep structures often transcend the lexical level, exhibiting strong semantic dependence and contextual linkage. Traditional statistical methods cannot identify these implicit structures, let alone conduct "interpretive" inferences based on style. Summary of the Invention
[0004] The purpose of this invention is to provide a method for constructing a Chinese poetry-semantic knowledge graph to address the shortcomings of the prior art.
[0005] To achieve the above objectives, this invention provides the following technical solution: a method for constructing a Chinese poetry-semantic knowledge graph, comprising:
[0006] Multiple samples of classical Chinese poems were obtained, and each poem was divided into multiple style feature sub-channels according to its sentence structure. The style feature sub-channels include: tone structure channel, rhyme channel, image combination channel, and allusion semantic channel.
[0007] Heterogeneous feature extraction is performed on each sub-channel to obtain its corresponding feature vector set. ,in Independent embedded expressions representing style characteristics in various dimensions;
[0008] Based on feature vector groups from multiple sub-channels, a style space is constructed through a style fingerprint projection learning model. The style space is a joint mapping space of multiple poet samples, used to generate a fuzzy attribution vector M for each target poem under each style dimension.
[0009] Normalize the fuzzy attribution vector M to obtain the style attribution probability matrix P. Each element P(i,j) in the matrix represents the similarity confidence score of the i-th style in the style fingerprint projection learning model of the j-th poet.
[0010] The style fingerprint projection learning model includes a multi-channel adaptive projection layer and a joint style fusion module, wherein: by applying each feature vector group Feature scale standardization and orthogonal constraints are applied to form a normalized embedding set; then, a multi-channel self-attention mechanism is used to weighted learn the feature dependencies between different channels to obtain the projection matrix. ; the projection matrix Mapped to a unified style latent space; wherein, the joint style fusion module adopts an aggregation mechanism based on contrastive learning, including: constructing a set of style center vectors for a multi-poet sample set. m is the number of poets, each The style mean of a poet is represented; the feature vector group of the target poem is input into the style fingerprint projection model, and the cosine similarity between it and the vectors of each center point is calculated; the similarity is normalized using the Softmax function to obtain the preliminary probability distribution matrix Q of the target poem relative to the styles of each poet; based on Q, dynamic weight adjustment is performed on the target samples to optimize the aggregation position of the samples in the style space, and a preliminary fuzzy attribution representation is obtained. ;
[0011] Based on the style distribution characteristics with confidence levels higher than a threshold in the attribution probability matrix P, a style semantic knowledge graph G is constructed. The style semantic knowledge graph G is an expandable graph structure, where nodes represent specific style feature combination units and edges are metaphor chains constructed based on allusion semantics, image co-occurrence, or rhetorical association.
[0012] The style semantic knowledge graph G is embedded into the reasoning model, and the target poem is inferred and classified by semantic path depth traversal of the graph structure.
[0013] If there are multiple style distributions with similar attribution scores in P, then output the style mixture label and trigger the graph self-update of G, automatically incorporating the target poem as a boundary sample.
[0014] Preferably, the generation process of the fuzzy affiliation vector M includes:
[0015] Will The input semantic manifold embedding layer is processed by a Gaussian kernel-based neighborhood propagation algorithm. Perform structural smoothing;
[0016] Using the semantic embedding vector E of poetry content and The local association weights are optimized using multimodal constraints to form the corrected fuzzy belonging vector M.
[0017] Preferably, obtaining the style attribution probability matrix P includes:
[0018] Nonlinear scaling is applied to each component of vector M, and numerical scaling is performed using an exponential weighting function.
[0019] Each component Mi is transformed into exp(Mi);
[0020] Calculate the sum S of all components after exponential mapping;
[0021] Perform probabilistic calculations on each component Mi, and let the belonging probability be... Thus, we obtain the style attribution probability matrix P, which sums to 1.
[0022] Preferably, the construction of the style semantic knowledge graph G includes:
[0023] Extract the set L of all style labels with confidence scores higher than a set threshold δ from the style attribution probability matrix P;
[0024] Using the poets corresponding to each style tag in L as the initial nodes of the graph, construct a basic style node set N, and establish edges between the nodes and the target poems to indicate their affiliation with the style. ;
[0025] In the corpus, match the target poem with the corresponding poems of existing style nodes in terms of similarity features in rhyme, imagery and allusion, identify the common feature entity set as semantic attribute node A in the graph;
[0026] Connect style node N and attribute node A through a "style-feature" relationship. The associations are made to form the initial semantic triple structure.
[0027] Preferably, embedding the style semantic knowledge graph G into the inference model includes:
[0028] All nodes in the style graph G are embedded and vectorized. A graph embedding algorithm is then used to jointly encode the graph structure and node features to obtain the embedding matrix V.
[0029] Generate the feature vector F_target of the target poem, and perform similarity matching with the graph node embedding matrix V in the embedding space to calculate its projection point in the style graph;
[0030] Based on the vector distance between the target poem projection point and each style node, select the first K nearest neighbors and perform a graph path traversal operation starting from them;
[0031] During the traversal of the path, the attribution confidence score is calculated based on the path semantic labels and historical weight accumulation, and the final style attribution result and inference chain are obtained.
[0032] Preferably, the output style mixing tags include:
[0033] The style scores in the attribution probability matrix P are sorted by difference. If the difference Δ between the top two scores is less than or equal to the threshold ε, the sample is determined to be a style fuzzy sample.
[0034] Construct a style mix label L_mix from the top K style labels by score;
[0035] Assign a corresponding attribution confidence score to each mixed-label element and output it as a joint label;
[0036] The poem is labeled as a style boundary sample in the attribution results.
[0037] Preferably, the triggering of the graph self-update of G includes:
[0038] In the style graph G, identify all associated style nodes in the blend label L_mix and form a style boundary subgraph G_sub as a local update region;
[0039] The target poem is constructed as a new node N_new and connected to each style node in G_sub. The edge type is defined as boundary association and an initial confidence weight is attached.
[0040] Update the weight value of each associated edge, incorporate the embedding vector of the new node N_new into the graph embedding space for training, and update the local embedding parameters.
[0041] The technical effects and advantages provided by the present invention in the above technical solution are as follows:
[0042] 1. This invention overcomes the limitations of existing Chinese poetry style attribution techniques by integrating a style probability matrix and a style semantic knowledge graph, introducing fuzzy attribution judgment, graph inference path analysis, boundary sample absorption, and graph self-updating mechanisms. Through graph neural network embedding modeling and a deep traversal strategy based on path semantic weights, this invention achieves high accuracy and interpretability in style attribution judgment, making it particularly suitable for attribution reasoning and style tracing of works by poets in questionable attributions, those in style transition periods, or those from discontinuous periods.
[0043] 2. The style boundary sample recognition and graph structure self-evolution method proposed in this invention enables the knowledge graph to have adaptive learning capabilities, dynamically expanding the style genealogy structure and continuously enhancing the system's ability to recognize and represent mixed styles, new styles, or evolving styles. This method not only improves the robustness and generalization ability of the style recognition system, but also has wide application value in scenarios such as the digitization of classical literature, style evolution research, automatic annotation, and style transfer generation. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0045] Figure 1 This is a flowchart of the construction method of the Chinese poetry-semantic knowledge graph of the present invention.
[0046] Figure 2 This is a flowchart of the construction process for a style fingerprint projection learning model.
[0047] Figure 3 A flowchart for inferring the stylistic classification of Chinese poetry. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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.
[0049] For examples, please refer to Figure 1 , 2 As shown in Figure 3, the construction method based on Chinese poetry-semantic knowledge graph described in this embodiment includes:
[0050] Multiple samples of classical Chinese poems were obtained, and each poem was divided into multiple style feature sub-channels according to its sentence structure. The style feature sub-channels include: tone structure channel, rhyme channel, image combination channel, and allusion semantic channel.
[0051] Heterogeneous feature extraction is performed on each sub-channel to obtain its corresponding feature vector set. ,in Independent embedded expressions representing style characteristics in various dimensions;
[0052] Based on feature vector groups from multiple sub-channels, a style space is constructed through a style fingerprint projection learning model. The style space is a joint mapping space of multiple poet samples, used to generate a fuzzy attribution vector M for each target poem under each style dimension.
[0053] Normalize the fuzzy attribution vector M to obtain the style attribution probability matrix P. Each element P(i,j) in the matrix represents the similarity confidence score of the i-th style in the style fingerprint projection learning model of the j-th poet.
[0054] The style fingerprint projection learning model includes a multi-channel adaptive projection layer and a joint style fusion module, wherein: by applying each feature vector group Feature scale standardization and orthogonal constraints are applied to form a normalized embedding set; then, a multi-channel self-attention mechanism is used to weighted learn the feature dependencies between different channels to obtain the projection matrix. ; the projection matrix Mapped to a unified style latent space; wherein, the joint style fusion module adopts an aggregation mechanism based on contrastive learning, including: constructing a set of style center vectors for a multi-poet sample set. m is the number of poets, each The style mean of a poet is represented; the feature vector group of the target poem is input into the style fingerprint projection model, and the cosine similarity between it and the vectors of each center point is calculated; the similarity is normalized using the Softmax function to obtain the preliminary probability distribution matrix Q of the target poem relative to the styles of each poet; based on Q, dynamic weight adjustment is performed on the target samples to optimize the aggregation position of the samples in the style space, and a preliminary fuzzy attribution representation is obtained. ;
[0055] Based on the style distribution characteristics with confidence levels higher than a threshold in the attribution probability matrix P, a style semantic knowledge graph G is constructed. The style semantic knowledge graph G is an expandable graph structure, where nodes represent specific style feature combination units and edges are metaphor chains constructed based on allusion semantics, image co-occurrence, or rhetorical association.
[0056] The style semantic knowledge graph G is embedded into the reasoning model, and the target poem is inferred and classified by semantic path depth traversal of the graph structure.
[0057] If there are multiple style distributions with similar attribution scores in P, then output the style mixture label and trigger the graph self-update of G, automatically incorporating the target poem as a boundary sample.
[0058] In this invention, multiple samples of classical Chinese poems are first obtained through Chinese poetry databases or collections of works by known authors. The poetry samples should include typical metrical forms such as five-character poems, seven-character poems, regulated poems, and quatrains to ensure the richness and representativeness of stylistic features.
[0059] Each poem text is automatically segmented syntactically, identifying rhythmic units, word count structure, and parallelism in each line. This analysis provides a structured foundation for subsequent feature channel construction. For example, in a seven-character regulated verse, eight parallel couplets and transitional phrases can be identified.
[0060] Channel segmentation strategy: Based on the above structural analysis results, the poetry content is further divided into the following style feature sub-channels. Each channel is specifically responsible for capturing a certain type of style dimension feature, including but not limited to:
[0061] Tonal Structure Channel: Based on the metrical requirements of classical poetry, this channel marks the tonal pattern of each character, generating a "rhythmic vector sequence" for the entire poem. This channel helps to capture the author's habits and preferences in using rhythmic patterns.
[0062] Rhyme Channel: Identifying the position of rhymes and their corresponding rhyme groups in a poem, and classifying them using rhyme dictionaries such as the Guangyun and Pingshui Rhymes to form a rhyme distribution pattern. This pattern often reflects stylistic characteristics such as "rhyme stability" and "rhyme change frequency" in a poet's style.
[0063] Imagery Combination Channel: Utilizing a predefined dictionary of classical Chinese imagery, this channel extracts and categorizes imagery words (such as "lone boat," "cold mountain," and "setting sun") contained in poems, statistically analyzes the combination relationships of images across dimensions such as space, time, color, and sensory experience, and constructs an "imagery co-occurrence network." This channel is primarily used to analyze the aesthetic imagery system of poetry.
[0064] Allusion Semantic Channel: Based on named entity recognition and a historical corpus, this channel identifies the allusions and source words used in poems, and semantically categorizes the usage of allusions (direct quotation, adaptation, irony, etc.) through context. This channel reflects the poet's cultural depth and rhetorical inclinations.
[0065] In this invention, the feature extraction process does not use a single embedding model to uniformly encode all sub-channels. Instead, it designs corresponding feature extraction strategies and vectorization methods for each sub-channel based on its information type, semantic level, and structural features, thereby constructing a feature set composed of multiple sets of style vectors.
[0066] Level and oblique structure channel ( For the tonal structure channel, a rule-based encoding method based on rhythmic pattern recognition is used to construct a character-level "tone sequence matrix," where each bit is encoded as level (0), oblique (1), or neutral ( ). This data is then aggregated based on the rhythmic symmetry of the entire sentence to generate a sparse vector representing the rhythmic structure of the poem. This vector can be further embedded into a recurrent neural network (such as Bi-LSTM) to extract rhythmic pattern features, which are then used to form a vector. .
[0067] Rhyme Channel ( The rhyme channel adopts an embedding encoding based on rhyme category, mapping rhyming words to their respective rhyme category. By statistically analyzing the distribution frequency of each rhyme category in the poem, the location of rhyme changes, and the concentration at the end of sentences, a rhyme embedding representation with context constraints is constructed. At the same time, a temporal attention mechanism is introduced to capture the changing trend of rhyming strategies, and finally the embedding vector F2 is obtained.
[0068] Imagery Combination Channel ( In the imagery channel, each imagery word is first matched and its category label (such as natural scenery, human figures, time imagery, etc.) is marked using a Chinese classical imagery dictionary. Then, an imagery co-occurrence graph is constructed, with images as nodes and co-occurrence relationships as edges. A graph neural network (GNN) is used to encode the graph structure, extracting the combination patterns and structural density indices between images to form a high-dimensional semantic imagery vector. .
[0069] Allusion semantic channel ( For the allusion channel, a pre-trained Chinese BERT model or ERNIE knowledge-enhanced model is used to encode the context of the sentence containing the allusion. At the same time, the implicit cultural semantics are embedded into the context vector by combining the source links in the knowledge base, forming a knowledge vector representing the poet's style of allusion. This feature vector also includes dimensions such as contextual sentiment, citation style, and cultural citation frequency.
[0070] Other auxiliary channels ( For example, parallel structure channels, rhetorical structure channels, and semantic graph channels are modeled using structural recognition models (such as LSTM and Transformer structural attention models) to model sentence-level parallel relationships, rhetorical repetition and attributive relationships, and further supplement the expression of style features.
[0071] Each vector in the above vector set Both represent the independent, structured representation of poetry within a specific stylistic dimension, which can be viewed as a "style projection" within that dimension.
[0072] This invention completes multiple style sub-channel feature vector groups After obtaining the style fingerprint, a multi-poet joint style space is further constructed through a style fingerprint projection learning model.
[0073] Since the feature vectors generated by each sub-channel may differ significantly in dimension, scale, and expression density, to avoid information skewness and the risk of single-channel dominance, this invention first addresses the feature vector group... Perform normalization processing.
[0074] Each vector All elements are linearly scaled using a min-max normalization function, mapping their values to the [0,1] interval. Simultaneously, an orthogonal constraint mechanism is introduced to ensure the independence of different channel vectors in the high-dimensional feature space. This is achieved by performing principal component analysis (PCA) on the vector set and ensuring vector direction differences by preserving the principal axis independence constraint (i.e., the angle between adjacent principal components must not be less than 60 degrees), thereby enhancing the "feature sensitivity" of each channel to the style dimension.
[0075] After standardization, the input vector set is fed into the style fingerprint projection learning model. This model consists of a multi-channel attention network and a joint projection layer, implemented as follows:
[0076] Multi-channel attention mechanism: To model the dependencies between channels, a self-attention mechanism is introduced to calculate feature weights for each channel vector. The specific operation includes: assuming each channel vector is... First, the query is mapped to three vectors—query (Q), key (K), and value (V)—through a shared fully connected layer. Then, a dot product similarity operation is performed on Q and K to obtain the inter-channel attention weight coefficient matrix A. Finally, all V values are weighted and combined using A to obtain the enhanced expression vector. The enhanced representation vectors of all channels are concatenated to form a multi-channel feature fusion representation F_concat.
[0077] Joint style projection layer: F_concat is input to the joint projection layer, which is a set of parameterized transformation matrices. , where m represents the number of poets. Each This is used to project the input features onto the style subspace of poet i, obtaining a vector representation of the corresponding poet's style. At this point, the target poem is mapped to a set of response intensities across multiple poet style dimensions.
[0078] Next, based on the above multidimensional projection results, an initial fuzzy affiliation vector M0 is generated, which specifically includes the following steps:
[0079] During the model training phase, the mean representation of all training poems for each poet in the feature space is calculated to form a set of style centroids. ,in Let be the average vector of the training samples for the i-th poet in the style space.
[0080] The fusion feature vector of the target poem and each center point vector Calculate the cosine similarity to obtain a similarity vector S of length m. Then, use the Softmax function to normalize S so that the sum of the similarities is 1, thereby constructing the initial fuzzy assignment probability matrix Q.
[0081] Based on the probability distribution of Q, the representation position of the target poem in the style space is adjusted. That is, its embedding representation is fine-tuned to the weighted average point. This point represents its fuzzy attribution projection position in the style space, thus forming the initial vector of fuzzy attribution degree. .
[0082] Considering that the style space may lack stable interpretability due to its high-dimensional sparsity, resulting in fuzzy attribution degrees, this invention introduces a semantic manifold embedding mechanism to address this issue. Further corrections are needed.
[0083] Construct a local semantic neighborhood of the target poem consisting of its k nearest neighbors (k=10). Use a Gaussian kernel function to weight these neighbors, with the weight function defined as follows: , where d is the style vector distance and σ is an empirically set scaling factor (e.g., 0.2). Within this neighborhood, for Perform local smoothing to generate the manifold correction vector M.
[0084] During the model training phase, to prevent the model from getting trapped in local optima or channel-specific bias, this invention introduces a cross-style regularization mechanism:
[0085] Randomly select sample pairs of the same poet and different poets from the training samples to construct a set of style vector pairs. Calculate the Euclidean distance or cosine distance between each pair of samples to form a style distance matrix D.
[0086] The regularization objective is to minimize the style distance between sample pairs of the same poet and maximize the distance between sample pairs of different poets. A contrastive loss function (such as Triplet Loss) is introduced during training for optimization.
[0087] By statistically analyzing the weight contribution of each sub-channel during supervised training, if the cluster contribution of a certain channel exceeds a set threshold (such as 40%), a channel entropy regularization penalty term is automatically introduced to suppress its excessive dominance.
[0088] After calculating the aforementioned fuzzy style attribution vector M, the components of this vector need to be mapped to a standardized probability form to form the style attribution probability matrix P.
[0089] Specifically, for each component Mi in the fuzzy vector M, a nonlinear exponential mapping is first performed, that is, Mi is replaced by the exponential function exp(Mi). This operation can amplify the numerical differences between different style response values and improve the discriminative power of the final probability distribution.
[0090] Subsequently, the sum S of all the components after the exponential mapping is calculated, denoted as: .
[0091] Finally, the probability Pi of each style attribution can be calculated using the following formula: This normalization process ensures that the sum of all Pi values is 1, forming a normalized probability matrix P={P1,P2,...,Pm}, whose dimension is consistent with the number of poets corresponding to the training samples in the style space. Each component Pi represents the probability of the target poem belonging to the style of poet i.
[0092] To improve the reliability of the style labels output by the model, this invention introduces a style confidence threshold δ to judge the generated probability matrix P, thereby distinguishing between "deterministic style attribution" and "fuzzy multi-style attribution".
[0093] The specific implementation is as follows: Calculate the maximum component P_max in the probability matrix P, i.e., Pi with the largest value in P; if P_max ≥ δ, then determine that the target poem belongs to style i (i.e., the index where P_max is located); if P_max < δ, then determine that the poem is a "multi-style fusion" sample, and output the top K style labels with the highest probabilities as the fuzzy attribution set. Here, δ is the style confidence threshold, generally between 0.6 and 0.85, with a default recommended value of 0.75; K is the maximum number of output styles, with a default value of 3.
[0094] To further enhance the consistency between the style attribution probability matrix P and the semantic connotation of the poem, this invention proposes a "contextual style consistency correction mechanism," which introduces the semantic information of the poem text into the probability distribution correction process to achieve modal collaborative optimization.
[0095] The specific steps are as follows: Encode the target poem text using a pre-trained Chinese semantic model (such as RoBERTa, ERNIE, or BERT-wwm) to generate its contextual semantic vector E; map the semantic vector E to a style space representation of the same dimension to obtain the semantic style prediction vector E′; compare the directional consistency between the attribution probability matrix P and E′, using cosine similarity as an alignment metric, defined as: similarity (P, E′) = cosine of the angle between the vectors, with values closer to 1 indicating greater consistency; construct a joint objective function to minimize the distance between P and E′ while retaining the significant weights of the indices corresponding to the top K largest components in the original P, ensuring that the main style attribution is not weakened; fine-tune P using gradient descent or the minimum mean square error loss function to form a probability matrix corrected for semantic consistency.
[0096] Based on the style attribution probability values in the style attribution probability matrix, a confidence threshold δ (delta) is set to filter out style categories with credible attribution, which serve as the node source for the graph construction.
[0097] In this invention, the confidence threshold δ is an adjustable real-valued parameter, with a recommended range of 0.6 to 0.9 and a default setting of 0.75. That is, a poet corresponding to a style is only included as a "style node" in the graph when the probability of a style attribution Pi ≥ δ. This screening process controls the size of the graph nodes and enhances the semantic reliability of the graph structure.
[0098] All selected style tags constitute a set Each For a specific poet or style category in the training set, the corresponding style node is constructed in the graph. Each style node contains the following structural information fields:
[0099] Node ID: A unique identifier for the corresponding poet; Style center vector: The mean representation of the style vectors in the poet's training samples; Style tag name: Such as "Li Bai style", "Du Fu style", "Late Tang frontier poetry style", etc.; Links to typical works of the style: Used for tracing the source; Historical dynasty field: Used for subsequent graph hierarchy division. Each style node is connected to the target poem through an "belongs to" relationship edge, forming a basic initial graph triplet structure (poem, belonging to, style node).
[0100] To enhance the descriptive power of style nodes, this invention extracts style features from the target poetry text in dimensions such as rhyme, imagery, and allusion, and matches them with the common content of existing poems in each style node to construct a "semantic attribute node set" A.
[0101] The process includes: extracting the rhyme groups of the rhymes in the poem (such as the "Dong" and "Geng" rhymes in the Pingshui rhyme system) to form nodes "Rhyme_Eastern" and "Rhyme_Geng"; using an imagery dictionary (constructed from the corpus of the Complete Tang Poems) to identify symbolic imagery words in the poem, such as "setting sun," "lonely boat," and "cold mountain," as imagery nodes; locating allusions in the poem through an allusion identification module, such as "a poem must be written when climbing a height" and "Chang'e flying to the moon," generating allusion nodes; and using sentence structure attributes such as parallelism, complex sentences, and rhyme changes as structural attribute nodes. Each item in the above feature entity A is constructed as an attribute node and connected to the current target poem and its candidate style nodes, with the relationship type being "feature inclusion," "shared rhetoric," or "allusion association," etc.
[0102] To reflect the evolution, fusion, and opposition between different styles, this invention further establishes multi-category semantic edge relationships between style nodes.
[0103] First, define a set of semantic relation categories R, including the following five types: "Inherited from": used to describe the continuation of the style of predecessors by later poets; "Varied from": indicating a deviation from the original style in terms of theme or form; "Co-occurred in": indicating that two styles often appear together in the work (style mixing); "Transformed into": used to describe the changes in the poet's style at different periods; "Merged into": indicating that two styles constitute a new style expression in a certain type of work.
[0104] The specific steps for generating relationships are as follows: Calculate the cosine similarity of the center vectors of two style nodes. If the similarity is ≥0.85, the styles are considered to be highly similar and are considered as candidates for "co-occurrence" or "fusion".
[0105] Graph matching analysis is performed on the sets of related attribute nodes of two style nodes. If the number of intersections exceeds 5 and accounts for more than 30% of their respective totals, it is determined that there is a "variant" or "inheritance" relationship. A style evolution map is constructed using text timestamp information (poet's dynasty, year of work). A style evolution flow prediction model is formed by training a graph neural network to automatically determine the direction of "inheritance" or "transformation".
[0106] The generated edges are represented in standard RDF triples, with the structure: (style_A, variant of, style_B); (style_C, merged into, style_D). These edges are then incorporated into a knowledge graph database to complete the construction of the style semantic layer.
[0107] Embedding representation learning is performed on all nodes (including style nodes and attribute nodes) in the graph G, that is, the structural and semantic information of the nodes is encoded into a unified vector form, which facilitates subsequent vector calculation and similarity analysis.
[0108] In this invention, graph embedding is implemented using the GraphSAGE algorithm. This algorithm is a neighbor-sampling graph neural network that possesses scalability and local structure preservation. Its basic process is as follows:
[0109] Each node is initialized with the average word vector of its semantic label, or with a semantic embedding vector obtained through a pre-trained model (such as BERT).
[0110] For each node, sample its first and second-order neighbors and extract their semantic embeddings. Integrate these neighbor embeddings using aggregation functions (such as mean aggregation, LSTM aggregation, or max pooling). Concatenate the current node's embedding with the neighbor aggregation results, perform a nonlinear transformation, and output the current node's embedding vector. Multiple layers are stacked to achieve deeper graph structure encoding, ultimately yielding a low-dimensional embedding vector for each graph node. The dimension can be set to 128 or 256. The embedded node vectors constitute the graph embedding matrix V, representing the positions of all nodes in G within a unified vector space.
[0111] For the target poem being judged, its multidimensional style feature vector group is first extracted through a channel feature extraction process consistent with the training samples. Then, channel fusion and normalization are performed to finally generate a comprehensive style representation vector of the target poem, denoted as F_target.
[0112] To achieve alignment with the graph node embedding space, F_target is projected into the graph embedding space using a unified embedding mapping function. For example, a linear projection can be performed using a fully connected layer with the same embedding dimension as the graph nodes. Where W is the projection weight matrix with dimensions (d, d'), b is the bias term, d is the original vector dimension, and d' is the graph embedding dimension (e.g., 128).
[0113] Calculate the similarity (e.g., cosine similarity) between F_target′ and the style node vectors in the graph embedding matrix V, and select the top K most similar style nodes as candidate nodes. K is generally set to 3 to 5.
[0114] Starting from the K candidate style nodes mentioned above, semantically guided path traversal is performed in the graph structure to explore deeper style association paths, thereby constructing inference chains and scoring the credibility of attribution.
[0115] The process includes the following core operations: setting the semantic type priority of graph edges, with priorities from high to low as: "belonging to", "inherited from", "variant to", "fused to", and "co-occurring in". During traversal, paths are expanded along high-priority edges first, limiting the participation of low-priority edges and improving the semantic purity of the path.
[0116] To avoid information generalization or invalid reasoning caused by excessively deep paths, a maximum traversal depth limit d_max is introduced, with a recommended value of 3, meaning the path is limited to no more than 3 hops. If a path reaches the target node at hop d, the expansion stops and the path structure is recorded.
[0117] Define a path scoring function Score(p) to evaluate the credibility of each semantic path p. The specific formula is as follows: Where w_i is the semantic weight of the i-th edge in the path (defined according to priority), d_i is the position (number of hops) of the edge in the path, and γ is the semantic decay coefficient, generally set to 0.8. The higher the score, the more credible the path and the clearer the style attribution. Several paths with the highest scores are retained as style inference path candidates, and their endpoint style nodes are recorded as predicted attribution label candidates.
[0118] The attribution label set and path score results obtained from graph inference need to be fused with the attribution probability matrix P derived from the fuzzy attribution vector M to form the final style attribution determination.
[0119] The fusion process includes the following steps: Let the attribution label given by the graph inference be L_G, and the attribution score be S_G; let the highest label given by the attribution probability matrix P be L_P, and the corresponding probability be S_P. Let the fusion weights be... : These correspond to the weights of graph inference and probability models, respectively. It is recommended to set it to , The final style attribution score is: If L_G and L_P are the same, then the label is directly output as the attribution result; if they are different, then the following semantic consistency constraint strategy is executed.
[0120] Calculate the cosine similarity between the semantic vector E_target of the target poem text and the text semantic vectors E_G and E_P of the corresponding style nodes of L_G and L_P. If the similarity (E_target, E_G) > the similarity (E_target, E_P), then L_G is selected; otherwise, L_P is selected.
[0121] After the attribution probability matrix is generated, its attribution values are sorted to determine whether there are multi-style cases with similar scores.
[0122] The specific steps are as follows: Sort all components in P in descending order of confidence level, denoted as... ; Calculate the difference Δ between the reliability scores of the first two positions, defined as If Δ is less than or equal to the preset difference threshold ε, it is determined to be a sample with ambiguous style attribution, triggering the mixed label mechanism.
[0123] In this invention, the threshold ε is a floating-point number, ranging from 0.05 to 0.15, with a recommended default value of 0.1, used to control the sensitivity of the mixing decision. After the mixing condition is met, the top K style labels with the highest scores are selected from P to form the style mixing label L_mix. The recommended value for K is 2 to 4, with a default setting of 3. L_mix is output as the joint label of the poem sample and stored in the sample metadata for subsequent training, visualization, or classification.
[0124] Once the style mixing label L_mix is determined, this invention treats the poem sample as a "style boundary sample" and triggers a structural update mechanism for the style semantic knowledge graph G.
[0125] The update process consists of the following steps: In the knowledge graph G, identify the style nodes corresponding to each style tag in L_mix, and construct a subgraph G_sub. This subgraph contains only the style nodes of the mixed tag and their related semantic edges.
[0126] The current target poem sample is constructed as a new node N_new in the graph. The node attributes include: poem ID, style mixing label L_mix, text embedding vector, image label, rhyme information, etc.; the annotation type is "boundary sample".
[0127] Establish connection edges for all style nodes from N_new to G_sub, with the edge type defined as "Edge_Type=BOUNDARY_LINK". The initial weight of each edge is set to the probability value of the style tag in P.
[0128] To control the impact of boundary samples on the structure in the graph, this invention introduces a dynamic edge weight update mechanism and a time decay control strategy: the initial weight of each "boundary association" edge is... , representing the semantic relevance between boundary nodes and style nodes; after each training iteration, an edge weight decay coefficient α (ranging from 0.8 to 0.95) is introduced to reduce the long-term dominance of aging edges on the graph structure; that is, the edge weight update formula is: When the weight of an edge is lower than the decay threshold θ (recommended to be set to 0.3), it can be marked as a "weak connection edge" and can be a candidate for subsequent graph pruning edges.
[0129] All boundary sample nodes N_new are incorporated into the graph embedding space and participate in the subsequent graph embedding training process so that they can learn their true boundary locations and belonging trends in the graph space.
[0130] To improve the system's ability to identify style-fuzzy samples, this invention further proposes a boundary sample contrast learning strategy, which is mainly used to optimize the decision boundary in the style embedding space.
[0131] The implementation steps are as follows: Positive sample pairs: consisting of a boundary sample node and its corresponding style node in L_mix; Negative sample pairs: consisting of a boundary sample node and its unlabeled style node. Margin-based Triplet Loss or a contrastive loss function is used to train and optimize the boundary embedding vectors. The optimization objective is to minimize the Euclidean distance between positive sample pairs and maximize the distance between negative sample pairs. The uncertainty entropy index H_mix of the boundary samples is defined as follows: ,in H_mix represents the style confidence of the i-th style in the mixed label; the higher the H_mix, the more "fuzzy" the sample is, and the higher the structure adjustment weight is given when updating the map.
[0132] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for constructing a Chinese poem-semantic knowledge graph, characterized in that: The method comprises the following steps: a plurality of Chinese classical poetry samples are obtained, and each poem is divided into a plurality of style feature sub-channels according to its sentence structure, the style feature sub-channels comprising: a level structure channel, a rhyme channel, an image combination channel and a allusion semantic channel; Respectively, each sub-channel is executed heterogeneous feature extraction, and the corresponding feature vector group is obtained wherein independent embedding expression representing each dimension style feature a style space is constructed by a style fingerprint projection learning model based on a feature vector group of the plurality of sub-channels, the style space being a joint mapping space of the plurality of poet samples, and being used to generate a fuzzy attribution degree vector M of each target poem in each style dimension; the fuzzy attribution degree vector M is normalized to obtain a style attribution probability matrix P, wherein each component Pi represents the attribution probability of the target poem in the style of poet i; The style fingerprint projection learning model comprises a multi-channel adaptive projection layer and a joint style fusion module, wherein: by performing feature scale normalization and direction orthogonal constraint on each feature vector group , a normalized embedding set is formed; then, a multi-channel self-attention mechanism is used to learn the feature dependency relationship between different channels, to obtain a projection matrix ; the projection matrix is mapped to a unified style latent space; wherein, the joint style fusion module adopts an aggregation mechanism based on contrast learning, comprising: constructing a style center point vector set of a multi-poet sample set , m is the number of poets, wherein is the average vector of the i th poet training sample in the style space; the feature vector group of the target poem is input into the style fingerprint projection learning model, and the cosine similarity between the feature vector group and each center point vector is calculated; the similarity is normalized by using a Softmax function, to obtain a preliminary probability distribution matrix Q of the target poem with respect to the styles of each poet; based on Q, dynamic weight adjustment is performed on the target sample, to optimize the aggregation position of the sample in the style space, to obtain a preliminary fuzzy attribution degree representation ; a semantic manifold embedding mechanism is introduced, and a structure smoothing is performed on by using a neighborhood propagation algorithm based on a Gaussian kernel, to generate a fuzzy attribution degree vector M of each target poem in each style dimension. a style semantic knowledge graph G is constructed according to the style distribution features with a confidence higher than a threshold in the style attribution probability matrix P; the style semantic knowledge graph G is an expandable graph structure, the nodes of which represent specific style feature combination units, and the edges are metaphor chains constructed according to allusion semantics, image co-occurrence or rhetorical association; the style semantic knowledge graph G is embedded into an inference model, and the target poem is attributed and classified according to the semantic path depth traversal of the graph structure; if there are multiple style distributions with close attribution scores in P, a style mixed label is output and the graph self-updating of G is triggered to automatically absorb the target poem as a boundary sample.
2. The method for constructing a Chinese poem-semantic knowledge graph according to claim 1, characterized in that: The style attribution probability matrix P is obtained by: performing nonlinear scale adjustment processing on each component in the fuzzy attribution degree vector M, and using an exponential weighting function form to scale the values; wherein each component Mi is transformed into exp(Mi) after transformation; calculating the sum S of all components mapped by the exponential function; The probability calculation is performed for each component Mi, and the attribution probability P is given by Thus, the style attribution probability matrix P with a total sum of 1 is obtained.
3. The method for constructing a Chinese poem-semantic knowledge graph according to claim 1, characterized in that: The style semantic knowledge graph G is constructed by: extracting all style label sets with a confidence higher than a set threshold δ from the style attribution probability matrix P; A style node is constructed with each poet corresponding to each style label in the style label set as an initial node of a graph, and a type of edge between the node and the target poem is established ; matching the similar features of the target poem and the existing style node corresponding poem in the rhyme, image and allusion dimensions in the corpus, identifying the common feature entity set as the semantic attribute node set in the graph; The style node is associated with the set of semantic attribute nodes through a "style-feature" relationship edge The association is performed to form an initial semantic triple structure.
4. The method for constructing a Chinese poem-semantics knowledge graph according to claim 3, characterized in that: embedding the style semantic knowledge graph G into an inference model comprises: performing embedding vectorization processing on all nodes in the style semantic knowledge graph G, and jointly encoding the graph structure and node features by using a graph embedding algorithm to obtain a graph embedding matrix V, generating a comprehensive style representation vector F_target for the target poem, and performing similarity matching with the graph embedding matrix V in the embedding space to calculate the projection point of the target poem in the style graph; based on the vector distance between the projection point of the target poem and each style node, selecting the top K nearest nodes and taking them as the starting point to perform graph path traversal operation; during the traversal process, the attribution confidence score is calculated according to the path semantic label and the historical weight accumulation to obtain the final style attribution result and the reasoning chain.
5. The method for constructing a Chinese poem-semantic knowledge graph according to claim 1, characterized in that: The output style mixed label comprises: differentially sorting each style score in the style attribution probability matrix P, if the difference Δ between the top two scores is less than or equal to a threshold ε, it is determined that the sample is style fuzzy; constructing a style mixed label L_mix from the top K style labels in the score. Assign each mixed label element its corresponding attribution confidence and output it as a joint label form; Mark the poem as a style boundary sample in the attribution result.
6. The method for constructing a Chinese poem-semantic knowledge graph according to claim 5, characterized in that: The atlas self-updating of the trigger G includes: Identify all associated style nodes in the style mixed label L_mix in the style atlas G, form a style boundary subgraph G_sub as a local update area; Construct the target poem as a new node N_new and connect it to each style node in G_sub, with the edge type defined as boundary association and the initial confidence weight attached; Update the weight value of each associated edge and include the embedding vector of the new node N_new in the atlas embedding space training to update the local embedding parameters.
Citation Information
Patent Citations
Poem-semantic knowledge graph construction method and system
CN110929045A
Intelligent ancient poetry question and answer method and system based on knowledge graph
CN116737889A