Trade rule reasoning method and system based on bidirectional mapping and storage medium
By decomposing the text of trade rules and generating feature vectors, and combining the bidirectional mapping of rule dependency graphs and semantic frameworks, the problems of incomplete semantic mapping and reliability of compliance reasoning in international trade rules are solved, achieving efficient, accurate rule compliance determination and transparent interpretation.
Patent Information
- Application Number
- CN202511289014.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-12-23
AI Technical Summary
Existing technologies suffer from incomplete semantic mapping, ambiguous expressions, and implicit conditions when processing international trade rules. They also suffer from insufficient reliability in rule compliance reasoning, low computational efficiency, and a lack of transparent and credible interpretations.
By collecting and decomposing trade rule texts, analyzing rule clauses using preset key entity elements, generating trade rule feature vectors, constructing rule dependency graphs, and performing bidirectional mapping by combining semantic frameworks and logical structures, the optimal rule reasoning path is generated, achieving seamless collaboration between natural language rules and formal representations.
It has improved the accuracy of compliance determination of trade rules, ensured the traceability of formal rules, solved the problems of ambiguity in rule expression and implicit conditions, and achieved efficient rule compliance reasoning and transparent and credible interpretation.
Smart Images

Figure CN121189482A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of trade management, in particular to a trade rule reasoning method and system based on bidirectional mapping and a storage medium. BACKGROUND
[0002] With the expansion of international trade and the deepening of regional economic integration, there are significant differences in trade rules (such as standards, regulations, tariff policies, etc.) between different countries or regions, resulting in increased compliance costs and trade barriers. International trade rules usually involve tariffs, regulations, standards, agreements, etc. Different countries have different regulations, such as differences in product standards, environmental requirements, labor standards, etc. between the European Union and the United States. When conducting trade, enterprises need to correspond these different rules in order to comply with regulations and simplify processes.
[0003] Patent No. CN202411124444.6 discloses a cargo trade data simulation analysis method and visualization system based on data correlation optimization, which belongs to a data processing system or method specifically applicable to business, finance, management, supervision or prediction purposes. The above invention realizes accurate classification processing of cargo trade data by adopting a split or integrated module, calculates the advantage export industries of each country and quantitatively analyzes the export correlation density between products, then determines the reliable force guiding layout algorithm iteration starting parameters and clustering division groups through the topological relationship of product export correlation, thereby improving the iteration speed and visualization analysis effect of trade data complex network visualization, and providing more accurate and detailed data and visualization system support for user analysis and decision-making.
[0004] Patent No. CN202410337574.1 discloses a trade commodity classification problem answering method and system, an electronic device and a storage medium, relating to the field of classification. The above method obtains a trade commodity classification problem, extracts features from the trade commodity classification problem to obtain feature data, and analyzes the feature data to obtain problem intent data; converts the problem intent data into a search statement; inputs the search statement into a preset Elasticsearch search engine and outputs an answer statement. The above scheme realizes the full-process automation of answering trade commodity classification problems. The entire question and answer process does not require human intervention, responds to user requests in real time, and greatly improves the efficiency of commodity classification problem solving.
[0005] The existing technical solutions in the above have the following defects: 1. The existing technology has incomplete semantic mapping when processing rule text, making it difficult to solve expression ambiguity and implicit conditions.
[0006] 2. The prior art has problems of insufficient reliability of rule compliance reasoning, low calculation efficiency and lack of transparent and credible explanation in processing ambiguity, implicit conditions and compliance reasoning of rule text. SUMMARY
[0007] In view of the problems in the prior art, the above-mentioned inventive objectives are achieved by the following technical solutions. A trade rule reasoning method based on bidirectional mapping, comprising: Collecting and splitting trade rule text to obtain a plurality of rule clauses; According to the preset key entity element, the rule condition segment, the entity term and the special rule node are parsed to obtain a plurality of trade rule feature vectors by combining the rule feature weight value and comprehensively calculating; According to the rule attribute and the inter-rule dependency relationship, the trade rule feature vector is identified and converted, and a rule dependency graph is constructed by a rule formalization representation network; According to the preset semantic framework and logical structure, the trade rule text is converted into formal rule elements by a first conversion algorithm of a bidirectional mapping mechanism combined with the rule dependency graph; According to the rule query request input by the user, the optimal rule reasoning path is generated by a second conversion algorithm of the bidirectional mapping mechanism combined with the formal rule elements; The optimal rule reasoning paths are aggregated to form the trade rule corresponding to the rule query request.
[0008] By adopting the above technical solutions, the rule clauses are obtained by collecting and splitting the trade rule text, the rule condition segment, the entity term and the special rule node are extracted by parsing the clauses using the preset key entity elements (including standard entity terms, synonymous entity terms and superordinate entity terms), and the trade rule feature vectors are generated by combining the rule feature weight values; then the rule attributes and dependency relationships are identified by the rule formalization representation network, and the rule dependency graph is constructed; then the text is converted into formal rule elements based on the semantic framework and logical structure by the first conversion algorithm combined with the graph; finally, the optimal rule reasoning path is generated according to the rule query request by the second conversion algorithm, and is aggregated into the trade rule corresponding to the rule query request; by using the rule formalization representation network suitable for the international trade field, the problem that the traditional knowledge representation language cannot effectively express complex trade rules is solved; by the neural network-symbol system bidirectional mapping mechanism, the "semantic gap" between the neural network model and the symbolic logic system is broken through, and seamless collaboration of the two paradigms is realized.
[0009] The application further provides that the specific steps of collecting and splitting the trade rule text to obtain a plurality of rule clauses are as follows: Inquire and summarize trade rule documents on official platforms, record document sources, document versions and effective times, and obtain all trade rule texts; Classify the trade rule texts according to themes or chapters according to the document sources, and form a preliminary rule text set; Format mark cleaning is performed on the original rule texts in the preliminary rule text set, layout symbols are removed, and numbering formats are unified, and a standard rule text is obtained; Irrelevant information is removed from the standard rule text to obtain a pure rule text; the irrelevant information includes preambles, signatory lists and historical revision records; The latest rule text is obtained by identifying repeated clauses, calculating rule similarity, and merging clauses with a similarity greater than a preset similarity threshold; The latest rule text is split according to the clause structure features to obtain a plurality of rule clauses; the clause structure features include main clauses, subclauses and subitems.
[0010] By adopting the above technical scheme, trade rule texts are obtained by inquiring official platforms (data is collected by using a network crawler algorithm), format mark cleaning (redundant marks are removed by using a regular expression matching algorithm) and repeated clause removal (uniqueness is ensured by using a hash-based deduplication algorithm), and standard rule clauses are generated according to clause structure features (such as main clauses, subclauses and subitems, which are intelligently split by using a rule-based parsing algorithm), thereby improving the full automation degree and efficiency of trade rule collection and splitting, and reducing the data error rate.
[0011] The application further provides that: the rule clauses are parsed according to preset key entity elements to obtain rule condition segments, entity terms and special rule nodes, and a plurality of trade rule feature vectors are comprehensively calculated by combining rule feature weight values, and the specific steps include: Entity recognition is performed on all rule clauses to obtain a plurality of entity terms; All entity terms are classified according to term types in the preset key entity elements to obtain a standard term set, a synonymous term set and a hypernym term set; Logical connection words of all rule clauses are identified and segmented to obtain a plurality of rule condition segments; The rule condition segments are subjected to morphological analysis and syntactic analysis according to the standard term set, the synonymous term set and the hypernym term set to generate a condition expression; Numerical features of all rule clauses are extracted to obtain a plurality of limited data thresholds; The numerical features include data and units; the limited data thresholds include an amount threshold, a time limit, a proportion requirement and a quantity limit; Based on special keyword elements, the conditional expression is located by keyword positioning, and the rule condition fragments are marked to obtain special rule nodes; The special keyword elements include prohibited, not allowed, strictly prohibited, not permitted, except, exempt, not applicable, otherwise stipulated, and but; The spatiotemporal element expression is obtained by mapping and capturing the special rule node, the limited data threshold and the conditional expression according to the spatiotemporal attention mechanism. The spatiotemporal element expression is weighted according to the entity term matching degree and clause length to obtain several rule feature weight values; Based on the rule feature weight values, the rule condition fragments, the entity terms, and the special rule nodes are vectorized to obtain several trade rule feature vectors.
[0012] By adopting the above technical solution, entity terms are extracted from rule clauses through entity recognition algorithm (BERT-CRF model), and term classification is achieved by combining key entity elements (including standard / synonymous / superordinate terms); dependency parsing algorithm is used to segment logical connectives to generate rule condition fragments; limited data thresholds (amount, time, etc.) are extracted based on regular expression matching and numerical parsing algorithms; special rule nodes such as prohibition / exemption are marked through special keyword element positioning algorithm; a spatiotemporal attention mechanism is introduced to fuse spatiotemporal element expressions; finally, rule feature weight values are calculated based on TF-IDF weighted algorithm combined with entity matching degree and clause length, and trade rule feature vectors are generated using GloVe vectorization model; the accuracy of multi-dimensional parsing of rule clauses is improved, and the compatibility of heterogeneous entity terms is enhanced.
[0013] The present invention is further configured such that: the specific steps of identifying and transforming the trade rule feature vector based on rule attributes and inter-rule dependencies, and constructing a rule dependency graph through a rule formalization representation network, include: Based on the rule attributes, the attribute extraction layer of the rule formal representation network extracts and decomposes the feature vector of trade rules to obtain the rule number, rule source, rule priority and scope of application. Based on the dependencies between rules, the dependency analysis layer of the formal representation network of the rules is used to perform dependency analysis on the feature vectors of the trade rules to obtain explicit dependencies and implicit dependencies. The explicit dependency relationship references the source rule and the target rule based on the association type and / or extends the association rule to the exception number based on the exception condition; the association type includes supplement, overriding, and referencing; The implicit dependency relationship associates conditional input items with operators based on conditional judgment logic and / or associates execution actions with effect values based on execution objects; The graph construction layer of the formal representation network of the rules determines the trade rule feature vector as graph nodes, determines the explicit dependencies and the implicit dependencies as directed edges, and then integrates the graph nodes and the directed edges, and performs redundancy correction by combining the rule priority and the scope of application to obtain the rule dependency graph.
[0014] By adopting the above technical solution, a three-layer architecture of the rule formal representation network is used: an attribute extraction layer (using CNN+BiLSTM algorithm to extract rule number / source / priority / applicable scope), a dependency analysis layer (explicit dependencies are modeled based on GAT graph attention network to model reference / exception associations, and implicit dependencies are parsed through rule template matching algorithm to parse condition-action logic chain), and a graph construction layer (using GNN graph neural network to integrate nodes and edges, and combining PageRank algorithm to optimize priority weights). This transforms trade rule feature vectors into rule dependency graphs. Through a rule formal representation network suitable for the international trade field, the problem that traditional knowledge representation languages are difficult to effectively express complex trade rules is solved.
[0015] The present invention is further configured such that: based on a preset semantic framework and logical structure combined with the rule dependency graph, the specific steps of converting the trade rule text into formal rule elements through a first transformation algorithm with a bidirectional mapping mechanism include: Based on entity terms, the trade rule text is subjected to named entity recognition using a first conversion algorithm to obtain entity information; the entity information includes subject name, clause type, and constraint value. Based on the rule condition fragments, the first transformation algorithm is used to perform syntactic dependency analysis on the trade rule text to determine the dependency relationships between words; the dependency relationships include subject-predicate relationships and modification relationships; Based on the rule dependency graph, the trade rule text is logically structurally analyzed using the first transformation algorithm to obtain semantically related components; the semantically related components are the relationships between conditions, references, actions, and exceptions. Semantic frames are extracted from the key entities, the dependency relationships, and the semantic association components to obtain condition frames, action frames, exception frames, and reference links. The logical structure of the conditional frame and the action frame is identified and matched with a preset rule template. The condition frame, the action frame, the exception frame, and the reference link are filled into the corresponding rule template to form a structured rule representation; Perform a consistency check on the structured rule representation; If the test passes, the structured rule representation is determined to be a formal rule; otherwise, the structured rule representation is subject to rule priority correction and / or syntax error correction.
[0016] By adopting the above technical solution, the first transformation algorithm, namely the text-to-formal representation (T2F) algorithm, is combined with rule dependency graphs and semantic frames (entity recognition uses the BERT-BiLSTM-CRF model to extract subjects / clauses / values; syntactic analysis is based on Stanford Parser to construct dependency relationships; logical structure analysis is based on GNN to fuse rule dependency graphs to parse condition-action-exception association chains). Four types of semantic frames, namely conditions / actions / exceptions / references, are extracted. After rule template matching (preset SWRL / OWL template elements), structured rule representations are generated. Finally, through consistency checks and priority correction closed loops based on Z3 solvers, the automatic transformation of trade rule texts into formal rule elements is achieved. The association chain analysis guided by the rule dependency graph accurately captures cross-clause logical dependencies, improving the accuracy of trade rule structure reconstruction.
[0017] The present invention is further configured such that: the specific steps of generating the optimal rule inference path based on the user-input rule query request and the formal rule elements through the second transformation algorithm of the bidirectional mapping mechanism include: The second transformation algorithm is used to parse the rule query request, identify the query parameters, and determine the query intent; The query parameters include subject, product type, geographical region, and time range; the query intent includes compliance check, tax rate calculation, and exception clause query. The corresponding trade rule clauses are obtained by matching the query parameters in the formal rule elements; All the trade rule provisions mentioned above are sorted according to timeliness, specificity and conflict level to obtain the applicable rule provisions table; Create a blank graph structure and record the applicable nodes and applicable relationships of the trade rule clauses based on the blank graph structure; An applicability check is performed on the applicable rule clause table, the applicability of the trade rule clauses and the query parameters is calculated, and the results are compared with a preset applicability threshold. If the applicability is greater than or equal to the applicability threshold, the current trade rule clause is marked as applicable, and the exception clauses in the current trade rule clause are checked. At the same time, they are decomposed into applicable nodes and applicable relationships and filled into the blank graph structure to generate an initial reasoning path. Otherwise, mark the current trade rule terms as inapplicable and record the reason for inapplicability; Based on the query intent and the rule priority, redundant nodes are pruned and conflict relationships are corrected in the initial inference path to obtain the optimal rule inference path; the optimal rule inference path includes the compliance path, the tax rate calculation path, and the exception clause path.
[0018] By adopting the above technical solution and using the second transformation algorithm, namely the Formal Representation to Inference Path Transformation (F2R) algorithm (which uses the BERT intent classification model to identify parameters / intents for query parsing; builds a multi-level index based on ElasticSearch for rule matching; applies a three-dimensional weighted algorithm of timeliness, specificity, and conflict level for rule sorting; generates nodes with applicability labels through Dynamic Graph Neural Network (DGNN) for path construction; and combines the A* search algorithm to prune redundant nodes and corrects rule contradictions based on Conflict Resolution Tree (CDT), the algorithm achieves automatic generation from rule query to optimal inference path. This improves the accuracy of trade rule compliance determination and tax rate calculation, increases the conflict resolution rate of complex trade rules, and enhances the interpretability of the entire process.
[0019] The present invention is further configured such that: the bidirectional mapping mechanism uses a preset neural-symbolic conversion network to convert the trade rule text and the formal rule using the first conversion algorithm; at the same time, it uses the second conversion algorithm to convert the formal rule and the optimal rule reasoning path.
[0020] The specific steps for aggregating all the optimal rule reasoning paths to form the trade rule corresponding to the rule query request include: Based on the query intent, all the optimal rule reasoning paths are classified and merged to obtain a unified path set; Conflict detection and identification are performed on all reasoning paths in the unified path set to determine the contradictions between paths; Based on a pre-set conflict resolution mechanism, and considering timeliness, specificity, and regionality, the contradictions between the paths are weighted and ranked to determine the applicable rule paths; Based on the preset semantic framework, the applicable rule path is subjected to rule element extraction to obtain condition elements, action elements, exception elements and reference elements; By aggregating and transforming the condition elements, action elements, exception elements, and reference elements using a preset trade rule template, the trade rules corresponding to the rule query request are obtained.
[0021] Through the aforementioned technical solutions, the bidirectional mapping mechanism establishes a mapping relationship between the semantic structure and formal representation of rule texts via attention mechanisms and semantic analysis, resolving challenges such as ambiguity in rule expression and implicit conditions; it also bridges the "semantic gap" between neural network models and symbolic logic systems, achieving seamless collaboration between the two paradigms. This mechanism employs a specially designed intermediate semantic representation layer, using a bidirectional adapter to achieve precise mapping between natural language rules and formal representations.
[0022] Secondly, the present invention also provides a trade rule reasoning system based on bidirectional mapping, which adopts the following technical solution: A trade rule reasoning system based on bidirectional mapping includes: The data acquisition and processing module is used to acquire the text of trade rules and break it down into several rule clauses; The rule parsing module is used to parse the rule clauses and generate a trade rule feature vector by combining the rule feature weight values; The formal representation module is used to identify and transform the feature vectors of the trade rules through a rule formal representation network, and to construct a rule dependency graph. The bidirectional mapping module is used to convert the trade rule text into formal rule elements according to the rule dependency graph, and generate the optimal rule reasoning path by combining the formal rule elements with the rule query request input by the user. The rule building module is used to aggregate all the optimal rule reasoning paths through a bidirectional mapping mechanism to obtain the trade rules corresponding to the rule query request.
[0023] By adopting the above technical solution, five core modules work together: a data acquisition and processing module (for text splitting based on distributed crawlers and rule parsers), a rule parsing module (for generating feature vectors by fusing key entity elements and spatiotemporal attention mechanisms), a formal representation module (for constructing rule dependency graphs using GNN / GAT networks), a bidirectional mapping module (for converting text into rule elements and then into inference paths by combining SWRL templates and A* search algorithms), and a rule construction module (for aggregating optimal rule inference paths using a bidirectional mapping mechanism constructed by the first and second transformation algorithms to obtain the corresponding trade rules); this improves the accuracy of compliance determination of trade rules and ensures the traceability of formal rules.
[0024] Thirdly, the present invention also provides an electronic device, which adopts the following technical solution: An electronic device, comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method described above.
[0025] By adopting the above technical solution, the trade rule reasoning method based on bidirectional mapping is presented in the form of computer-readable code and stored in the memory. When the processor runs the computer-readable code in the memory, the steps of the trade rule reasoning method based on bidirectional mapping are executed, thereby reducing the intensity of manual labor and improving the degree of automation.
[0026] Fourthly, the present invention also provides a computer storage medium, which adopts the following technical solution: A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0027] In summary, the beneficial technical effects of the present invention are as follows: 1. By using a rule formalization representation network suitable for the international trade field, the problem that traditional knowledge representation languages are unable to effectively express complex trade rules is solved; through a two-way mapping mechanism between neural networks and symbolic systems, the "semantic gap" between neural network models and symbolic logic systems is broken, and seamless collaboration between the two paradigms is achieved.
[0028] 2. By formalizing the rules, networks can accurately capture the complex characteristics of trade rules, such as their conditionality, exceptions, and relevance.
[0029] 3. Achieve bidirectional conversion between natural language rule text and formal representation through the neural-symbolic interface layer.
[0030] 4. By combining a bidirectional mapping mechanism with attention mechanisms and semantic analysis, a mapping relationship between the semantic structure and formal representation of rule texts was established, solving problems such as ambiguity in rule expression and implicit conditions. Attached Figure Description
[0031] Figure 1 This is a flowchart illustrating a trade rule reasoning method according to one embodiment of the present invention.
[0032] Figure 2 This is a flowchart illustrating a trade rule reasoning method according to one embodiment of the present invention.
[0033] Figure 3 This is a schematic diagram of a rule-based reasoning architecture for neural symbol fusion according to one embodiment of the present invention.
[0034] Figure 4 This is a schematic diagram of the trade rule reasoning system structure according to one embodiment of the present invention. Detailed Implementation
[0035] The present invention will be further described in detail below with reference to the accompanying drawings.
[0036] Reference Figure 1 This invention discloses a trade rule reasoning method based on bidirectional mapping, comprising: S1: Collect and break down the text of trade rules to obtain several rule clauses; S2: Based on the preset key entity elements, the rule clauses are parsed to obtain rule condition fragments, entity terms and special rule nodes. Combined with the rule feature weight values, several trade rule feature vectors are calculated in a comprehensive manner. S3: Identify and transform the feature vector of the trade rule based on the rule attributes and dependencies between rules, and construct a rule dependency graph through the formal representation network of rules; S4: Based on the preset semantic framework and logical structure combined with the rule dependency graph, the trade rule text is converted into formal rule elements through the first transformation algorithm of the bidirectional mapping mechanism; S5: Based on the user's input rule query request and the formal rule elements, the optimal rule reasoning path is generated through the second transformation algorithm of the bidirectional mapping mechanism; S6: Aggregate all the optimal rule reasoning paths to form the trade rule corresponding to the rule query request.
[0037] The implementation principle of this embodiment is as follows: First, the text of trade rules is collected and decomposed into several rule clauses using text splitting technology; then, based on preset key entity elements (such as trading entities, commodity categories, tariff terms, etc.), these rule clauses are parsed to extract rule condition fragments, entity terms, and special rule nodes (such as exception clauses or priority rules), and trade rule feature vectors are generated by combining rule feature weight values (calculated through a weighted algorithm, such as based on TF-IDF or a custom weight matrix); then, based on rule attributes (such as rule type, effective time) and inter-rule dependencies (identified through dependency analysis algorithms, such as adjacency matrices based on graph theory or Bayesian networks), these feature vectors are converted into rule dependency graphs using a rule formal representation network (a neural network-based transformation model, such as GNN or Transformer architecture); finally, combined with the language... The system employs semantic frameworks (such as ontology or knowledge graphs) and logical structures (such as predicate logic or rule engines). A first transformation algorithm (e.g., formal language transformation algorithms like Prolog or OWL inference) transforms trade rule text into formal rule elements (such as logical expressions or RDF triples). Subsequently, for user-input rule query requests (such as rule matching for specific trade scenarios), a second transformation algorithm (e.g., optimization algorithms based on heuristic search or dynamic programming, such as A* or Dijkstra's algorithm) is applied to combine the formal rule elements and generate optimal rule inference paths (i.e., rule sequences that minimize conflict or maximize efficiency). Finally, a bidirectional mapping mechanism (a bidirectional indexing and aggregation algorithm, such as MapReduce or graph aggregation technology) aggregates all generated optimal rule inference paths to generate a complete trade rule corresponding to the rule query request. This entire process ensures the accuracy, efficiency, and scalability of rule processing. Core algorithms include feature extraction, graph construction, formal transformation, and path optimization to achieve intelligent reasoning and application of trade rules.
[0038] Example 2: The specific steps of step S1 include: The official platform was used to search and summarize trade rule documents, and the document source, version and effective date were recorded to obtain the complete text of the trade rules. Based on the source of the documents, the trade rule texts are categorized by topic or chapter to form a preliminary set of rule texts; The original rule text in the preliminary rule text set is cleaned by formatting marks, removing typesetting symbols and unifying the numbering format to obtain standard rule text; The standard rule text is modified by removing irrelevant information to obtain a clean rule text; the irrelevant information includes the preamble, the list of signatories, and the historical revision record. The clean rule text is subjected to duplicate clause identification, the rule similarity is calculated, and clauses with similarity greater than a preset threshold are merged to obtain the latest rule text; Based on the clause structure characteristics, the latest rule text is split according to the clause boundaries to obtain several rule clauses; the clause structure characteristics include main clauses, sub-clauses, and sub-items.
[0039] The implementation principle of this embodiment is as follows: First, data crawling algorithms (such as HTTP request-based crawlers or API integration) are used on the official platform to query and summarize trade rule documents to obtain all text; second, text cleaning algorithms (such as regular expression matching to remove HTML tags and special characters) and deduplication algorithms (such as hash value comparison or Levenshtein distance calculation) are applied to remove duplicate clauses and generate standard rule text; finally, based on the clause structure features (main clause, sub-clause, sub-items), NLP segmentation algorithms (such as rule-based pattern recognition or sequence labeling models) are used to split the text into several rule clauses to ensure structured and efficient processing.
[0040] Example 3: The specific steps of step S2 include: Entity identification is performed on all rule clauses to obtain several entity terms; All entity terms are classified according to the term types in the preset key entity elements to obtain a standard term set, a synonym term set, and a superordinate term set; In this embodiment, standard terminology refers to normative vocabulary developed through standardization procedures and approved by recognized organizations for unified expression within a specific field; Synonyms refer to terms that are completely equivalent in meaning to a standard term in a specific context, but have different forms of expression; Superordinate terms refer to abstract concepts that have a broader scope and can include subordinate terms in a conceptual hierarchy.
[0041] The logical connectors of all the rule clauses are identified and segmented to obtain several rule condition fragments; In this embodiment, the logical connectors include if...then..., as long as...then..., if...then..., all...are..., only...then..., unless...otherwise..., no...no..., and, and, and, as well as, at the same time, or, or, or, but, however, however, despite..., not only...but also..., even, more...etc.; Lexical and syntactic analysis are performed on the rule condition fragments based on the standard terminology set, the synonym terminology set, and the superordinate terminology set to generate conditional expressions; Numerical features of all the aforementioned rule clauses are extracted to obtain several limiting data thresholds; The numerical characteristics include data and units; the defined data thresholds include monetary thresholds, time limits, proportion requirements, and quantity restrictions. Based on special keyword elements, the conditional expression is located by keyword positioning, and the rule condition fragments are marked to obtain special rule nodes; The special keyword elements include prohibited, not allowed, strictly prohibited, not permitted, except, exempt, not applicable, otherwise stipulated, and but; The spatiotemporal element expression is obtained by mapping and capturing the special rule node, the limited data threshold and the conditional expression according to the spatiotemporal attention mechanism. The spatiotemporal element expression is weighted according to the entity term matching degree and clause length to obtain several rule feature weight values; Based on the rule feature weight values, the rule condition fragments, the entity terms, and the special rule nodes are vectorized to obtain several trade rule feature vectors.
[0042] The implementation principle of this embodiment is as follows: First, natural language processing (NLP) algorithms (such as entity recognition models based on BERT or CRF) are used to identify entities in all rule clauses and extract entity terms. Next, based on the terminology type (such as standard, synonym, or superordinate) in the preset key entity elements, classification algorithms (such as K-means clustering or rule-based classifiers) are applied to classify the entity terms into standard terminology sets, synonym terminology sets, and superordinate terminology sets. Then, logical connector recognition algorithms (such as dependency parsing or regular expression matching) are used to segment the rule clauses to obtain rule condition fragments. Based on these term sets, lexical analysis and syntax analysis algorithms (such as Stanford Parser or a custom parser) are used to generate conditional expressions. Simultaneously, numerical features (including data and units, such as monetary thresholds, time limits, proportion requirements, and quantity limits) are extracted. The process involves several steps. First, a threshold data set is obtained using regular expressions or NLP feature extraction tools. Then, special rule nodes are located and labeled based on specific keyword elements (such as prohibited, forbidden, strictly prohibited, unacceptable, excluded, exempt, not applicable, otherwise stipulated, and but), using string matching or keyword localization algorithms. Next, a spatiotemporal attention mechanism (such as a Transformer-based attention model) is applied to map and capture the special rule nodes, threshold data set, and conditional expressions, generating a spatiotemporal element expression. Weight values are calculated based on entity term matching degree (such as cosine similarity calculation) and clause length (such as a length-weighted formula) to obtain rule feature weight values. Finally, a vectorization algorithm (such as word embedding or feature encoding) is used in conjunction with the weight values to convert rule condition fragments, entity terms, and special rule nodes into trade rule feature vectors, ensuring the accuracy and computability of the rule representation.
[0043] Example 4: The specific steps of step S3 include: Based on the rule attributes, the attribute extraction layer of the rule formal representation network extracts and decomposes the feature vector of trade rules to obtain the rule number, rule source, rule priority and scope of application. Based on the dependencies between rules, the dependency analysis layer of the formal representation network of the rules is used to perform dependency analysis on the feature vectors of the trade rules to obtain explicit dependencies and implicit dependencies. The explicit dependency relationship references the source rule and the target rule based on the association type and / or extends the association rule to the exception number based on the exception condition; the association type includes supplement, overriding, and referencing; The implicit dependency relationship associates conditional input items with operators based on conditional judgment logic and / or associates execution actions with effect values based on execution objects; The graph construction layer of the formal representation network of the rules determines the trade rule feature vector as graph nodes, determines the explicit dependencies and the implicit dependencies as directed edges, and then integrates the graph nodes and the directed edges, and performs redundancy correction by combining the rule priority and the scope of application to obtain the rule dependency graph.
[0044] The implementation principle of this embodiment is as follows: the attribute extraction layer uses the BiLSTM+CRF algorithm to decompose structured attributes such as rule number, source, priority and scope of application from the trade rule feature vector; The dependency analysis layer includes explicit dependencies and implicit dependencies; explicit dependencies are modeled based on GAT graph attention networks to model reference / exception relationships between rules (three types of edges: supplementary / covering / reference); implicit dependencies are parsed through rule template matching algorithms to resolve condition-action logic chains (such as condition input items to operators and then to effect values). The graph construction layer uses a GNN graph neural network to integrate nodes (regular feature vectors) and edges (explicit / implicit dependencies), and combines the PageRank algorithm to prune redundant edges according to priority weights, outputting a high-confidence regular dependency graph.
[0045] Example 5: Reference Figure 2 The specific steps of step S4 include: S41: Based on entity terms, name entity recognition is performed on the trade rule text using the first conversion algorithm to obtain entity information; In this embodiment, the first conversion algorithm is a text-to-formal representation (T2F) algorithm; the entity information includes the subject name, clause type, and constraint value; S42: Based on the rule condition fragments, perform syntactic dependency analysis on the trade rule text using the first transformation algorithm to determine the dependency relationships between words; the dependency relationships include subject-predicate relationships and modification relationships; S43: Based on the rule dependency graph, the trade rule text is logically structured using the first transformation algorithm to obtain semantic association components; the semantic association components are the associations between conditions, references, actions, and exceptions. S44: Extract semantic frames from the key entities, the dependency relationships, and the semantic association components to obtain condition frames, action frames, exception frames, and reference links; S45: Perform logical structure identification on the condition frame and the action frame, and match them with a preset rule template; S46: Fill the condition frame, the action frame, the exception frame, and the reference link into the corresponding rule template to form a structured rule representation; S47: Perform a consistency check on the structured rule representation; If the test passes, the structured rule representation is determined to be a formal rule; otherwise, the structured rule representation is subject to rule priority correction and / or syntax error correction.
[0046] The implementation principle of this embodiment is as follows: By converting text to formal representation (T2F algorithm), combined with named entity recognition (BERT-BiLSTM-CRF model to extract entity information), syntactic dependency analysis (such as Stanford Parser to parse subject-verb / modifier relations), and rule dependency graph-driven logical structure analysis (GNN to capture condition-action-exception association chains), condition / action / exception / reference frameworks are extracted and matched with preset rule templates (such as SWRL / OWL template library) to generate structured rules; finally, consistency is checked by Z3 solver, and rule priority or syntax correction is performed on failed cases to achieve automated and accurate conversion of trade rule text to formal rule base.
[0047] Example 6: The specific steps of step S5 include: The second transformation algorithm is used to parse the rule query request, identify the query parameters, and determine the query intent; In this embodiment, the second conversion algorithm is a formal representation to inference path conversion (F2R) algorithm; the query parameters include subject, product type, geographical region, and time range; the query intent includes compliance check, tax rate calculation, and exception clause query; The corresponding trade rule clauses are obtained by matching the query parameters in the formal rule elements; All the trade rule provisions mentioned above are sorted according to timeliness, specificity and conflict level to obtain the applicable rule provisions table; Create a blank graph structure and record the applicable nodes and applicable relationships of the trade rule clauses based on the blank graph structure; An applicability check is performed on the applicable rule clause table, the applicability of the trade rule clauses and the query parameters is calculated, and the results are compared with a preset applicability threshold. If the applicability is greater than or equal to the applicability threshold, the current trade rule clause is marked as applicable, and the exception clauses in the current trade rule clause are checked. At the same time, they are decomposed into applicable nodes and applicable relationships and filled into the blank graph structure to generate an initial reasoning path. Otherwise, mark the current trade rule terms as inapplicable and record the reason for inapplicability; Based on the query intent and the rule priority, redundant nodes are pruned and conflict relationships are corrected in the initial inference path to obtain the optimal rule inference path; the optimal rule inference path includes the compliance path, the tax rate calculation path, and the exception clause path.
[0048] The implementation principle of this embodiment is as follows: User input is parsed using a formal representation to inference path transformation (F2R) algorithm combined with the BERT intent classification model to identify query parameters (such as subject, product type, geographical region) and intent (compliance check, tax rate calculation, etc.). Relevant rule clauses are matched from the formal rule base based on Elasticsearch vector retrieval, and an applicable rule table is generated through a triple-weighted sorting based on timeliness, specificity, and conflict level. Next, a dynamic graph structure is constructed to record rule nodes and their relationships (such as references / exceptions). An applicability threshold is calculated using a rule engine (such as SWRL), and exception clauses are integrated into compliant rules to generate an initial inference path. Finally, the A* search algorithm is applied to prune redundant nodes, and conflict resolution trees (CDT) are used to correct rule contradictions, outputting the optimal path that matches the query intent. This process integrates NLP, graph computation, and formal logic techniques to achieve high-precision rule inference and decision support.
[0049] Example 7: Reference Figure 3 The bidirectional mapping mechanism uses a preset neural-symbolic conversion network to convert the trade rule text and the formal rules using the first conversion algorithm; at the same time, it uses the second conversion algorithm to convert the formal rules and the optimal rule reasoning path.
[0050] The implementation principle of this embodiment is as follows: the BERT-Transformer fusion attention mechanism is used to parse trade text, and the semantic framework (condition / action / exception) is extracted through dependency parsing; the semantic framework is mapped to SWRL / OWL formal rules based on the rule dependency graph-guided symbolic logic transformer (SLT), and the logical consistency is verified by the Z3 solver; The formal rule elements are dynamically encoded using a graph attention network (GAT) and candidate rule subgraphs are generated by combining query intent (BERT classification). The symbolic rules (Prolog engine) and neural network (DGNN) are fused through a neural symbolic reasoning engine (NSRE) to construct a reasoning path with applicability weights. Attention gating dynamically aligns text semantics with symbolic rule features to resolve ambiguous expressions (such as "reasonable deadline"); the conflict resolution mechanism reverses the T2F output based on rule priority to ensure that the F2R path is consistent.
[0051] The specific steps of step S6 include: Based on the query intent, all the optimal rule reasoning paths are classified and merged to obtain a unified path set; Conflict detection and identification are performed on all reasoning paths in the unified path set to determine the contradictions between paths; Based on a pre-set conflict resolution mechanism, and considering timeliness, specificity, and regionality, the contradictions between the paths are weighted and ranked to determine the applicable rule paths; Based on the preset semantic framework, the applicable rule path is subjected to rule element extraction to obtain condition elements, action elements, exception elements and reference elements; By aggregating and transforming the condition elements, action elements, exception elements, and reference elements using a preset trade rule template, the trade rules corresponding to the rule query request are obtained.
[0052] Example 8: Reference Figure 4 A trade rule reasoning system based on bidirectional mapping, comprising: The data acquisition and processing module is used to acquire the text of trade rules and break it down into several rule clauses; The rule parsing module is used to parse the rule clauses and generate a trade rule feature vector by combining the rule feature weight values; The formal representation module is used to identify and transform the feature vectors of the trade rules through a rule formal representation network, and to construct a rule dependency graph. The bidirectional mapping module is used to convert the trade rule text into formal rule elements according to the rule dependency graph, and generate the optimal rule reasoning path by combining the formal rule elements with the rule query request input by the user. The rule building module is used to aggregate all the optimal rule reasoning paths through a bidirectional mapping mechanism to obtain the trade rules corresponding to the rule query request.
[0053] The implementation principle of this embodiment is as follows: the rule text is obtained from the official platform based on the Scrapy crawler framework, and after being cleaned by regular expressions and deduplicated by SimHash, the rule clauses are split according to the main / sub-clause structure using the BiLSTM-CRF model.
[0054] BERT-BiLSTM-CRF entity recognition is used to extract key entities (subject / product / geography), and a rule template matching algorithm is used to generate condition fragments. A spatiotemporal attention mechanism (Transformer-based) is used to fuse numerical thresholds (such as amount / term) and special nodes (prohibition / exemption) to output TF-IDF weighted rule feature vectors. A three-layer formal rule network is constructed: an attribute layer (BiLSTM extracts rule number / priority), a dependency layer (GAT model explicit reference / exception association, rule chain parsing algorithm captures implicit condition-action logic), and a graph layer (GNN integrates nodes and edges, PageRank prunes redundancy according to priority) to generate a high-confidence rule dependency graph.
[0055] The T2F algorithm guides StanfordParser to perform dependency analysis based on the rule dependency graph, extracting the condition / action / exception framework. Formal rule elements are generated by filling the SWRL template, and consistency checks and conflict corrections are performed by the Z3 solver. The query parameters are parsed using the F2R algorithm with BERT intent classification, ElasticSearch matches the rule base terms, and a three-dimensional sort (timeliness > specificity > conflict level) is generated to produce an applicable rule table. DGNN constructs an inference path with applicable labels, and A* search and conflict resolution tree (CDT) are jointly optimized to output the optimal path.
[0056] Apply graph aggregation algorithms (such as GraphSAGE) to integrate multi-path reasoning results and combine them with a bidirectional indexing mechanism to generate the final trade rules.
[0057] Example 9: An electronic device, comprising: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method described above.
[0058] Example 10: A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0059] The embodiments described herein are preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape, and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A trade rule reasoning method based on bidirectional mapping, characterized in that, include: Collect and break down the text of trade rules to obtain several rule clauses; The rule clauses are parsed based on the preset key entity elements to obtain rule condition fragments, entity terms and special rule nodes. Combined with the rule feature weight values, several trade rule feature vectors are calculated. Based on the rule attributes and inter-rule dependencies, the trade rule feature vectors are identified and transformed, and a rule dependency graph is constructed through a formal rule representation network. Based on the preset semantic framework and logical structure combined with the rule dependency graph, the trade rule text is converted into formal rule elements through the first transformation algorithm of the bidirectional mapping mechanism; Based on the user's input rule query request and the formal rule elements, the optimal rule reasoning path is generated through the second transformation algorithm of the bidirectional mapping mechanism; All the optimal rule reasoning paths are aggregated to form the trade rules corresponding to the rule query request.
2. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps for collecting and splitting the trade rule text to obtain several rule clauses are as follows: The trade rule documents are queried and summarized, and the source, version and effective date of the documents are recorded to obtain the complete text of the trade rules; Based on the source of the documents, the trade rule texts are categorized by topic or chapter to form a preliminary set of rule texts; The original rule text in the preliminary rule text set is cleaned by formatting marks, removing typesetting symbols and unifying the numbering format to obtain standard rule text; Irrelevant information is removed from the standard rule text to obtain clean rule text; The clean rule text is subjected to duplicate clause identification, the rule similarity is calculated, and clauses with similarity greater than a preset threshold are merged to obtain the latest rule text; Based on the structural characteristics of the clauses, the latest rule text is split according to the clause boundaries to obtain several rule clauses.
3. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps of parsing the rule clauses based on preset key entity elements to obtain rule condition fragments, entity terms, and special rule nodes, and then comprehensively calculating several trade rule feature vectors by combining rule feature weight values, include: Entity identification is performed on all rule clauses to obtain several entity terms; All entity terms are classified according to the term types in the preset key entity elements to obtain a standard term set, a synonym term set, and a superordinate term set; The logical connectors of all the rule clauses are identified and segmented to obtain several rule condition fragments; Lexical and syntactic analysis are performed on the rule condition fragments based on the standard terminology set, the synonym terminology set, and the superordinate terminology set to generate conditional expressions; Numerical features of all the aforementioned rule clauses are extracted to obtain several limiting data thresholds; Based on special keyword elements, the conditional expression is located by keyword positioning, and the rule condition fragments are marked to obtain special rule nodes; The spatiotemporal element expression is obtained by mapping and capturing the special rule node, the limited data threshold and the conditional expression according to the spatiotemporal attention mechanism. The spatiotemporal element expression is weighted according to the entity term matching degree and clause length to obtain several rule feature weight values; Based on the rule feature weight values, the rule condition fragments, the entity terms, and the special rule nodes are vectorized to obtain several trade rule feature vectors.
4. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps for identifying and transforming the trade rule feature vector based on rule attributes and inter-rule dependencies, and constructing a rule dependency graph through a formal rule representation network, include: Based on the rule attributes, the attribute extraction layer of the rule formal representation network is used to extract and decompose the feature vector of trade rules to obtain the rule priority and scope of application. Based on the dependencies between rules, the dependency analysis layer of the formal representation network of the rules is used to perform dependency analysis on the feature vectors of the trade rules to obtain explicit dependencies and implicit dependencies. The explicit dependency relationship references and associates the source rule with the target rule based on the association type and / or extends the association rule with the exception number based on the exception condition; The implicit dependency relationship associates conditional input items with operators based on conditional judgment logic and / or associates execution actions with effect values based on execution objects; The graph construction layer of the formal representation network of the rules determines the trade rule feature vector as graph nodes, determines the explicit dependencies and the implicit dependencies as directed edges, and then integrates the graph nodes and the directed edges, and performs redundancy correction by combining the rule priority and the scope of application to obtain the rule dependency graph.
5. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps of converting the trade rule text into formal rule elements using a first transformation algorithm with a bidirectional mapping mechanism, based on a preset semantic framework and logical structure combined with the rule dependency graph, include: Based on entity terms, the trade rule text is subjected to named entity recognition using the first conversion algorithm to obtain entity information; Based on the rule condition fragments, the first transformation algorithm is used to perform syntactic dependency analysis on the trade rule text to determine the dependency relationships between words; Based on the rule dependency graph, the trade rule text is logically structured using the first transformation algorithm to obtain semantically related components. Semantic frames are extracted from the key entities, the dependency relationships, and the semantic association components to obtain condition frames, action frames, exception frames, and reference links. The logical structure of the conditional frame and the action frame is identified and matched with a preset rule template. The condition frame, the action frame, the exception frame, and the reference link are filled into the corresponding rule template to form a structured rule representation; The structured rule representation is subjected to a consistency check, and the structured rule representation that passes the check is determined to be a formal rule.
6. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps of generating the optimal rule inference path using the second transformation algorithm with a bidirectional mapping mechanism, based on the user-input rule query request and the formal rule elements, include: The second transformation algorithm is used to parse the rule query request, identify the query parameters, and determine the query intent; The corresponding trade rule clauses are obtained by matching the query parameters in the formal rule elements; All the trade rule provisions mentioned above are sorted according to timeliness, specificity and conflict level to obtain the applicable rule provisions table; Create a blank graph structure and record the applicable nodes and applicable relationships of the trade rule clauses based on the blank graph structure; An applicability check is performed on the applicable rule clause table, the applicability of the trade rule clauses and the query parameters is calculated, and the results are compared with a preset applicability threshold. If the applicability is greater than or equal to the applicability threshold, the current trade rule clause is marked as applicable, and the exception clauses in the current trade rule clause are checked. At the same time, they are decomposed into applicable nodes and applicable relationships and filled into the blank graph structure to generate an initial reasoning path. Based on the query intent and the rule priority, redundant nodes are pruned and conflict relationships are corrected in the initial inference path to obtain the optimal rule inference path.
7. The trade rule reasoning method based on bidirectional mapping according to claim 1, characterized in that, The specific steps for aggregating all the optimal rule reasoning paths to form the trade rule corresponding to the rule query request include: Based on the query intent, all the optimal rule reasoning paths are classified and merged to obtain a unified path set; Conflict detection and identification are performed on all reasoning paths in the unified path set to determine the contradictions between paths; Based on a pre-set conflict resolution mechanism, and considering timeliness, specificity, and regionality, the contradictions between the paths are weighted and ranked to determine the applicable rule paths; Based on the preset semantic framework, the applicable rule path is subjected to rule element extraction to obtain condition elements, action elements, exception elements and reference elements; By aggregating and transforming the condition elements, action elements, exception elements, and reference elements using a preset trade rule template, the trade rules corresponding to the rule query request are obtained.
8. A trade rule reasoning system based on bidirectional mapping, characterized in that, include: The data acquisition and processing module is used to acquire the text of trade rules and break it down into several rule clauses; The rule parsing module is used to parse the rule clauses and generate a trade rule feature vector by combining the rule feature weight values; The formal representation module is used to identify and transform the feature vectors of the trade rules through a rule formal representation network, and to construct a rule dependency graph. The bidirectional mapping module is used to convert the trade rule text into formal rule elements according to the rule dependency graph, and generate the optimal rule reasoning path by combining the formal rule elements with the rule query request input by the user. The rule building module is used to aggregate all the optimal rule reasoning paths through a bidirectional mapping mechanism to obtain the trade rules corresponding to the rule query request.
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Trade commodity classification question answering method and system, electronic equipment and storage medium
CN118035422A
A simulation analysis method and visualization system for goods trade data based on data correlation optimization
CN118644346B