Method, program product and apparatus for semantic enhancement of query statements in workflow nodes

CN122925595APending Publication Date: 2026-10-16CHINA FINANCIAL SUPPORTING SERVICES CFSS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611101334.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

传统RAG(Retrieval-AugmentedGeneration,检索增强生成)系统难以自动识别这种隐含意图,原因在于知识库的标准流程中术语的专业性较强,而用户输入的自然语言往往无法通过常规方式与相应的专业术语进行匹配

Benefits of technology

[0016] The semantic enhancement methods, apparatuses, computer devices, computer-readable storage media, and computer program products for query statements in the aforementioned workflow nodes first receive the original query text input by the user through the workflow input node. Then, according to at least one matching rule, multiple candidate tags corresponding to the original query text are matched from a pre-built tag rule base. Based on the type of the matching rule, the base score of the business scenario to which the workflow input node belongs, and the similarity coefficient between the original query text and the candidate tag, the confidence score of each candidate tag is calculated. The top preset number of candidate tags with the highest confidence scores are determined as structured tags, so that the structured tags ultimately used for semantic enhancement, on the one hand... The structured tags are closest to the query intent expressed by the user's natural language input. On the other hand, since the matched tags are obtained from a pre-built tag rule base, the expression of the matched structured tags is more in line with the requirements of professional terminology, which is conducive to improving the accuracy of retrieval and recall of relevant knowledge. At the same time, this application adds a hidden attribute to the structured tag or converts the structured tag into a hidden format and appends the structured tag to the end of the original query text, without displaying the structured tag to the user. On the one hand, it can protect the privacy of the tag rule base. On the other hand, the semantic enhancement scheme of this application can be integrated into the existing question answering system in a way that is imperceptible to the user and does not affect the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122925595A_ABST
    Figure CN122925595A_ABST
Patent Text Reader

Abstract

The application relates to a method, a program product and an apparatus for semantic enhancement of a query statement in a workflow node. The method comprises: receiving an original query text input by a user through an input node of a workflow; matching a plurality of candidate labels corresponding to the original query text from a pre-constructed label rule library according to at least one matching rule; calculating a confidence score of each candidate label according to a type of the matching rule, a basic score of a business scenario to which the input node of the workflow belongs, and a similarity coefficient of the original query text and the candidate label; determining the first pre-set candidate labels with the highest confidence scores as structured labels; adding a hidden attribute to the structured labels or converting the structured labels into a hidden format; and appending the structured labels to the end of the original query text, without showing the structured labels to the user. The application can improve retrieval accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language intelligent processing technology, and in particular to a method, program product and device for semantic enhancement of query statements in workflow nodes. Background Technology

[0002] In enterprise-level intelligent question-answering systems, workflow orchestration has become the standard architecture for connecting large language models, knowledge bases, and external services. Users can return search results for relevant questions through a linear process of "receive → retrieve → generate → return" within workflow nodes. However, due to the semantic gap between users' natural language expressions and the standard terminology of the knowledge base, the recall rate in the retrieval process is low.

[0003] Taking industrial safety production scenarios as an example, a worker might input "The underground electric valve is malfunctioning and personnel need to be dispatched down for repairs," while the standard procedure in the knowledge base is "Confined space operation approval." Traditional RAG (Retrieval-Augmented Generation) systems struggle to automatically identify this implicit intent because the standard procedure in the knowledge base uses highly specialized terminology, and the natural language input by the user often cannot be matched with the corresponding specialized terminology through conventional methods.

[0004] The main approach to solving this problem in the existing technology is to expand or rewrite the user query before retrieval, or to process the text of the query statement entered by the user. However, regardless of the processing method, the specialization of the terminology in the retrieval database is not taken into account, which makes the accuracy of retrieving relevant knowledge from the knowledge base through subsequent retrieval relatively low. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for semantic enhancement of query statements in workflow nodes that can improve retrieval accuracy, in order to address the above-mentioned technical problems.

[0006] Firstly, this application provides a method for semantic enhancement of query statements in workflow nodes, including: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0007] In one embodiment, the steps of constructing the tag rule base include: Obtain work process documents, safety operation procedure documents, and high-risk operation management regulations documents; The work process document, safety operation procedure document, and high-risk operation management regulations document are separated into several document processing units; The document processing unit is input into the large language model, and the corresponding label rule and the confidence score of the label rule are output. If the confidence score of the labeling rule is greater than the preset score, the manual review comments for the labeling rule will be accepted. If the manual review opinion is approved, the tag rule will be added to the tag rule library.

[0008] In one embodiment, calculating the confidence score for each candidate label includes: Obtain the preset weight coefficient corresponding to the type of the matching rule; Obtain the preset base score of the business scenario to which the input node of this workflow belongs; Based on the type of the matching rule, determine the similarity coefficient between the original query text and the candidate tag; The product of the weight coefficient, the preset base score, and the similarity coefficient is used as the confidence score of the candidate label.

[0009] In one embodiment, the matching rule type includes keyword matching, regular expression matching, and semantic matching. Determining the similarity coefficient between the original query text and the candidate tag based on the type of the matching rule includes: If the matching rule is of the type of keyword matching or regular expression matching, obtain the preset similarity coefficient corresponding to the keyword matching or regular expression matching. When the matching rule is of the semantic matching type, the original query text is converted into a first semantic vector by the large language model, and the candidate label is converted into a second semantic vector. Calculate the semantic similarity between the first semantic vector and the second semantic vector; The calculated semantic similarity is used as the similarity coefficient between the original query text and the corresponding candidate tags.

[0010] In one embodiment, after the step of receiving the original query text input by the user through the input node of the workflow, the method further includes: The system identifies the length of the original query text. If the length exceeds a preset threshold, it creates a separate identification node for structured tags. The structured tag identification node can be inserted serially before the workflow node that retrieves the original query text; or it can be inserted in parallel with the workflow node that retrieves the original query text.

[0011] In one embodiment, the tag rule base is stored in a knowledge management platform on a remote server, and the method further includes: Determine whether the updated rule base for this tag in the local cache is still valid; If it is within the validity period, multiple candidate tags corresponding to the original query text will be matched from the locally cached tag rule base; If it is not within the validity period, a connection will be established with the knowledge management platform of the remote server using the MCP standard communication protocol; The tag rule base is obtained from the knowledge management platform, and multiple candidate tags corresponding to the original query text are matched from the tag rule base.

[0012] Secondly, this application also provides a semantic enhancement device for query statements in workflow nodes, the device comprising: The query text receiving module is used to receive the raw query text input by the user through the input node of the workflow; The matching module is used to match multiple candidate tags corresponding to the original query text from a pre-built tag rule library according to at least one matching rule; The calculation module is used to calculate the confidence score of each candidate label based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label. The label determination module is used to determine the top 10 candidate labels with the highest confidence scores as structured labels; The conversion module is used to add hidden attributes to the structured tag or convert the structured tag into a hidden format; The tag appending module is used to append the structured tag to the end of the original query text, without displaying the structured tag to the user.

[0013] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0014] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0015] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0016] The semantic enhancement methods, apparatuses, computer devices, computer-readable storage media, and computer program products for query statements in the aforementioned workflow nodes first receive the original query text input by the user through the workflow input node. Then, according to at least one matching rule, multiple candidate tags corresponding to the original query text are matched from a pre-built tag rule base. Based on the type of the matching rule, the base score of the business scenario to which the workflow input node belongs, and the similarity coefficient between the original query text and the candidate tag, the confidence score of each candidate tag is calculated. The top preset number of candidate tags with the highest confidence scores are determined as structured tags, so that the structured tags ultimately used for semantic enhancement, on the one hand... The structured tags are closest to the query intent expressed by the user's natural language input. On the other hand, since the matched tags are obtained from a pre-built tag rule base, the expression of the matched structured tags is more in line with the requirements of professional terminology, which is conducive to improving the accuracy of retrieval and recall of relevant knowledge. At the same time, this application adds a hidden attribute to the structured tag or converts the structured tag into a hidden format and appends the structured tag to the end of the original query text, without displaying the structured tag to the user. On the one hand, it can protect the privacy of the tag rule base. On the other hand, the semantic enhancement scheme of this application can be integrated into the existing question answering system in a way that is imperceptible to the user and does not affect the user experience. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a diagram illustrating the application environment of a semantic enhancement method for query statements in a workflow node in one embodiment. Figure 2 This is a flowchart illustrating a semantic enhancement method for query statements in a workflow node in one embodiment. Figure 3 This is a before-and-after comparison diagram of adding structured tags in one embodiment; Figure 4 This is a flowchart illustrating the steps involved in constructing the tag rule base in one embodiment; Figure 5This is a structural block diagram of a semantic enhancement device for query statements in a workflow node in one embodiment; Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0020] It should be noted that the terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more.

[0021] The semantic enhancement method for query statements in workflow nodes provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown includes terminal 102. Terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, and portable wearable devices. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0022] In one exemplary embodiment, such as Figure 2 As shown, a semantic enhancement method for query statements in workflow nodes is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps 101 to 106. Wherein: Step 101: Receive the original query text input by the user through the input node of the workflow.

[0023] In this embodiment, the user's natural language query is received at the input node of the workflow, and the original query text is obtained. The workflow is a predefined processing flow executed sequentially by multiple nodes. The nodes of this predefined workflow are, for example: User Input → Large-Scale Tag Recognition Model → Generation of Structured Tags → Seamless Tag Injection → Augmented Input → Knowledge Base Recall → Return of Results.

[0024] Step 102: Match multiple candidate tags corresponding to the original query text from a pre-built tag rule library according to at least one matching rule.

[0025] Furthermore, the types of matching rules include keyword matching, regular expression matching, and semantic matching. Among them: Keyword matching determines whether a user's query contains keywords defined by rules. It uses an inverted index to speed up matching and supports AND / OR combinations of multiple keywords. It is suitable for scenarios where user queries contain keywords defined by rules.

[0026] Regular expression matching determines whether a user's query matches a regular expression defined by a rule. It is suitable for patterned expressions, such as "device Y is faulty (X)".

[0027] Semantic similarity matching calculates the similarity between a user query and the semantic description defined in the rule. It is suitable for scenarios where the user query does not perfectly match the rule keywords, achieving more accurate tag matching through semantic understanding.

[0028] The construction of the tag rule base involves, for example, obtaining tag rules from a knowledge management platform, extracting the semantic description text of each rule, such as "operations involving enclosed spaces like mines, tanks, and pipelines," and then encoding the semantic description text into a high-dimensional vector using a pre-trained Sentence-BERT model. Sentence-BERT is a Transformer-based sentence encoding model that maps text to a semantic vector space, preserving the semantic information of the text. All rule vectors are then used to construct an efficient vector index, supporting fast similarity calculation. The vector index employs efficient approximate nearest neighbor search algorithms such as FAISS (Facebook AI Similarity Search) or Annoy.

[0029] Step 103: Calculate the confidence score of each candidate label based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label.

[0030] The purpose of this step is to perform semantic matching on the original query text based on a pre-built tag rule base to determine the matched tags. This tag rule base contains multiple tag rules, each defining a tag name and identification conditions. The matching conditions include at least one of the following: Keyword matching hit tag set: Tags matched by keyword matching, suitable for user queries that contain keywords defined by rules; Regular expression matching hit tag set: Tags matched by regular expressions, suitable for scenarios where users query patterned expressions that conform to the defined rules; Semantic matching hit tag set: Tags matched by semantic similarity, suitable for scenarios where the user query and the rule keyword description are inconsistent but semantically similar.

[0031] The three matching methods are executed in parallel, each generating candidate tags independently, and finally merged into a unified set of candidate tags.

[0032] Specifically, the calculation of the confidence score for each candidate label includes: Obtain the preset weight coefficient corresponding to the type of the matching rule; Obtain the preset base score of the business scenario to which the input node of this workflow belongs; Based on the type of the matching rule, determine the similarity coefficient between the original query text and the candidate tag; The product of the weight coefficient, the preset base score, and the similarity coefficient is used as the confidence score of the candidate label. The expression is: Confidence score = Base score × Weight coefficient × Similarity coefficient.

[0033] The base score is 1.0 by default and can be adjusted according to business scenarios. The weight coefficient is determined based on the type of matching rule: 1.0 for keyword matching, 0.9 for regular expression matching, and 0.8 for semantic matching. This weight coefficient parameter is derived through experimental optimization. The similarity coefficient is also determined based on the type of matching rule: 1.0 for keyword and regular expression matching, and the actual calculated similarity value for semantic matching. These weight values ​​are configurable, and administrators can adjust them through the knowledge management platform according to actual scenarios.

[0034] Step 104: Determine the top 100 candidate labels with the highest confidence scores as structured labels.

[0035] Furthermore, in this step, the initial number is preset to, for example, three. Specifically, it can be implemented by first determining whether the number of candidate tags exceeds a preset upper limit N. If it exceeds the preset number, the Top-N tags are selected, i.e., the N tags with the highest scores are retained. If it does not exceed the upper limit, all tags are retained. This step, by controlling the number of structured tags, can avoid injecting too many tags into the user query, thus preventing negative impacts on the downstream retrieval effect and performance.

[0036] Preferably, the candidate tag can be further calculated with a comprehensive score according to business needs. The comprehensive score is equal to the preset priority corresponding to the current scenario multiplied by the confidence score. For example, if the business scenario described in the current input original query text is high-risk rescue, the priority of the candidate tag belonging to this scenario is set to the highest, for example, 10; if the business scenario described in the current input original query text is business consultation, the priority of the candidate tag belonging to this scenario is set to the lowest, for example, 2.

[0037] It is understood that in this embodiment, a larger priority value indicates a higher priority, and the priority value range is, for example, 1 to 10. All candidate tags are sorted from highest to lowest according to their comprehensive score, with tags having higher scores listed first and selected preferentially.

[0038] Step 105: Add a hidden attribute to the structured tag or convert the structured tag to a hidden format.

[0039] In one embodiment, it can be used <input type="hidden" name="key" value="data"> Store the structured tag in <input type="hidden"> This allows the structured tag to be visible to the backend but not to the frontend. In other words, the structured tag is not rendered or displayed, but when the user submits input through the input node, the name / value of the structured tag is sent to the backend normally.

[0040] Step 106: Append the structured tag to the end of the original query text and do not display the structured tag to the user.

[0041] The purpose of this step is to make the structured tag injection process invisible to the user; the user interface still displays the original query. The structured tag is appended to the end of the original query in a preset format and is only used for downstream node processing. This enhanced query text is only passed within the workflow and is not displayed to the user. Specifically, the append format is: append the tag to the end of the original query in the format "[tag name]". When multiple tags are matched, they are appended sequentially.

[0042] Figure 3 This is a comparative illustration of the addition of structured tags in one embodiment, showing the effect after appending the structured tags to the end of the original query text. Figure 3 As shown, Figure 3 In the text, “【 】” indicates hidden formatting. The structured tags are injected into the original query text in a seamless manner to form enhanced query text, which is then used by downstream systems to match accurate knowledge and perform recall.

[0043] Furthermore, the structured tags generated based on the matching results can adopt a hierarchical naming method, such as "Hazardous Operations - Confined Space Operations", supporting hierarchical inheritance and aggregation of tags.

[0044] This embodiment enhances the downstream knowledge base retrieval nodes by appending the structured tag to the end of the original query text in the following ways: In terms of keyword expansion, the professional terms in the structured tag serve as additional search keywords, expanding the search scope; in terms of semantic anchoring, the structured tag provides clear semantic anchors for the retrieval model, reducing semantic drift; and in terms of re-ranking weighting, downstream retrieval nodes can use tag matching as a bonus for re-ranking, improving the ranking of relevant documents.

[0045] In the semantic enhancement method for query statements in the aforementioned workflow nodes, the original query text input by the user is received through the workflow input node. Then, according to at least one matching rule, multiple candidate tags corresponding to the original query text are matched from a pre-built tag rule library. Based on the type of the matching rule, the base score of the business scenario to which the workflow input node belongs, and the similarity coefficient between the original query text and the candidate tag, the confidence score of each candidate tag is calculated. The top preset number of candidate tags with the highest confidence scores are determined as structured tags, so that the structured tags used for semantic enhancement are consistent with the natural language input by the user. The query intent is closest to the target user's. On the other hand, since the matched tags are obtained from a pre-built tag rule base, the expression of the matched structured tags is more in line with the requirements of professional terminology, which is conducive to improving the accuracy of retrieval and recall of relevant knowledge. At the same time, this application adds a hidden attribute to the structured tag or converts the structured tag into a hidden format and appends the structured tag to the end of the original query text, without displaying the structured tag to the user. On the one hand, it can protect the privacy of the tag rule base. On the other hand, the semantic enhancement scheme of this application can be integrated into the existing question answering system in a way that is imperceptible to the user and does not affect the user experience.

[0046] Figure 4 This is a flowchart illustrating the steps involved in building the tag rule base in one embodiment. In an exemplary embodiment, such as... Figure 4 As shown, constructing this tag rule base includes the following steps 201 to 205, wherein: Step 201: Obtain the work process document, safety operation procedure document, and high-risk operation management regulations document.

[0047] Understandably, in addition to the three types of documents mentioned above, the original files used to build the tag rule base can also include other types of documents or operation manuals, depending on the actual business and scenario needs.

[0048] Furthermore, this embodiment also includes parsing work process documents, safety operation procedure documents, and high-risk operation management regulations documents in different document formats to extract the plain text content of the documents. These different document formats include, for example, PDF, Word, and Markdown.

[0049] Step 202: The work process document, safety operation procedure document, and high-risk operation management regulations document are broken down into several document processing units.

[0050] In this embodiment, various documents can be split into independent document processing units by chapter or paragraph.

[0051] Step 203: Input the document processing unit into the large language model and output the label rule corresponding to the document processing unit and the confidence score of the label rule.

[0052] The labeling rules output by the large language model include, but are not limited to, label names, identification keywords, identification conditions, and confidence scores.

[0053] Furthermore, the temperature for calculating the confidence score of the extracted label rules includes: Clarity of rules: Are the rule definitions clear and unambiguous? Keyword coverage: Identifying whether keywords can effectively cover the target scenario; Semantic consistency: Whether the semantic description of the rule is consistent with the actual business meaning.

[0054] Step 204: If the confidence score of the label rule is greater than the preset score, receive the manual review comments for the label rule.

[0055] In one embodiment, the preset score is, for example, 0.8. That is, only the extraction results with a confidence score higher than the threshold are retained. If the confidence score does not meet the requirements, the process returns to step 203 to extract and output the label rules again.

[0056] Step 205: If the manual review opinion is approved, add the tag rule to the tag rule library.

[0057] In this embodiment, the label rules filtered by confidence scores undergo manual review. The review includes checking the accuracy of the rules, the rationality of the keywords, and the standardization of the label names. After the manual review is passed, the label rules are finally confirmed.

[0058] The confirmed tag rules are written into the tag rule library of the knowledge management platform. This serves two purposes: firstly, it ensures the persistent storage of the rules; secondly, it facilitates setting the activation status, allowing administrators to configure the activation status of rules according to business needs. Once the tag rules are entered into the library and activated, they provide services externally, and all tag recognition nodes automatically obtain the new rules through standard communication protocols.

[0059] In one embodiment, the matching rule type includes keyword matching, regular expression matching, and semantic matching. Determining the similarity coefficient between the original query text and the candidate tag based on the type of the matching rule includes: If the matching rule is of the type of keyword matching or regular expression matching, obtain the preset similarity coefficient corresponding to the keyword matching or regular expression matching. When the matching rule is semantic matching, the original query text is converted into a first semantic vector using a large language model, and the candidate label is converted into a second semantic vector. Specifically, the same Sentence-BERT model used for rule encoding can be used to encode the user query text into a second semantic vector. Using the same large language model for both the original query text and candidate labels ensures that the second semantic vector reflecting the rule and the first semantic vector reflecting the query semantics are in the same semantic space, guaranteeing the effectiveness of similarity calculation. Calculate the semantic similarity between the first semantic vector and the second semantic vector. Specifically, perform cosine similarity calculation between the first semantic vector and all second semantic vectors in the candidate labels. Cosine similarity measures the similarity between two vectors in a direction, with a value ranging from -1 to 1; a higher value indicates greater similarity. When the similarity exceeds a preset threshold, the rule is considered to be matched; otherwise, the rule is skipped. The preset threshold defaults to 0.75. This step constructs a vector index from the semantic descriptions of all rules, supporting efficient batch similarity calculation and avoiding the performance bottleneck of comparing each rule one by one. The calculated semantic similarity is used as the similarity coefficient between the original query text and the corresponding candidate tags.

[0060] In one embodiment, after the step of receiving the original query text input by the user through the input node of the workflow, the method further includes: The system identifies the length of the original query text. If the length exceeds a preset threshold, it creates a separate recognition node for structured tags. This preset threshold is, for example, 20 characters. The structured tag identification node can be inserted serially before the workflow node that retrieves the original query text; or it can be inserted in parallel with the workflow node that retrieves the original query text.

[0061] For serial insertion, tag recognition nodes are inserted sequentially after user query input and before knowledge base retrieval. This method is simple to implement and suitable for scenarios where latency is not a major concern. For parallel insertion, tag recognition nodes and the initial knowledge base retrieval are performed in parallel, and the retrieval results are reordered after tag recognition is completed. This method can reduce overall latency. In this embodiment, conditional insertion triggers tag recognition nodes conditionally based on the characteristics of the user query. For example, it is triggered only when the query length exceeds a threshold or contains specific keywords.

[0062] In one embodiment, the tag rule base is stored in a knowledge management platform on a remote server, and the method further includes: Determine whether the updated rule base for this tag in the local cache is within its validity period, which may be, for example, 300 seconds. If it is within the validity period, multiple candidate tags corresponding to the original query text will be matched from the locally cached tag rule base; If it is not within the validity period, a connection will be established with the knowledge management platform of the remote server using the MCP standard communication protocol; The tag rule base is obtained from the knowledge management platform, and multiple candidate tags corresponding to the original query text are matched from the tag rule base.

[0063] When the tag rules of the knowledge management platform are updated, the update notification is actively pushed to the tag recognition node in the workflow through the standard communication protocol. The tag recognition node automatically refreshes its local rule cache to achieve real-time synchronization of the rules.

[0064] In one embodiment, the administrator logs into the knowledge management platform to modify the rules. When updating and synchronizing the tag rules in the tag rule base, the main steps include: Add a new rule: Add a new tag rule, defining the tag name, recognition conditions, etc. Rule editing: Modify the label name or recognition criteria of an existing rule; Rule deletion: Delete a tag rule that is no longer needed; Rule Enable / Disable: Toggle the enabled status of a rule, temporarily disabling or re-enabling it.

[0065] After the knowledge management platform receives the administrator's rule modification operation: Rule change log: Records the history of rule changes, including change time, change type, change content, etc., and supports rule version management and audit traceability; Generate update notifications: Based on the rule changes, generate structured update notifications. The notification content includes the change type, the rule ID of the change, and the content of the changed rule.

[0066] After receiving the update notification generated by the platform, the MCP Server pushes the update notification to all connected MCP Clients through the notifications mechanism of the MCP protocol. The MCP Server maintains a list of connected Clients to ensure that all online tag recognition nodes can receive the update notification. It also supports a reconnection mechanism to ensure that offline nodes can obtain the latest rules after reconnecting.

[0067] Upon receiving an update notification, the tag recognition node (MCP Client) in the client's workflow refreshes its local rule cache based on the content of the update notification. Cache refresh strategies include: full refresh (re-fetching all rules) and incremental refresh (updating only the changed rules). After the cache refresh is complete, the tag recognition node uses the latest rules for subsequent tag recognition tasks.

[0068] The communication process using the MCP standard communication protocol is as follows: When the tag recognition node starts, it connects to the MCP Server via SSE or WebSocket; after the connection is established, it calls the "get_active_rules" tool to obtain the rules; the rules are cached locally, and the cache expiration time is set; after the cache expires, the tool is called again to obtain the latest rules; when the MCP Server updates the rules, it actively pushes a notification, and the node refreshes the cache.

[0069] Furthermore, this embodiment also allows for configuration of the cache capacity, with a default setting of 1000 tag rules, and supports manual cache refresh.

[0070] Specifically, the tag recognition node in this embodiment supports a rule caching mechanism, directly using the local cache within the cache's validity period to reduce network calls. When the cache expires, the latest tag rules are retrieved from the platform again.

[0071] The tag recognition node initiates a request to the knowledge management platform through standard communication protocols to obtain the currently enabled tag rule base. The standard communication protocols include, but are not limited to, MCP (Model Context Protocol), HTTP API (HTTP Application Programming Interface), and gRPC (Google Remote Procedure Call).

[0072] Specifically, the tag recognition node acts as a client, and the knowledge management platform acts as a server. When the tag recognition node starts up, it connects to the knowledge management platform via a standard communication protocol and calls the rule query interface provided by the platform to obtain the enabled tag rules.

[0073] In this embodiment, the MCP standard communication protocol is chosen because: the MCP protocol supports server-initiated push notifications (notifications mechanism), which is naturally adapted to scenarios of dynamic rule synchronization; the MCP protocol provides a standardized tool call interface (tools / call), which facilitates the encapsulation of rule query functions; the MCP protocol supports both SSE and WebSocket transmission methods, and supports bidirectional real-time communication; the MCP protocol has become the mainstream standard in the field of large language models and has good compatibility with mainstream workflow platforms such as Dify and Coze.

[0074] The following describes an implementation scenario of this embodiment using a water plant operation process approval scenario as an example. For instance, a user inputs "The underground electric valve is malfunctioning and personnel need to be dispatched to repair it." The implementation steps of tag recognition based on keyword matching are as follows: The tag recognition node obtains the rule base from the platform; the user query is matched with the rules for keyword matching; "underground" matches rule_001, and "electric valve" matches rule_003; the top-2 tags are sorted by priority; the tags are injected into the end of the user query: Original query: The underground electric valve is malfunctioning and personnel need to be dispatched to repair it; Enhanced query: The underground electric valve is malfunctioning and personnel need to be dispatched to repair it [Hazardous operation - confined space operation] [Equipment maintenance - electric valve maintenance]; the enhanced query is passed to the downstream knowledge base retrieval node; In the scenario of label recognition based on semantic similarity, the expression of a user query is not completely consistent with rule keywords, which requires semantic understanding. The implementation steps are: obtaining rules from the platform, where the rules include semantic descriptions; the label recognition node encodes the semantic descriptions of the rules into vectors using the Sentence-BERT model, and constructs a vector index; encoding the user query into a vector, and calculating the cosine similarity with the rule vectors; when the similarity exceeds a threshold (0.75), it is determined that the rule is hit, a label is generated and injected into the user query.

[0075] In the scenario of label recognition based on regular expressions, taking the equipment operation and maintenance scenario as an example, the user inputs "No. 3 water pump has abnormal vibration and needs inspection". Specific implementation steps are for example: obtaining a rule from the platform, the rule comprising a regular expression: the label name is "Equipment Failure - Abnormal Vibration", and the recognition regular expression is "\d+ No.*pump.*vibration|vibration.*abnormal"; the label recognition node uses the regular expression to match the user query; if the matching is successful, the label "Equipment Failure - Abnormal Vibration" is generated; the label is injected into the end of the user query and transmitted to the downstream node.

[0076] The beneficial effect of this embodiment lies in that label recognition is integrated into the workflow in the form of an independent node, without modifying the logic of other nodes, realizing workflow integration that is plug-and-play. All label rules are uniformly obtained from the knowledge management platform, supporting online configuration and dynamic update of the rules. When a rule is updated, a notification is actively pushed through a standard communication protocol, and all label recognition nodes complete synchronization within seconds. The label injection process is transparent to users, and the user interface still displays the original query. Label generation is based on the rule base, so the source of each label is traceable. Based on the standard communication protocol, the system can be integrated into various workflow platforms. After introducing label injection, both the recall rate and accuracy of knowledge base retrieval are significantly improved.

[0077] It should be understood that although the respective steps in the flowcharts involved in the embodiments described above are displayed in sequence according to the directions of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict sequence restriction on the execution of these steps, and these steps may be executed in other orders. Moreover, at least part of the steps in the flowcharts involved in the above-described embodiments may include a plurality of sub-steps or a plurality of stages, these sub-steps or stages are not necessarily completed at the same moment, but may be executed at different moments, and the execution order of these sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a part of other steps or sub-steps or stages in other steps. It can be understood that the respective steps in different embodiments can be freely combined as required, and various non-contradictory schemes formed by the combination all fall within the protection scope of the present application.

[0078] Based on the same inventive concept, this application also provides a semantic enhancement device for query statements in workflow nodes, used to implement the semantic enhancement method for query statements in workflow nodes described above. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more embodiments of the semantic enhancement device for query statements in workflow nodes provided below can be found in the limitations of the semantic enhancement method for query statements in workflow nodes described above, and will not be repeated here.

[0079] In one exemplary embodiment, such as Figure 5 As shown, a semantic enhancement device 100 for query statements in a workflow node is provided, including: a query text receiving module 11, a matching module 12, a calculation module 13, a tag determination module 14, a conversion module 15, and a tag appending module 16, wherein: The query text receiving module 11 is used to receive the original query text input by the user through the input node of the workflow; The matching module 12 is used to match multiple candidate tags corresponding to the original query text from a pre-built tag rule library according to at least one matching rule; The calculation module 13 is used to calculate the confidence score of each candidate label based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label. The label determination module 14 is used to determine the top preset number of candidate labels with the highest confidence scores as structured labels; The conversion module 15 is used to add hidden attributes to the structured tag or convert the structured tag into a hidden format; The tag appending module 16 is used to append the structured tag to the end of the original query text and not display the structured tag to the user.

[0080] In one embodiment, the semantic enhancement device 100 for query statements in a workflow node further includes: The document acquisition module is used to acquire work process documents, safety operation procedure documents, and high-risk operation management regulations documents. The splitting module is used to split the work process document, safety operation procedure document, and high-risk operation management regulation document into several document processing units. The input module is used to input the document processing unit into the large language model and output the label rule corresponding to the document processing unit and the confidence score of the label rule. The receiving module is used to receive manual review comments on the labeling rule when the confidence score of the labeling rule is greater than the preset score; The tag adding module is used to add the tag rule to the tag rule library if the manual review opinion is approved.

[0081] In one embodiment, the computing module 13 includes: The weight coefficient acquisition unit is used to acquire the preset weight coefficient corresponding to the type of the matching rule; The basic score acquisition unit is used to acquire the preset basic score of the business scenario to which the input node of the workflow belongs; The similarity coefficient determination unit is used to determine the similarity coefficient between the original query text and the candidate tag based on the type of the matching rule. The product unit is used to multiply the weight coefficient, the preset base score, and the similarity coefficient as the confidence score of the candidate label.

[0082] In one embodiment, the matching rule type includes keyword matching, regular expression matching, and semantic matching, and the similarity coefficient determination unit further includes: The coefficient acquisition unit is used to acquire the preset similarity coefficient corresponding to the keyword matching or regular expression matching when the matching rule type is keyword matching or regular expression matching. The semantic transformation unit is used to convert the original query text into a first semantic vector and the candidate label into a second semantic vector using a large language model when the matching rule is of the semantic matching type. A similarity calculation unit is used to calculate the semantic similarity between the first semantic vector and the second semantic vector; The coefficient determination unit is used to use the calculated semantic similarity as the similarity coefficient between the original query text and the corresponding candidate tags.

[0083] In one embodiment, the semantic enhancement device 100 for query statements in the workflow node further includes: The node creation module is used to identify the length of the original query text. If the length of the query text exceeds a preset threshold, it creates an independent recognition node for structured tags. The insertion module is used to insert the identification node of the structured tag in a serial insertion manner before the workflow node that retrieves the original query text; or to insert the identification node of the structured tag in the workflow in parallel with the workflow node that retrieves the original query text.

[0084] In one embodiment, the tag rule base is stored on a knowledge management platform on a remote server, and the semantic enhancement device 100 for query statements in the workflow node further includes: The judgment module is used to determine whether the updated rule base for the tag in the local cache is within its validity period; The first matching module is used to match multiple candidate tags corresponding to the original query text from the locally cached tag rule base if the query is within the validity period. The connection module is used to establish a connection with the knowledge management platform of the remote server using the MCP standard communication protocol if the knowledge is not within the validity period. The second matching module is used to obtain the tag rule base from the knowledge management platform and match multiple candidate tags corresponding to the original query text from the tag rule base.

[0085] The semantic enhancement devices for query statements in the aforementioned workflow nodes can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can invoke and execute the operations corresponding to each module.

[0086] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a semantic enhancement method for query statements in a workflow node. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0087] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0088] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0089] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0090] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: The workflow input nodes receive the user's original query text. According to at least one matching rule, match multiple candidate tags corresponding to the original query text from a pre-built tag rule base; Based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label, calculate the confidence score of each candidate label; The top 10 candidate labels with the highest confidence scores are identified as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tag is appended to the end of the original query text, and the structured tag is not displayed to the user.

[0091] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0092] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0093] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0094] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for semantic enhancement of query statements in workflow nodes, characterized in that, The method includes: The workflow input nodes receive the user's original query text. According to at least one matching rule, multiple candidate tags corresponding to the original query text are matched from a pre-built tag rule base; Based on the type of the matching rule, the base score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate tags, calculate the confidence score of each candidate tag; The top 10 candidate labels with the highest confidence scores are determined as structured labels; Add a hidden attribute to the structured tag or convert the structured tag to a hidden format; The structured tags are appended to the end of the original query text, but the structured tags are not displayed to the user.

2. The method according to claim 1, characterized in that, The steps for constructing the tag rule base include: Obtain work process documents, safety operation procedure documents, and high-risk operation management regulations documents; The work process document, safety operation procedure document, and high-risk operation management regulation document are each broken down into several document processing units; The document processing units are input into the large language model, and the label rules corresponding to the document processing units and the confidence scores of the label rules are output. If the confidence score of the labeling rule is greater than a preset score, the manual review comments on the labeling rule will be received. If the manual review opinion is approved, the label rule will be added to the label rule library.

3. The semantic enhancement method for query statements in workflow nodes according to claim 2, characterized in that, The calculation of the confidence score for each candidate label includes: Obtain the preset weight coefficient corresponding to the type of the matching rule; Obtain the preset base score of the business scenario to which the input node of the workflow belongs; Based on the type of the matching rule, determine the similarity coefficient between the original query text and the candidate tags; The product of the weight coefficient, the preset base score, and the similarity coefficient is used as the confidence score of the candidate label.

4. The semantic enhancement method for query statements in workflow nodes according to claim 3, characterized in that, The matching rules include keyword matching, regular expression matching, and semantic matching. Determining the similarity coefficient between the original query text and the candidate tags based on the type of matching rule includes: When the matching rule type is keyword matching or regular expression matching, obtain the preset similarity coefficient corresponding to the keyword matching or regular expression matching; When the matching rule is of the semantic matching type, the original query text is converted into a first semantic vector and the candidate label is converted into a second semantic vector using a large language model. Calculate the semantic similarity between the first semantic vector and the second semantic vector; The calculated semantic similarity is used as the similarity coefficient between the original query text and the corresponding candidate tags.

5. The semantic enhancement method for query statements in workflow nodes according to any one of claims 1 to 4, characterized in that, Following the step of receiving the original query text input by the user through the input node of the workflow, the method further includes: The length of the original query text is identified, and if the length of the text exceeds a preset threshold, an independent identification node for structured tags is created. The structured tag identification node can be inserted serially before the workflow node that retrieves the original query text; or it can be inserted in parallel with the workflow node that retrieves the original query text, inserting the structured tag identification node into the workflow.

6. The semantic enhancement method for query statements in workflow nodes according to any one of claims 1 to 4, characterized in that, The tag rule base is stored in a knowledge management platform on a remote server, and the method further includes: Determine whether the updated tag rule base in the local cache is within its validity period; If it is within the validity period, then multiple candidate tags corresponding to the original query text are matched from the locally cached tag rule base; If it is not within the validity period, a connection will be established with the knowledge management platform of the remote server using the MCP standard communication protocol; The knowledge management platform retrieves the tag rule base, and multiple candidate tags corresponding to the original query text are matched from the tag rule base.

7. A semantic enhancement device for query statements in a workflow node, characterized in that, The device includes: The query text receiving module is used to receive the raw query text input by the user through the input node of the workflow; The matching module is used to match multiple candidate tags corresponding to the original query text from a pre-built tag rule library according to at least one matching rule; The calculation module is used to calculate the confidence score of each candidate label based on the type of the matching rule, the basic score of the business scenario to which the input node of the workflow belongs, and the similarity coefficient between the original query text and the candidate label. The label determination module is used to determine the top preset number of candidate labels with the highest confidence scores as structured labels; The conversion module is used to add hidden attributes to the structured tags or convert the structured tags into a hidden format; The tag appending module is used to append the structured tags to the end of the original query text, without displaying the structured tags to the user.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the semantic enhancement method for query statements in workflow nodes according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the semantic enhancement method for query statements in workflow nodes according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the semantic enhancement method for query statements in workflow nodes according to any one of claims 1 to 6.