A legal term matching and translating method based on a semantic graph
By using a semantic graph-based approach, the emotional tone and semantic field vectors of paragraphs are calculated, grammatical markers and modifier phrases of legal terms are identified, and a cross-linguistic emotional potential field model is used for calibration. This solves the problem of insufficient emotional tone and semantic field coherence in the translation of legal terms in existing technologies, and achieves logical consistency and preservation of emotional color in the legal translation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LIAONING UNIVERSITY
- Filing Date
- 2026-04-09
- Publication Date
- 2026-07-03
AI Technical Summary
Existing methods for translating legal terminology fail to effectively model and maintain the original text’s unique emotional tone and semantic field coherence between paragraphs, resulting in translations that are deficient in rhetorical force and logical consistency.
Using a semantic graph-based approach, paragraph sentiment tone vectors and semantic field vectors are calculated to identify grammatical markers and modifier phrases in legal terms. A cross-linguistic sentiment potential field model is used to search for potential paragraphs with continuous transitions between sentiment and semantics in the target language corpus. The grammatical compatibility of modifier phrases is then used for calibration, and finally, the target language legal terms are output and a potential matching report is generated.
It achieves a balance between conceptual accuracy and stylistic consistency in the translation of legal terminology, maintains the seriousness, certainty, and other emotional qualities of the original text, as well as the semantic coherence between paragraphs, and enhances the overall rhetorical effectiveness and logical consistency of the legal translation results.
Smart Images

Figure CN122334296A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and more specifically to a method for matching and translating legal terms based on semantic graphs. Background Technology
[0002] With increasingly frequent global legal exchanges and cooperation, the demand for understanding and translating cross-language legal documents continues to grow. The core challenge of legal translation lies in the accurate matching of legal terminology, which involves not only language conversion but also the equivalent conversion of concepts, validity, and context across different legal systems. Traditionally, this work has heavily relied on professionals with bilingual legal backgrounds, a process that is time-consuming, labor-intensive, and difficult to scale. Therefore, utilizing computational technology to automate or assist in the translation of legal terminology has become an important research direction in the field of legal technology.
[0003] Currently, automated legal terminology translation methods are developing along two main technological paths. The first is a rule-based and knowledge-based approach, which establishes mapping relationships between concepts by constructing bilingual legal terminology dictionaries and semantic graphs, and performs lookups and substitutions during translation. The second is a data-driven approach, which trains machine translation models using large-scale parallel legal corpora and predicts terminology translations based on contextual co-occurrence information. These methods, to some extent, treat terms as isolated conceptual units or statistical patterns within contextual word sequences, aiming to achieve basic correspondence at the conceptual level.
[0004] However, existing legal terminology translation techniques are primarily based on terminology equivalence and contextual analysis, but often fail to adequately consider the unique emotional tone and semantic continuity of legal texts. Traditional methods, when processing legal documents, tend to simplify or treat emotional factors as secondary, focusing mainly on concept mapping and grammatical structure transformation. This results in translations that, while conceptually accurate, struggle to fully retain the seriousness, certainty, or urgency of the original text, thus weakening the rhetorical force and persuasiveness of the target text. Furthermore, existing technologies lack systematic modeling of the semantic coherence of paragraphs and even the entire text. Term substitutions frequently lead to inconsistencies in the logical atmosphere and conceptual connections of the target text, failing to meet the requirements of high-precision legal translation for overall stylistic consistency and continuity of emotional persuasiveness. Summary of the Invention
[0005] The purpose of this invention is to provide a semantic graph-based legal terminology matching and translation method to solve the following technical problems: Existing methods for translating legal terminology fail to effectively model and maintain the original text's unique emotional tone and the semantic coherence between paragraphs when achieving concept mapping, resulting in translations that are insufficient in rhetorical power.
[0006] The objective of this invention can be achieved through the following technical solutions: A semantic graph-based legal terminology matching and translation method includes the following steps: S1. Input the full text of the legal document in the source language. Based on semantic integrity and format marks, the full text is divided into multiple paragraph units. For each paragraph unit, calculate its paragraph sentiment vector and extract the semantic field vector. S2. Within each paragraph unit, all legal terms are located using a legal domain named entity recognition model, and each term is used as the center to extract its adjacent complete sentences as a sentence-level context window. S3. Analyze the grammatical structure of the sentence-level context window, identify the grammatical markers that express legal validity attributes, and extract the modifier phrases that have a direct grammatical relationship with legal terms; S4. Input the paragraph sentiment tone vector, semantic field vector, grammatical marker words and modifying phrases into the cross-linguistic sentiment potential field model, and search for potential target paragraphs with continuous transitions between sentiment and semantics in the target language corpus. S5. Identify candidate terms that are conceptually equivalent to the source terms from the potential target paragraphs, calculate the potential energy matching degree between the source paragraphs and the target paragraphs, and calibrate them in combination with the grammatical compatibility of the modifier phrases. S6. Output the final target language legal terminology, and simultaneously generate a potential energy matching report containing sentiment-semantic coordinates and a contextual transition description of the impact on text coherence.
[0007] As a further aspect of the present invention: in step S1, the specific process of calculating the paragraph emotional tone vector and extracting the semantic field vector is as follows: Each segmented paragraph unit is lexicalized, format control characters and punctuation marks are removed, and the lexical sequence is input into a sentiment analysis model trained on legal document corpus. The sentiment analysis model outputs the quantitative intensity value of the paragraph unit on multiple preset sentiment dimensions. The preset sentiment dimensions include certainty, urgency, formality and seriousness. The quantitative intensity values of each sentiment dimension are arranged in a preset order to form a paragraph sentiment tone vector. The frequency of all semantic words in paragraph units is counted, and a pre-constructed legal domain concept graph is queried. The legal domain concept graph contains legal concepts represented by nodes and the relationships between concepts represented by edges. Semantic words in paragraph units are mapped to corresponding nodes in the concept graph. All related concept nodes connected by a single edge with the corresponding node as the center are extracted to form a local concept network. All concept nodes in the local concept network are vectorized, and the geometric centroid of the resulting vector is calculated. The geometric centroid vector is used as the semantic field vector of the paragraph unit.
[0008] As a further aspect of the present invention: In step S2, the specific process of locating legal terms and capturing the sentence-level context window is as follows: In each paragraph unit, a legal domain named entity recognition model is run. The model identifies legal term entities in the text based on the word formation rules and contextual patterns of legal terms, and records the start and end character positions of each identified legal term entity in the paragraph unit text. Based on the starting and ending character positions, the smallest complete sentence boundary containing legal term entities is located in the entire text of the paragraph unit. Within the scope of the located sentence boundary, a complete text segment from the starting character to the ending character of the sentence is extracted, forming a sentence-level context window centered on the legal term. If the same legal term appears multiple times in the paragraph unit, the positioning and extraction operations are performed independently for each occurrence.
[0009] As a further aspect of the present invention: in step S3, the specific process of identifying grammatical markers and extracting modifying phrases is as follows: Sentence-level context window is subjected to grammatical dependency analysis. A grammatical dependency tree is constructed with the target legal term as the root node. The grammatical dependency tree is traversed, and all child nodes that are directly connected to the root node through adverbial modification, attributive modification or negative modification are selected. The corresponding words are extracted from the selected child nodes, and the words are collected as grammatical markers that express the legal effect attributes. In the grammatical dependency tree, search all subordinate node subtrees that are reachable from the root node via attributive or adverbial modification chains. Restore each subordinate node subtree to its corresponding original text fragment. The original text fragments constitute modifier phrases that have a direct grammatical relationship with legal terms. Record the grammatical modification relationship type between each modifier phrase and the legal term in the root node.
[0010] As a further aspect of the present invention: the specific process of searching for potential target paragraphs in S4 is as follows: The cross-linguistic emotional potential field model includes a text structure encoding channel, an emotional semantic encoding channel, and a unified semantic space. The set of grammatical marker words and the set of modifying phrases are input into the text structure encoding channel, which is processed by a grammatical relation graph network and outputs a text structure feature vector. The paragraph emotional tone vector and the semantic field vector are input into the emotional semantic encoding channel, which is processed by a multilayer perceptron network and outputs an emotional semantic feature vector. The text structure feature vector and the sentiment semantic feature vector are input into a unified semantic space. The unified semantic space maps the concatenated feature vector into a fixed-dimensional potential state code through a linear transformation layer. Obtain the multilingual paragraph index library corresponding to the target language corpus. The multilingual paragraph index library pre-stores the potential state code of each target language paragraph unit and its original text storage location. Calculate the inner product similarity between the potential state code of the source language paragraph unit and each potential state code in the multilingual paragraph index library. Sort all target language paragraph units in descending order according to the inner product similarity value. Select a preset number of paragraph units in the top row to form a potential target paragraph set.
[0011] As a further aspect of the present invention: the construction process of the cross-linguistic emotional potential field model is as follows: Input multilingual training corpus and corresponding label data. The multilingual training corpus contains pairs of parallel legal text paragraphs that are translations of each other. The label data contains paragraph sentiment tone labels and core semantic field labels for each paragraph unit. Based on the multilingual training corpus and label data, a corresponding potential state code is generated for each paragraph unit through the text structure encoding channel, the sentiment semantic encoding channel and the unified semantic space. A contrastive learning task is constructed in the potential energy state encoding space. The potential energy state encoding of parallel paragraph pairs is defined as a positive sample pair, and the potential energy state encoding of randomly combined non-parallel paragraph pairs is defined as a negative sample pair. The contrastive loss function is calculated based on the positive and negative sample pairs. The parameters of the text structure encoding channel, the sentiment semantic encoding channel, and the unified semantic space are adjusted through the backpropagation algorithm, and the cross-linguistic sentiment potential energy field model with adjusted parameters is output.
[0012] As a further aspect of the present invention: the specific process of locking candidate terms and performing calibration in S5 is as follows: Traverse each target language paragraph unit in the potential target paragraph set, extract all legal terms contained in the paragraph unit, compare each extracted legal term with an authoritative bilingual legal terminology database, obtain the concept equivalence confidence score between the term and the source language legal term, retain legal terms with concept equivalence confidence scores higher than a preset equivalence threshold, and form a candidate term set. For each term in the candidate term set, the potential energy state code of the target language paragraph unit where the term is located is obtained, the difference vector between the potential energy state code of the source language paragraph unit and the potential energy state code of the target language paragraph unit is calculated, and the magnitude and direction cosine of the difference vector are input into the potential energy matching degree calculation function to obtain the initial potential energy matching degree score of the candidate term. The simulation reconstructs the process of recombining source language modifier phrases into the target language grammatical environment where the candidate term is located, based on the recorded grammatical relation types. A grammatical compatibility score is generated based on the evaluation results of the legality and coherence of the simulated reconstructed syntactic structure. The initial potential energy matching score and the grammatical compatibility score are multiplied together according to a preset weighting coefficient to obtain the final calibrated score of the candidate term.
[0013] As a further aspect of the present invention: the specific process of outputting the final target language legal terms and generating a report and description in step S6 is as follows: From the final calibrated scores of all candidate terms, the target language legal term with the highest score is selected as the translation output. The potential energy state codes of the source language paragraph units and the selected target language paragraph units are extracted. The potential energy state codes are decoded to separate the intensity values of each dimension of the paragraph sentiment tone vector and the projection coordinates of the semantic field vector in the reduced-dimensional space. The intensity values of each dimension are plotted as radar charts, and the projection coordinates are marked on two-dimensional scatter plots. The radar charts and two-dimensional scatter plots constitute the visualization attachments of the potential energy matching degree report. By comparing the potential state encoding of paragraph units in the source language and the target language, a structured text describing the differences between the two in terms of emotional tone dimension and semantic field coverage is generated. The structured text and visualization attachments are output together as a contextual transition explanation.
[0014] The beneficial effects of this invention are: This invention constructs a cross-linguistic emotional potential energy field model, using paragraph emotional tone vectors and semantic field vectors as core constraints, to achieve a balance between conceptual accuracy and stylistic consistency in legal terminology translation. The method utilizes text structure encoding channels and emotional semantic encoding channels to process grammatical markers and emotional semantic information respectively, generating potential energy state codes in a unified semantic space. This allows for precise searching of potential paragraphs with continuous emotional and semantic transitions within the target corpus. By calculating the potential energy matching degree and combining it with grammatical compatibility calibration of modifier phrases, the system can filter out terms that are not only conceptually equivalent but also naturally integrate into the emotional atmosphere and logical context of the target language paragraphs. The final translation output, supplemented by a potential energy matching degree report and contextual transition explanations, intuitively presents the impact of terminology substitution on the overall stylistic coherence of the text. This ensures accurate transmission of legal concepts while effectively maintaining the seriousness, certainty, and other emotional tones of the original text, as well as the semantic field coherence between paragraphs, thereby improving the overall rhetorical effectiveness and logical consistency of the legal translation results. Attached Figure Description
[0015] The invention will now be further described with reference to the accompanying drawings.
[0016] Figure 1 This is a flowchart illustrating the present invention. Detailed Implementation
[0017] 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, and 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.
[0018] Please see Figure 1 As shown, this invention is a method for matching and translating legal terms based on semantic graphs, comprising the following steps: S1. Input the full text of the legal document in the source language. Based on semantic integrity and format marks, the full text is divided into multiple paragraph units. For each paragraph unit, calculate its paragraph sentiment vector and extract the semantic field vector. S2. Within each paragraph unit, all legal terms are located using a legal domain named entity recognition model, and each term is used as the center to extract its adjacent complete sentences as a sentence-level context window. S3. Analyze the grammatical structure of the sentence-level context window, identify the grammatical markers that express legal validity attributes, and extract the modifier phrases that have a direct grammatical relationship with legal terms; S4. Input the paragraph sentiment tone vector, semantic field vector, grammatical marker words and modifying phrases into the cross-linguistic sentiment potential field model, and search for potential target paragraphs with continuous transitions between sentiment and semantics in the target language corpus. S5. Identify candidate terms that are conceptually equivalent to the source terms from the potential target paragraphs, calculate the potential energy matching degree between the source paragraphs and the target paragraphs, and calibrate them in combination with the grammatical compatibility of the modifier phrases. S6. Output the final target language legal terminology, and simultaneously generate a potential energy matching report containing sentiment-semantic coordinates and a contextual transition description of the impact on text coherence.
[0019] In a preferred embodiment of the present invention, step S1 involves two core computational tasks: generating a paragraph sentiment tone vector and extracting a semantic field vector. The input to this process is a semantically complete legal document paragraph unit obtained through preliminary segmentation. First, the paragraph unit undergoes lexicalization, a step that converts continuous text into a discrete sequence of lexical units while removing all formatting control characters such as tabs, line breaks, and punctuation. Lexicalization follows the characteristics of legal text, retaining compound words composed of hyphens as a whole, and converting all characters to lowercase to ensure consistency.
[0020] Next, the word sequence is input into a sentiment analysis model specifically trained for legal documents. The training process is as follows: A training corpus of approximately 100,000 legal documents, including judgments, contracts, and bills, is collected. Three legal professionals manually annotate 5,000 randomly sampled paragraph units, using dimensions of certainty, urgency, formality, and seriousness. Each dimension is scored using a 5-level Likert scale; for example, in the certainty dimension, "must" might be labeled as 5, and "can" as 2. Based on this annotated data, a neural network structure with 12 Transformer layers is used for training. The model learns to map word sequences to quantized intensity values across these four dimensions. In the application phase, for each input paragraph unit, the model outputs a tuple containing four values, each corresponding to a quantized intensity value for one of the four preset sentiment dimensions. Each intensity value is a floating-point number between 0 and 1. Arranging these four values in a fixed order of certainty, urgency, formality, and seriousness constitutes the paragraph sentiment tone vector for that paragraph unit.
[0021] Simultaneously, semantic field vector extraction is performed in parallel. First, the frequency of all content words in the current paragraph unit is statistically analyzed. Content words refer to nouns, verbs, adjectives, etc., that represent legal subjects, actions, objects, or modifying concepts, excluding common stop words. Then, a pre-constructed legal domain concept graph is queried. This graph is constructed by extracting legal concept entries from a large-scale legal knowledge base and encyclopedia, with each entry as a node, and generating a standardized definition for each node. Relationships between concepts are extracted by analyzing patterned phrases such as "refers to," "includes," and "applies" in legal provisions and citation expressions such as "refers to" and "distinguished from" in case law, forming three types of edges: hierarchical, citation, and conflict. The final graph contains over 500,000 legal concept nodes and over 2 million relationship edges. Content words in the paragraph are matched with this graph and mapped to corresponding concept nodes. Then, all neighboring concept nodes directly connected to these mapped nodes through a single relationship edge are extracted. The set of these central nodes and their neighboring nodes is called the local concept network of the paragraph.
[0022] To vectorize the local concept network, a word vector model trained on legal text corpora is employed. This model represents each concept node as a dense 300-dimensional vector. For the vector representations of all concept nodes in the local concept network, their geometric centroids are calculated. Specifically, the arithmetic mean of all 300-dimensional vectors is taken along each dimension to obtain a new 300-dimensional vector. This new vector serves as the semantic field vector of the paragraph unit, geometrically representing the central semantic tendency of the legal concept cluster involved in the paragraph.
[0023] In another preferred embodiment of the invention, step S2 focuses on accurately locating legal terms and defining their analytical boundaries. This process begins by running a custom-designated legal domain named entity recognition model on each segmented paragraph unit. The model is developed based on a large corpus containing 200,000 annotated sentences from various legal documents. The annotation specification defines 15 categories of legal entities, including legal subjects such as "plaintiff" and "administrative agency," legal acts such as "tort" and "offer," and legal objects such as "patent right" and "real estate." The model architecture employs a bidirectional long short-term memory network combined with conditional random fields. Through the fusion of character-level and word-level features, it learns the word formation rules of legal terms, such as specific suffixes like "right," "law," and "liability," as well as contextual co-occurrence patterns, such as "violates...regulations" and "enjoys...rights." The model scans the input paragraph units word by word, identifying and annotating all legal term entities that conform to the predefined categories. For each identified entity, the model records its precise start and end character indices in the original text string.
[0024] Subsequently, using the aforementioned character index as anchor points, sentence-level context windows are truncated. This step requires determining the boundary of the smallest complete sentence containing the legal term entity. This is achieved by searching forward and backward from the starting character index position for the nearest sentence boundary marker. Sentence boundary markers include not only periods, question marks, and exclamation marks, but also semicolons and paragraph breaks commonly used in legal documents. Simultaneously, it is necessary to avoid misidentifying punctuation marks in abbreviations as sentence ends. A robust algorithm combines punctuation rules with a lightweight sentence boundary classifier, which determines whether the word following a suspected boundary point is typically uppercase or a specific introductory word, thus improving the accuracy of boundary detection. Once the sentence start and end character indices are determined, all characters between these two indices are truncated to form a complete text segment. This text segment is defined as a sentence-level context window centered on the legal term. It is worth noting that if the same legal term appears multiple times within the same paragraph unit, even if its context is completely identical or highly similar, this embodiment treats it as an independent instance, performing the above location and truncation operations for each occurrence separately, thereby preserving the independent context of each occurrence for subsequent analysis.
[0025] In another preferred embodiment of the invention, step S3 delves into the internal structure of the sentence, aiming to extract key modifying elements that affect the interpretation of legal terminology. This process uses the sentence-level context window obtained in step S2 as input. First, it undergoes in-depth grammatical dependency analysis. The analysis employs a deep syntax analyzer fine-tuned for legal text, capable of parsing common long sentences, nested structures, and passive voice in legal English, outputting the grammatical dependency relationships between each word in the sentence, forming a grammatical dependency tree rooted at the predicate verb or core noun. In this embodiment, the node corresponding to the target legal term in the dependency tree is designated as the root node of the current analysis.
[0026] Next, all dependency edges originating from the root node are traversed, and direct child nodes with relation types of adverbial, attributive, or negative modification are selected. For example, if the legal term is "compensation," the adverbial modifier directly connected to it might be "full amount," the attributive modifier might be "civil," and the negative modifier might be "no." The corresponding original vocabulary is extracted from these selected child nodes, and these words are collected and collectively referred to as grammatical markers expressing legal validity attributes. These markers are the first layer of key information for understanding the scope, degree, and nature of the term's validity.
[0027] Then, a deeper phrase extraction is performed. In the dependency tree, a depth-first search is conducted starting from the root node of the target term, along either the attributive modification chain or the adverbial modification chain. An attributive modification chain refers to a path of nodes connected by consecutive attributive modification relationships, and an adverbial modification chain refers to a path of nodes connected by consecutive adverbial modification relationships. The search continues until one of the following conditions is encountered: Reaching a leaf node; encountering a predicate verb node; encountering another major noun phrase node; or the length of the modification chain reaches a preset limit, such as 5 words.
[0028] All nodes visited during the search process constitute a subordinate node subtree. This subordinate node subtree then needs to be reconstructed into a coherent original text fragment. This requires reconstruction based on the original word order of the nodes in the subtree and any omitted function words. For example, a subtree might contain nodes "in," "reasonable," "time," and "within," and the reconstructed phrase would be "within a reasonable time." Finally, each reconstructed text fragment is recorded as a modifying phrase. Simultaneously, the specific grammatical modification relationship between this phrase and the legal term in the root node must be recorded, such as "adverbial of time condition," "adverbial of manner," or "adverbial of scope." These phrases and their relationship types collectively constitute a precise grammatical constraint network on the legal term in the sentence, forming the cornerstone for subsequent cross-language compatibility assessments.
[0029] In another preferred embodiment of the invention, step S4 relies on a specially designed cross-lingual emotional potential field model. This model is a composite neural network architecture whose core objective is to map a source language legal paragraph unit into a high-dimensional vector representation, called "potential state encoding," which encapsulates both the textual structural features and emotional semantic features of the paragraph. The model consists of three main components: a textual structural encoding channel, an emotional semantic encoding channel, and a unified semantic space.
[0030] The text structure encoding channel is responsible for processing the set of grammatical markers and modifier phrases from step S3. Internally, it is a grammatical relation graph network. This network first transforms each word in each input grammatical marker and modifier phrase into a 256-dimensional dense word vector through an embedding layer. For modifier phrases, the multiple word vectors they contain are serialized. Subsequently, a graph structure is constructed where nodes represent the input grammatical markers and the entire modifier phrase, with node features being their corresponding vector representations. Edges between nodes are constructed based on their grammatical relationships with the core legal terms and the possible logical connections between them, such as belonging to a parallel structure or having conditional dependencies. This grammatical relation graph is fed into a two-layer graph convolutional network for processing. The graph convolutional network updates the representation of each node by aggregating neighbor node information, and finally performs global average pooling on the updated representations of all nodes, outputting a 512-dimensional vector called the text structure feature vector. This vector captures the abstract structural information of the local grammatical constraint network surrounding the legal terms.
[0031] The sentiment semantic encoding channel is responsible for processing the paragraph sentiment tone vector and semantic field vector from step S1. This channel is a multilayer perceptron network containing three fully connected layers. The first layer receives a 304-dimensional vector as input, which is formed by concatenating the paragraph sentiment tone vector (e.g., 4-dimensional) and the semantic field vector (e.g., 300-dimensional), maps it to 1024 dimensions, and passes it through the ReLU activation function. The second layer maps the 1024-dimensional vector to 512 dimensions. The third layer maps it to 512 dimensions again and outputs the final sentiment semantic feature vector. Through this non-linear transformation, the network learns to fuse discrete sentiment dimensions and continuous semantic field concepts into a unified representation rich in sentiment semantic information.
[0032] The unified semantic space is the final output layer of the model. It concatenates the 512-dimensional text structure feature vector output from the text structure encoding channel with the 512-dimensional sentiment semantic feature vector output from the sentiment semantic encoding channel, resulting in a 1024-dimensional combined vector. This combined vector is then passed through a single linear transformation layer, i.e., a fully connected layer, to map it to a fixed dimension, such as 512-dimensional final vector. This 512-dimensional vector is the "potential state encoding" of the paragraph unit. The definition of potential state encoding is: a coordinate point in a high-dimensional joint space that simultaneously encodes the structural rigor, sentiment tendency, and deep semantic field distribution of legal text, such that paragraphs with similar legal style, sentiment tone, and thematic content are located close to each other in this space, regardless of their language.
[0033] To search for potential target paragraphs with continuous sentiment and semantic transitions in a target language corpus, a multilingual paragraph index needs to be pre-built. The construction process is offline. First, a large-scale target language legal text corpus is collected, for example, containing 1 million English legal paragraphs. Then, using the previously built cross-lingual sentiment potential field model, these target language paragraphs are processed one by one. The processing method is exactly the same as that for the source language paragraphs: steps S1 to S3 are performed on each target language paragraph to generate its set of grammatical markers, set of modifier phrases, paragraph sentiment tone vector, and semantic field vector, which are then input into the model to obtain its corresponding 512-dimensional potential state code. Finally, an index database is built, which stores the original text content, storage path, and the calculated 512-dimensional potential state code for each target language paragraph unit. This database is the multilingual paragraph index, which allows for efficient similarity retrieval of the potential state codes.
[0034] During the online search phase, for a given source language paragraph unit, its 512-dimensional potential state code is calculated using a cross-lingual sentiment potential field model. Next, the inner product similarity between this source language code and the codes of every target language paragraph in the multilingual paragraph index is calculated. The inner product similarity is calculated by multiplying corresponding elements of two 512-dimensional vectors and summing the results. The result is a scalar value; a larger value indicates a higher degree of alignment between the two vectors in direction, meaning that the paragraph units they represent are more similar in the joint feature space defined by the sentiment potential field model. After all inner product calculations are completed, all target language paragraph units are sorted in descending order based on their similarity scores. Finally, the top 50 paragraph units are selected to form a candidate set. This set is called the potential target paragraph set. These paragraphs are considered to have the highest continuity transition potential with the source language paragraphs in terms of text structure, sentiment tone, and core semantic field.
[0035] The construction of the aforementioned cross-linguistic sentiment potential field model is itself a supervised machine learning process. Model training requires specific multilingual training corpora and corresponding label data. The core of the training corpus consists of parallel legal text paragraphs that are translations of each other, such as 100,000 pairs of parallel Chinese-English paragraphs collected from UN conventions, bilateral treaties, or authoritative legal translations. These parallel paragraph pairs ensure strict semantic and functional equivalence between different languages. The label data includes a paragraph sentiment tone label and a core semantic field label for each paragraph unit. The paragraph sentiment tone label is assigned a 5-level intensity rating by human annotators based on the aforementioned four dimensions. The core semantic field label is generated as follows: first, key legal concepts of the paragraph are extracted automatically; then, experts assign one or more of the most relevant topic nodes to the paragraph from a predefined legal domain topic classification tree. The average value of the vectorized representations of these topic nodes serves as a supervisory signal for the core semantic field label.
[0036] The model training process follows a contrastive learning paradigm. First, the text structure encoding channel, sentiment semantic encoding channel, and unified semantic space are initialized using randomly initialized parameters. For a batch of training data containing several parallel paragraph pairs, a potential state encoding is generated for each paragraph unit, regardless of whether it is in the source or target language, based on its input features. A contrastive learning task is then constructed within the space formed by these encodings. Specifically, the two potential state encodings of each parallel paragraph pair are defined as a positive sample pair. Simultaneously, within a training batch, non-corresponding paragraph encodings are randomly combined to form negative sample pairs. For example, the encoding of Chinese paragraph A is randomly paired with the encoding of English paragraph C; as long as A and C are not in a translation relationship, they constitute a negative sample pair.
[0037] The objective function for training is a contrastive loss function, commonly known as the InfoNCE loss. The core idea of this loss function is to maximize the similarity between the two codes in a positive sample pair while minimizing the similarity between the two codes in a negative sample pair. Within a batch, for a given anchor sample, the loss is a function comparing its similarity to positive samples with its similarity to all negative samples. The gradient of the loss function with respect to the weights and biases of all model parameters, including the text structure encoding channel, the sentiment semantic encoding channel, and the linear transformation layer of the unified semantic space, is calculated using backpropagation. Then, an optimizer such as Adam is used to update these parameters based on the gradients. This process is repeated hundreds of thousands of times until the model's performance stabilizes on the retained validation set. The final output, with its optimized parameters, is a usable cross-lingual sentiment potential field model. This model learns to bring parallel legal provisions from different languages closer together in the potential state encoding space, while pushing non-parallel provisions further apart, thus enabling cross-lingual retrieval of similar style and content paragraphs.
[0038] In another preferred embodiment of the invention, step S5 is implemented as a multi-stage refinement and evaluation process aimed at determining the most suitable translation terms from multiple candidates. This process begins by traversing the set of potential target paragraphs generated in step S4. For each target language paragraph unit in the set, all legal terms contained within it must first be extracted. This operation is accomplished by invoking a legal domain named entity recognition model, which operates on the same principle as in step S2 but is trained specifically for the target language. This model scans the target paragraph text, identifies, and outputs all legal terminology entity strings that conform to predefined categories.
[0039] Subsequently, conceptual equivalence verification is initiated. Each extracted target language legal term is compared with an authoritative bilingual legal terminology database. This database is not a simple list of word pairs, but a structured knowledge base containing over 500,000 legal term pairs. Each record includes not only the source language term and the target language term, but also equivalence type annotations such as complete equivalence, partial equivalence, contextual equivalence, and a confidence benchmark value provided by legal experts. The comparison algorithm employs fuzzy matching based on word roots and morphology, taking into account the contextual definition of the term in its respective language. The comparison result generates a "conceptual equivalence confidence score" for the target term and the source language legal term to be translated. This score is a floating-point number between 0 and 1, combining the benchmark confidence value in the database, string similarity, and part-of-speech consistency. For example, "breach of contract" might achieve a high score of 0.95 compared to "default," while "infringement" might achieve a score of 0.90 compared to "infringement." A pre-set equivalence threshold is established, for example, 0.7. Only target terms whose conceptual equivalence confidence score is higher than this threshold are retained. All target terms that pass the threshold screening are aggregated to form a preliminary "candidate term set".
[0040] Next, a deeper evaluation of contextual potential matching is performed on each term in the candidate term set. First, the potential state encoding of the target language paragraph unit containing the term is obtained. This encoding has been pre-calculated and stored during the construction of the multilingual paragraph index and can be directly retrieved. Simultaneously, the potential state encoding of the source language paragraph unit is also available. The difference vector between these two 512-dimensional vectors is calculated. The difference vector intuitively reflects the relative positional offset of the two paragraph units in the joint feature space defined by the cross-lingual sentiment potential field model.
[0041] To quantify the degree of matching represented by this offset, a "potential matching degree calculation function" is defined. The input to this function is two key geometric properties of the difference vector: magnitude and direction cosine. The magnitude is calculated as the square root of the sum of the squares of each dimension of the difference vector, representing the absolute distance between the two segment units in the feature space. The direction cosine is calculated as the cosine of the angle between the difference vector and a reference zero vector. However, in this specific implementation, to capture directional information more precisely, the cosine similarity between the source language encoding vector and the target language encoding vector is calculated as a measure of directional consistency. The potential matching degree calculation function is designed as a transformation combination based on the sigmoid function. Its core logic is: the smaller the magnitude of the difference vector and the greater the cosine similarity, the higher the matching degree score should be. By normalizing and inverting the magnitude, weighting and fusing it with the cosine similarity, and then mapping it to the 0-1 interval using the sigmoid function, the "initial potential matching degree score" of the candidate term is obtained. For example, a difference vector with a small magnitude and a cosine similarity close to 1 will produce an initial score close to 0.95.
[0042] Next, a crucial grammatical compatibility calibration is performed. This step aims to evaluate whether the "modifying phrases" extracted from the source language context in step S3 can be naturally and legally integrated into the target language sentence environment where the candidate terms are located. The specific simulation and reorganization process is as follows: First, the type of grammatical modification relationship between the source language modifying phrase and the source legal term is determined, such as "adverbial of time condition". Then, in the target language sentence where the candidate term is located, its existing grammatical dependency structure is analyzed. An attempt is made to insert the translation of the modifying phrase or its semantic equivalent into the appropriate position in the target syntax tree connected to the candidate term node, according to the same grammatical relationship type. For example, if the source language phrase is "within a reasonable time" and the grammatical relationship is an adverbial of time condition, then an attempt is made to attach its English translation "within a reasonable time" as an adverbial to the target term node.
[0043] The "legitimacy" and "connectivity" of the recombined syntactic structure are evaluated. "Legitimacy" is assessed using a target language grammar checker trained on context-free grammars and a large-scale compliant corpus to determine whether the sentence after inserting new components violates basic grammatical rules. "Connectivity" is evaluated using a pre-trained language model such as BERT, calculating the change in semantic coherence score of the sentence segment before and after the insertion of the phrase. The binary value of the legitimacy judgment (0 or 1) is combined with a connectivity score (between 0 and 1) to generate a comprehensive "grammatical compatibility score." If the recombination results in a serious grammatical error, this score may be 0.
[0044] Finally, the scores are synthesized. Each candidate term now has two key scores: the initial potential energy matching score denoted as P. initial The grammar compatibility score is denoted as G. syntax The final calibrated score is obtained by multiplying the results using preset weighting coefficients. These weighting coefficients are preset based on experience; for example, the potential matching weight is set to 0.6, and the syntax compatibility weight is set to 0.4. The calculation formula is as follows: Final score This geometric weighting method emphasizes that any score that is too low will significantly lower the final score. All candidate terms are sorted in descending order of their final calibrated scores.
[0045] In another preferred embodiment of the present invention, the specific process of outputting the final target language legal terms and generating a report and description in step S6 is as follows: In the embodiment of step S6, the primary task is to output the final translation based on the calculation results of step S5. From the final calibrated score list of all candidate terms, the target language legal term with the highest score is selected as the output of this translation task. For example, if the candidate term "compensatory damages" scores 0.88, while "monetarycompensation" scores 0.82, then "compensatory damages" is selected as the output.
[0046] Next, a corresponding "Potential Energy Matching Report" and "Contextual Transition Description" are generated. Report generation begins with data extraction. From the cross-lingual sentiment potential energy field model, the potential energy state codes corresponding to the source language paragraph units and the target language paragraph units containing the finally selected terms are extracted. These codes need to be "decoded" to separate the interpretable components. For the paragraph sentiment tone vector, due to the reversible design of the model's encoding process, the intensity values of the four sentiment dimensions can be reconstructed from the potential energy state codes through a decoding network symmetrical to the sentiment semantic encoding channel. These values are standardized to the range of 0 to 100 for easy visualization.
[0047] For semantic field information, since the original semantic field vector is 300-dimensional while the potential energy state encoding is 512-dimensional, a separate projection decoder is required. This decoder is a small neural network, trained to recover the 300-dimensional semantic field vector as accurately as possible from the 512-dimensional encoding. The recovered semantic field vector is then dimensionality-reduced using principal component analysis (PCA), extracting the first two principal components as their "projected coordinates" on the most representative plane, for example, coordinates (1.2, -0.5).
[0048] The visualization attachment is generated based on the above data. The intensity values of the four emotional dimensions—certainty, urgency, formality, and seriousness—are plotted on a four-axis radar chart. The outlines of the source and target language paragraphs are superimposed in different colors to visually compare differences in emotional tone. Simultaneously, in a two-dimensional scatter plot, points for the two paragraph units are plotted using projected coordinates, and their origins are labeled. These two charts together constitute the visualization attachment to the potential energy matching report.
[0049] Finally, a "contextual transition description" is generated in text form. This description is a structured, template-filled natural language description. It automatically generates analytical text by comparing the potential state encoding of paragraph units in the source and target languages. For example: "Analysis shows that the target paragraph is highly consistent with the source paragraph in terms of the strength of the 'certainty' dimension, both scoring above 85 points, and slightly higher in terms of the strength of the 'formality' dimension, increasing by 5 points. In terms of semantic field projection, both are located at the boundary between the conceptual regions of 'contractual liability' and 'remedies for damages,' but the target paragraph leans more towards the 'remedies for damages' sub-region. In summary, after terminology replacement, the target paragraph can effectively connect with the preceding discussion on breach of contract and lay the logical foundation for the subsequent transition to compensation calculation, with a coherent emotional and semantic transition." This structured text, along with the aforementioned visualization attachment, is encapsulated as a deep annotation output of the translation results, completing the entire process from terminology selection to contextual interpretation.
[0050] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.
Claims
1. A method for matching and translating legal terms based on a semantic graph, characterized in that, Includes the following steps: S1. Input the full text of the legal document in the source language. Based on semantic integrity and format marks, the full text is divided into multiple paragraph units. For each paragraph unit, calculate its paragraph sentiment vector and extract the semantic field vector. S2. Within each paragraph unit, all legal terms are located using a legal domain named entity recognition model, and each term is used as the center to extract its adjacent complete sentences as a sentence-level context window. S3. Analyze the grammatical structure of the sentence-level context window, identify the grammatical markers that express legal validity attributes, and extract the modifier phrases that have a direct grammatical relationship with legal terms; S4. Input the paragraph sentiment tone vector, semantic field vector, grammatical marker words and modifying phrases into the cross-linguistic sentiment potential field model, and search for potential target paragraphs with continuous transitions between sentiment and semantics in the target language corpus. S5. Identify candidate terms that are conceptually equivalent to the source terms from the potential target paragraphs, calculate the potential energy matching degree between the source paragraphs and the target paragraphs, and calibrate them in combination with the grammatical compatibility of the modifier phrases. S6. Output the final target language legal terminology, and simultaneously generate a potential energy matching report containing sentiment-semantic coordinates and a contextual transition description of the impact on text coherence. 2.The method of claim 1, wherein, In step S1, the specific process of calculating the paragraph sentiment tone vector and extracting the semantic field vector is as follows: Each segmented paragraph unit is lexicalized, format control characters and punctuation marks are removed, and the lexical sequence is input into a sentiment analysis model trained on legal document corpus. The sentiment analysis model outputs the quantitative intensity value of the paragraph unit on multiple preset sentiment dimensions. The preset sentiment dimensions include certainty, urgency, formality and seriousness. The quantitative intensity values of each sentiment dimension are arranged in a preset order to form a paragraph sentiment tone vector. The frequency of all semantic words in paragraph units is counted, and a pre-constructed legal domain concept graph is queried. The legal domain concept graph contains legal concepts represented by nodes and the relationships between concepts represented by edges. Semantic words in paragraph units are mapped to corresponding nodes in the concept graph. All related concept nodes connected by a single edge with the corresponding node as the center are extracted to form a local concept network. All concept nodes in the local concept network are vectorized, and the geometric centroid of the resulting vector is calculated. The geometric centroid vector is used as the semantic field vector of the paragraph unit. 3.The method of claim 1, wherein, In S2, the specific process of locating legal terms and capturing the sentence-level context window is as follows: In each paragraph unit, a legal domain named entity recognition model is run. The model identifies legal term entities in the text based on the word formation rules and contextual patterns of legal terms, and records the start and end character positions of each identified legal term entity in the paragraph unit text. Based on the starting and ending character positions, the smallest complete sentence boundary containing legal term entities is located in the entire text of the paragraph unit. Within the scope of the located sentence boundary, a complete text segment from the starting character to the ending character of the sentence is extracted, forming a sentence-level context window centered on the legal term. If the same legal term appears multiple times in the paragraph unit, the positioning and extraction operations are performed independently for each occurrence.
4. The method of claim 1, wherein, In step S3, the specific process of identifying grammatical markers and extracting modifying phrases is as follows: Sentence-level context window is subjected to grammatical dependency analysis. A grammatical dependency tree is constructed with the target legal term as the root node. The grammatical dependency tree is traversed, and all child nodes that are directly connected to the root node through adverbial modification, attributive modification or negative modification are selected. The corresponding words are extracted from the selected child nodes, and the words are collected as grammatical markers that express the legal effect attributes. In the grammatical dependency tree, search all subordinate node subtrees that are reachable from the root node via attributive or adverbial modification chains. Restore each subordinate node subtree to its corresponding original text fragment. The original text fragments constitute modifier phrases that have a direct grammatical relationship with legal terms. Record the grammatical modification relationship type between each modifier phrase and the legal term in the root node.
5. The method of claim 1, wherein, In step S4, the specific process of searching for potential target paragraphs is as follows: The cross-linguistic emotional potential field model includes a text structure encoding channel, an emotional semantic encoding channel, and a unified semantic space. The set of grammatical marker words and the set of modifying phrases are input into the text structure encoding channel, which is processed by a grammatical relation graph network and outputs a text structure feature vector. The paragraph emotional tone vector and the semantic field vector are input into the emotional semantic encoding channel, which is processed by a multilayer perceptron network and outputs an emotional semantic feature vector. The text structure feature vector and the sentiment semantic feature vector are input into a unified semantic space. The unified semantic space maps the concatenated feature vector into a fixed-dimensional potential state code through a linear transformation layer. Obtain the multilingual paragraph index library corresponding to the target language corpus. The multilingual paragraph index library pre-stores the potential state code of each target language paragraph unit and its original text storage location. Calculate the inner product similarity between the potential state code of the source language paragraph unit and each potential state code in the multilingual paragraph index library. Sort all target language paragraph units in descending order according to the inner product similarity value. Select a preset number of paragraph units in the top row to form a potential target paragraph set.
6. The method of claim 5, wherein, The construction process of the cross-linguistic emotional potential field model is as follows: Input multilingual training corpus and corresponding label data. The multilingual training corpus contains pairs of parallel legal text paragraphs that are translations of each other. The label data contains paragraph sentiment tone labels and core semantic field labels for each paragraph unit. Based on the multilingual training corpus and label data, a corresponding potential state code is generated for each paragraph unit through the text structure encoding channel, the sentiment semantic encoding channel and the unified semantic space. A contrastive learning task is constructed in the potential energy state encoding space. The potential energy state encoding of parallel paragraph pairs is defined as a positive sample pair, and the potential energy state encoding of randomly combined non-parallel paragraph pairs is defined as a negative sample pair. The contrastive loss function is calculated based on the positive and negative sample pairs. The parameters of the text structure encoding channel, the sentiment semantic encoding channel, and the unified semantic space are adjusted through the backpropagation algorithm, and the cross-linguistic sentiment potential energy field model with adjusted parameters is output.
7. The method of claim 1, wherein the method further comprises: In step S5, the specific process of locking candidate terms and performing calibration is as follows: Traverse each target language paragraph unit in the potential target paragraph set, extract all legal terms contained in the paragraph unit, compare each extracted legal term with an authoritative bilingual legal terminology database, obtain the concept equivalence confidence score between the term and the source language legal term, retain legal terms with concept equivalence confidence scores higher than a preset equivalence threshold, and form a candidate term set. For each term in the candidate term set, the potential energy state code of the target language paragraph unit where the term is located is obtained, the difference vector between the potential energy state code of the source language paragraph unit and the potential energy state code of the target language paragraph unit is calculated, and the magnitude and direction cosine of the difference vector are input into the potential energy matching degree calculation function to obtain the initial potential energy matching degree score of the candidate term. The simulation reconstructs the process of recombining source language modifier phrases into the target language grammatical environment where the candidate term is located, based on the recorded grammatical relation types. A grammatical compatibility score is generated based on the evaluation results of the legality and coherence of the simulated reconstructed syntactic structure. The initial potential energy matching score and the grammatical compatibility score are multiplied together according to a preset weighting coefficient to obtain the final calibrated score of the candidate term.
8. The legal terminology matching and translation method based on semantic graphs according to claim 1, characterized in that, In step S6, the specific process of outputting the final target language legal terms and generating reports and explanations is as follows: From the final calibrated scores of all candidate terms, the target language legal term with the highest score is selected as the translation output. The potential energy state codes of the source language paragraph units and the selected target language paragraph units are extracted. The potential energy state codes are decoded to separate the intensity values of each dimension of the paragraph sentiment tone vector and the projection coordinates of the semantic field vector in the reduced-dimensional space. The intensity values of each dimension are plotted as radar charts, and the projection coordinates are marked on two-dimensional scatter plots. The radar charts and two-dimensional scatter plots constitute the visualization attachments of the potential energy matching degree report. By comparing the potential state encoding of paragraph units in the source language and the target language, a structured text describing the differences between the two in terms of emotional tone dimension and semantic field coverage is generated. The structured text and visualization attachments are output together as a contextual transition explanation.