Method and system for real-time recognition of search keyword effectiveness based on multi-channel feature fusion and semantic prototype constraint

By employing a multi-channel feature fusion and semantic prototype constraint method, this approach addresses the issues of insufficient real-time detection capability and inadequate feature fusion in existing technologies. It achieves stable and accurate identification of invalid search keywords and is suitable for high-concurrency, low-latency search systems.

CN122153062APending Publication Date: 2026-06-05XIDIAN UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIDIAN UNIV
Filing Date
2026-03-06
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing content security detection technologies struggle to detect search keywords in real time during the search request phase. Furthermore, in cases of short texts and significant structural noise, semantic models struggle to reliably identify invalid search keywords. Insufficient feature fusion leads to inadequate recognition capabilities. Moreover, existing methods incur high computational overhead or maintenance costs, making it difficult to meet the business requirements of high concurrency and low latency.

Method used

We employ a multi-channel feature fusion and semantic prototype constraint approach. We extract semantic representation vectors through a pre-trained language model and combine them with structural pattern feature vectors for collaborative modeling to construct semantic prototype representations. We then use a functional fusion strategy for discrimination to avoid structural features interfering with the semantic space and achieve stable identification of invalid search keywords.

Benefits of technology

It achieves accurate and stable identification of invalid search keywords, reduces computational overhead and maintenance costs, adapts to high-concurrency, low-latency real-time search systems, improves identification accuracy and robustness, and reduces false positive rate and operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153062A_ABST
    Figure CN122153062A_ABST
Patent Text Reader

Abstract

The application discloses a search keyword effectiveness real-time recognition method and system based on multi-channel feature fusion and semantic prototype constraint, and comprises the following steps: acquiring and preprocessing a search keyword; through a text semantic channel, a pre-trained language model is used to extract a semantic representation vector by combining sequence enhancement and an attention mechanism, and a category semantic prototype is constructed; through a structure mode channel, a structure mode feature vector is extracted; based on a functional fusion strategy, the similarity of the semantic representation vector and the semantic prototype is calculated to obtain a preliminary discrimination score, the score is adjusted by using the structure mode feature vector, and a final discrimination score is obtained; and an effectiveness recognition result is output; according to the characteristics of short text and high structural noise of the search keyword, the stability of the semantic representation is improved by means of semantic prototype constraint, the deficiency of a pure semantic model is made up by using structure features for auxiliary adjustment, accurate and stable recognition of invalid search keywords in a low-delay and high-concurrency scene is realized, the rule maintenance cost is effectively reduced, and the system security is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of content security detection or text analysis technology, and in particular to a method and system for real-time identification of the validity of search keywords based on multi-channel feature fusion and semantic prototype constraints. Background Technology

[0002] Existing content security detection or text analysis technologies primarily process existing website content or user-submitted content offline, making them unsuitable for scenarios where users submit search keywords in real-time during the search request phase. Search keywords are typically submitted as HTTP request parameters along with the search request, characterized by extremely short text lengths, lack of contextual information, and significant structural noise. This leads to the following technical challenges for existing technologies in this scenario:

[0003] (1) Regarding the problem of insufficient real-time detection capability in the search request stage, existing technologies are mostly oriented towards content-level or log-level text analysis, and usually adopt offline or asynchronous detection methods. They cannot identify search keywords in real time when a search request is generated, which makes it difficult to meet the application requirements of search business for low latency and high concurrency search keyword detection.

[0004] (2) The problem that relying solely on semantic modeling methods makes it difficult to reliably identify invalid search keywords in short texts. Existing search keyword classification methods based on pre-trained language models mainly rely on semantic features for discrimination. When the search keyword text is extremely short and the context is missing, the semantic expression is unstable. For search keywords that are semantically misleading but essentially invalid, misjudgment is likely to occur, and the classification results are not stable enough.

[0005] (3) The problem that structurally abnormal search keywords are difficult to be effectively identified by pure semantic models. Existing semantic discrimination methods are unable to effectively distinguish structurally abnormal search keywords such as path input, abnormal number strings, file name fragments and parameterized strings. They cannot make full use of the discrimination information presented by search keywords at the level of character composition and format pattern, resulting in insufficient ability to identify structurally invalid search keywords.

[0006] (4) Separate modeling of semantic features and structural features leads to insufficient fusion. Although some existing search keyword classification methods introduce semantic features and structural features at the same time, they mostly adopt independent modeling or simple splicing. Different types of features lack unified constraints and collaborative mechanisms in the representation space, resulting in insufficient feature fusion and insufficient stability of classification decisions in complex search scenarios.

[0007] (5) The problem of difficulty in ensuring detection effect while taking into account engineering feasibility: Existing technologies either rely on complex deep models, which have high computational overhead and high deployment costs; or rely on manual rules, which have high maintenance costs and limited generalization ability, making it difficult to achieve accurate, stable and sustainable search keyword detection in actual business environments with high concurrency and low latency of search requests.

[0008] With the widespread application of internet search engines, website search functions, and various information retrieval systems, users obtaining online information by entering search keywords in website search windows has become one of the most important human-computer interaction methods. Search keyword input scenarios not only exist in general search engines but are also widely used in campus websites, government systems, enterprise internal search platforms, and log analysis and security auditing systems.

[0009] In real-world business environments, user-input search keywords are complex and diverse. Besides normal natural language phrases, they often include non-standard input content such as URL links, file paths, parameter strings, long numeric sequences, and symbol combinations, including spam advertisements and website promotions. A significant portion of these search keywords lack a clear information retrieval intent and may even be invalid or abnormal input. If these invalid search keywords are not identified and filtered in a timely manner, they will not only degrade the service quality and performance of the search system, increase website request response time, and increase data bandwidth and traffic consumption, but may also be used to probe system vulnerabilities, spread illegal information, or launch malicious attacks, posing risks to system security and operational management.

[0010] In the process of maintaining actual websites and search systems, it has been found that invalid search keywords submitted by users typically have the following characteristics: First, the search keyword text is extremely short, with a serious lack of contextual information; second, the proportion of structural noise is high, and the semantic expression is incomplete or even misleading; third, invalid search keywords are diverse in type, making it difficult to identify them uniformly using a single rule or model. Currently, maintenance personnel mostly use manual rules or post-event analysis to process abnormal search keywords, which is passive, inefficient, and unable to meet the needs of large-scale, real-time search keyword filtering.

[0011] Patent application CN117252534A proposes a short text classification method based on multi-strategy fusion, which improves the classification performance of short texts by fusing multiple text features and classification strategies. However, it still mainly focuses on general text classification tasks and lacks a targeted modeling mechanism for invalid search keywords with significant structural noise and highly incomplete semantics in the search keyword scenarios submitted by websites.

[0012] It should be noted that while existing text classification methods that fuse semantic and structural features (such as CN117252534A) exist, their fusion methods mostly employ feature concatenation or weighted fusion, directly combining different types of features in the feature space before inputting them into the classifier. This approach has the following limitations: structural features directly participate in the construction of the semantic representation space, leading to rule noise contaminating the semantic space and thus affecting the stability of classification decisions. The functional fusion strategy proposed in this invention effectively decouples the semantic space from the rule space by limiting structural features to only assisting in adjusting the semantic discrimination results without participating in the construction of semantic prototypes, thus solving the aforementioned technical problems. Summary of the Invention

[0013] To overcome the problems existing in the prior art, the present invention aims to provide a real-time search keyword validity identification method and system based on multi-channel feature fusion and semantic prototype constraints. Targeting the characteristics of "short text and high structural noise" in real search logs, this invention constructs an identification method that can simultaneously characterize the semantic rationality and structural anomaly of search keywords. By introducing structural pattern features and co-modeling them with semantic representations, the accuracy and stability of identifying invalid search keywords that are structurally abnormal but semantically deceptive are improved. This search keyword identification method can adapt to the distribution characteristics of real search keywords and take into account both semantic information and structural characteristics. It accurately and stably automatically detects invalid search keywords during the search request stage, thereby improving the overall performance of search systems and website services in terms of security, reliability, and operational efficiency.

[0014] To achieve the above objectives, the present invention adopts the following technical solution.

[0015] A real-time method for identifying the validity of search keywords based on multi-channel feature fusion and semantic prototype constraints includes the following steps:

[0016] Step S1: During the Web search request processing, the search keywords to be identified are obtained in real time, and the search keywords are preprocessed to obtain standardized search keyword text;

[0017] Step S2: Input the normalized search keyword text obtained in Step S1 into the text semantic channel, and use the pre-trained language model combined with sequence enhancement and attention aggregation mechanism to extract the semantic representation vector of the search keyword level; at the same time, based on the category labeling information, aggregate multiple semantic representation vectors of the search keyword level under the same category to construct the semantic prototype representation of the corresponding category.

[0018] Step S3: Input the normalized search keyword text obtained in Step S1 into the structure pattern channel, extract features from three levels: character statistics layer, structure pattern layer and semantic risk layer, and generate structure pattern feature vector;

[0019] Step S4: Discrimination based on functional fusion strategy: Calculate the similarity between the search keyword-level semantic representation vector obtained in step S2 and the semantic prototype representation to obtain a preliminary discrimination score, and use the structural pattern feature vector generated in step S3 to adjust the preliminary discrimination score to obtain the final discrimination score;

[0020] Step S5: Output the validity identification result of the search keywords based on the final discrimination score obtained in step S4.

[0021] In step S2, the specific process of extracting the semantic representation vector at the search keyword level includes:

[0022] The normalized search keyword text is encoded using a pre-trained language model to obtain a token-level contextual semantic representation;

[0023] The token-level context semantic representation is input into a bidirectional sequence model to jointly model the forward and backward dependencies of the sequence, resulting in a semantically enhanced sequence representation.

[0024] By using the attention pooling mechanism, the semantic contributions of different tokens in the semantically enhanced sequence representation are adaptively weighted and aggregated to generate the search keyword-level semantic representation vector.

[0025] In step S2, the specific process of constructing the semantic prototype representation of the corresponding category includes:

[0026] For category c, obtain the set of semantic representation vectors of all search keywords under that category;

[0027] The semantic representation vectors in the set are normalized and the mean is calculated to obtain the semantic prototype representation of the category.

[0028]

[0029] in, This represents the semantic representation of the i-th search keyword, and its category label is y. i , This represents the set of samples corresponding to category c;

[0030] Alternatively, an online or incremental update mechanism can be used to adjust the prototype vector by moving average or momentum update when new samples arrive.

[0031] In step S3, the extraction of the structural pattern feature vector specifically includes:

[0032] In the character statistics layer, the normalized value of the length of the search keywords is calculated, as well as the proportion of different character types such as numbers, letters, Chinese characters and symbols in the search keywords;

[0033] At the structural pattern layer, regular expression rules and pattern matching are used to detect whether the search keywords contain URLs, domain name fragments, file paths, email formats, or imperative inputs, and these are represented in binary or normalized count form.

[0034] In the semantic risk layer, search keywords are matched with a predefined risk vocabulary or rule set to count the hits of potentially illegal or high-risk content and construct a continuous risk score representation.

[0035] The above three layers of features are spliced ​​or merged to form the structural pattern feature vector Pattern.

[0036] In step S4, the discrimination based on the functional fusion strategy specifically includes:

[0037] Calculate the semantic representation vector of the search keyword level. semantic prototypes of each category Cosine similarity between them;

[0038]

[0039] A preliminary discrimination score function based on semantic distribution is defined, and the inter-class discrimination interval m and temperature coefficient τ are introduced to adjust the distribution smoothness.

[0040]

[0041] A structural pattern feature vector (Pattern) is introduced as an auxiliary signal to adjust and supplement the semantic similarity discrimination result; let p_pattern represent the pattern rule feature vector corresponding to the search keyword, and the final discrimination score is expressed as:

[0042]

[0043] Where f(·) is a linear or nonlinear mapping function of the structural pattern feature vector Pattern, and β is a learnable adjustment coefficient used to control the adjustment strength of structural features on semantic discrimination; by limiting structural pattern features to only adjust semantic similarity scores and not participate in semantic space construction, the functions of semantic discrimination and structural perception are decoupled.

[0044] In step S1, the preprocessing includes:

[0045] Filter access records from the web access logs whose request path is the search interface and contains keyword parameters; extract the raw string from the GET parameters and perform URL decoding;

[0046] The decoded text is stored using UTF-8 encoding, NFKC normalization is performed on full-width and half-width characters, leading and trailing whitespace characters are removed, and empty strings and pure symbol inputs are filtered out.

[0047] A real-time search keyword validity recognition system based on multi-channel feature fusion and semantic prototype constraints includes:

[0048] The data acquisition and preprocessing module is used to acquire the search keywords to be identified in step S1, and to perform URL decoding and normalization preprocessing to obtain normalized search keyword text.

[0049] The text semantic feature modeling module is used in step S2 to input the normalized search keyword text into the text semantic channel, extract the search keyword-level semantic representation vector, and construct the semantic prototype representation of the corresponding category;

[0050] The structural pattern feature extraction module is used in step S3 to input the standardized search keyword text into the structural pattern channel, extract features from three levels: character statistics, structural pattern and semantic risk, and generate a structural pattern feature vector.

[0051] The multi-channel feature fusion and discrimination module is used in step S4 to calculate the similarity between the search keyword-level semantic representation vector and the semantic prototype representation, and to adjust the similarity discrimination result using the structural pattern feature vector, and output the final discrimination score.

[0052] The result output module is used in step S5 to output the validity identification result of the search keywords based on the final discrimination score.

[0053] The text semantic feature modeling module includes:

[0054] The pre-trained encoding unit is used to perform token-level encoding of the input text using a pre-trained language model; the sequence augmentation unit is used to model the forward and backward dependencies of the encoding results using a bidirectional sequence model.

[0055] Attention aggregation unit, used to aggregate sequence representations through attention mechanism to generate keyword-level semantic representation vectors;

[0056] The prototype building unit is used to perform normalized mean aggregation or incremental update on the semantic representation vectors of similar samples based on category labels to generate semantic prototypes.

[0057] The structural pattern feature extraction module includes:

[0058] The character statistics unit is used to calculate the proportion of character types and the normalized length value;

[0059] The pattern matching unit is used to detect URLs, file paths, and abnormal formats using regular expression rules;

[0060] Risk scoring unit, used to generate continuous risk scores based on risk vocabulary matching;

[0061] The feature fusion unit is used to integrate the features output by the above units into a continuous structural pattern feature vector.

[0062] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the search keyword classification method based on multi-channel feature fusion and semantic prototype constraints.

[0063] Compared with the prior art, the present invention has the following beneficial effects:

[0064] (1) For low-latency invalid search keyword identification scenarios in real-time search systems, compared with large language model search term analysis methods that rely on large-scale search behavior data, contextual association, or generative reasoning, this invention uses a single search keyword generated during the search request stage as an independent input object. It does not rely on cross-request context or user behavior sequences, and can complete the discrimination only through lightweight semantic representation modeling and structural feature extraction. Therefore, while ensuring recognition accuracy, this invention can effectively control computational overhead and response latency, making it more suitable for real-time search systems or online keyword filtering scenarios with high concurrency and low latency requirements, and has stronger engineering feasibility.

[0065] (2) By decoupling the semantic space from the rule space, the model achieves more stable discrimination in short text and high-structural-noise scenarios. Existing methods based on pre-trained language models mainly rely on text semantic modeling. When the search keyword text is extremely short, the context is severely lacking, or it is dominated by URLs, parameter strings, symbols, and numbers, the semantic representation is unstable and prone to misjudgment. This invention introduces an independent Pattern rule channel to explicitly model the character composition and structural pattern of search keywords and makes collaborative decisions with semantic features. It also adopts a functional fusion strategy (structural features do not participate in the semantic prototype construction but only serve as auxiliary adjustments), avoiding direct interference of rule features on the semantic representation space. This allows the model to maintain stable discrimination ability in search keyword scenarios dominated by structural anomalies, thereby significantly improving the accuracy and robustness of invalid search keyword identification. Experimental data show that the recall rate of this invention for structurally abnormal samples reaches 0.9693, which is 3.5%-4.8% higher than that of conventional fusion methods.

[0066] (3) Reduce rule maintenance costs and improve the long-term adaptability of the system. Compared with traditional abnormal search keyword identification methods based on manual rules or threshold judgment, this invention does not use hard rules to directly participate in decision-making. Instead, it transforms character structure rules and pattern information into learnable continuous features and uses them as auxiliary signals to participate in the unified model reasoning process. This approach retains the interpretability of rule features while avoiding the problem of frequent manual adjustment and maintenance of rules, effectively reducing system operation and maintenance costs, and improving the model's adaptability to changes in the form of invalid search keywords, so that the system has better stability and scalability in long-term operation.

[0067] (4) Improving the stability and interpretability of classification decisions through semantic prototype constraints and functional decoupling mechanisms. Existing search keyword classification methods mostly use parameterized classification heads, whose decision boundaries are highly dependent on the distribution of training data and are easily affected by noisy samples. This invention constructs category semantic prototypes, transforming the classification process into a similarity comparison between the semantic representation of search keywords and category prototypes. It also combines scale calibration and discriminant interval constraints, and uses a functional fusion strategy to ensure that structural features only play an auxiliary adjustment role without interfering with the semantic space, making the distinction between different categories in the semantic space clearer, thereby improving the consistency, stability and interpretability of classification results. Experimental data show that the misclassification rate of normal samples in this invention is only 0.008, which is 33%-46% lower than that of conventional fusion methods.

[0068] In summary, this invention addresses real-time search scenarios by constructing a multi-channel search keyword recognition technology solution with semantic prototype similarity discrimination as the core and rule feature functionalization as the auxiliary. Under the premise of ensuring low latency and deployability, it achieves stable and interpretable recognition of invalid search keywords. Attached Figure Description

[0069] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0070] Figure 1 This is a flowchart of the invention;

[0071] Figure 2 This is the overall structure of the search keyword classification system based on multi-channel feature fusion and semantic prototype constraints in this invention. Detailed Implementation

[0072] The present invention will be further described below with reference to the embodiments, but the scope of protection of the present invention is not limited to the following embodiments.

[0073] A search keyword classification method based on multi-channel feature fusion and semantic prototype constraints includes the following steps;

[0074] Step 1: Acquisition and preprocessing of the search keyword dataset

[0075] The search keyword data used in this invention comes from real web access logs generated during the actual operation of a university website. These logs adopt a standard web server log format and systematically record basic information for each HTTP access request, including the client IP address, access timestamp, request URL, HTTP protocol version, server return status code, and User-Agent field. The log data has been anonymized and de-identified during collection, and does not contain any privacy information that could be used to identify users, thus complying with data security and compliance requirements. The search keywords are real-time input data submitted by the user as HTTP request parameters during the search request phase, independent of page content or user-generated content, and constitute the basic data object for real-time identification of invalid search keywords in this invention.

[0076] First, the raw web access logs are parsed line by line to extract the request path and parameters for each access request. Based on the website system's actual business logic, only access records with the request path {search.php} and explicitly containing the {keyword} field in the request parameters are retained. This is to exclude requests unrelated to user search behavior, such as page access, static resource loading, and statistical counting, thus ensuring that subsequent data processing only originates from real search input scenarios.

[0077] After filtering by request type, the remaining search request URLs are parsed in a structured manner to extract the raw string corresponding to `\texttt{keyword}` in the GET parameters. Since the search keywords recorded in the logs are typically transmitted using URL encoding, where spaces, non-ASCII characters, and Chinese characters are converted to specific escape sequences, directly using the encoded strings for analysis would inevitably introduce character statistical offsets and semantic noise. Therefore, a URL decoding operation is performed on all extracted search keywords to restore the true text form of the user input.

[0078] Subsequently, the decoded search keyword text undergoes normalization preprocessing. This includes: uniformly using UTF-8 encoding for storage, NFKC normalization of full-width and half-width characters, removing leading and trailing whitespace characters from search keywords, and filtering empty strings, pure symbol inputs, and unparseable abnormal records. Through these processes, a consistent character representation of the search keyword text is ensured.

[0079] Furthermore, considering the high frequency of repeated search keywords in real business logs, two views were constructed simultaneously during the data processing phase: firstly, repeated search keywords were retained during the statistical analysis phase to characterize the distribution features of real query behavior; secondly, duplicate search keywords were deduplicated during the model training and evaluation phases to reduce the bias effect of high-frequency samples on the model learning process. Ultimately, a structured and formatted search keyword dataset was obtained, serving as a unified input for subsequent manual annotation, feature modeling, and validity classification.

[0080] To further illustrate the composition and data flow relationships between the functional modules in this invention, the overall architecture of the model in this embodiment is as follows: Figure 2 As shown.

[0081] The overall structure of the invalid search keyword identification system based on multi-channel feature fusion and semantic prototype constraints is presented, enabling real-time keyword identification during the search request phase. The model mainly includes a search keyword acquisition and preprocessing module, a text semantic feature modeling module, a structural pattern feature extraction module, a multi-channel feature fusion module, and a semantic prototype-based discrimination decision module.

[0082] The text semantic channel is used to model the semantic rationality of search keywords. It obtains keyword-level semantic representations through pre-trained language models, sequence augmentation, and attention aggregation, and further constructs semantic prototypes for corresponding categories. The structural pattern channel is used to explicitly model the character composition, structural patterns, and risk attributes of search keywords, outputting independent rule feature representations. In the classification decision stage, the model uses the similarity relationship between semantic representations and semantic prototypes as the primary criterion, and combines structural pattern features to auxiliaryly adjust the judgment results, thereby achieving collaborative judgment of the semantic rationality and structural anomalies of search keywords.

[0083] like Figure 2 As shown, the system takes the original search keyword string as input and flows through the following core processing modules in sequence:

[0084] Step 2: Construction of semantic features and semantic prototypes of search keyword texts

[0085] After acquiring and preprocessing the search keyword dataset, the normalized search keyword text is input into the text semantic channel for semantic feature extraction. The text semantic channel, based on a pre-trained language model, performs contextual encoding on the search keyword sequence to obtain token-level semantic representations. Considering that search keyword texts are typically short and have limited contextual information, relying solely on the output of the pre-trained model is insufficient to fully characterize the local semantic combination patterns within the search keywords. Therefore, a bidirectional sequence modeling mechanism is introduced based on the output of the pre-trained language model to enhance the modeling of the sequential relationships and local structural information within the search keywords.

[0086] Specifically, the search keyword sequence is first encoded by a pre-trained language model (e.g., DeBERTa-v3-small) to obtain a token-level contextual semantic representation. This sequence representation is then input into a bidirectional sequence model to jointly model the forward and backward dependencies of the sequence, thereby obtaining a semantically enhanced sequence representation. Furthermore, through an attention pooling mechanism, the semantic contributions of different tokens are adaptively weighted and aggregated to construct a holistic semantic representation vector at the search keyword level, used to characterize the semantic rationality of the search keywords.

[0087] Given a sequence of search keywords After text semantic channel encoding, the following semantic representation vectors at the search keyword level are obtained:

[0088]

[0089] in, This represents the contextual semantic representation of the i-th token. For the corresponding attention weights, the following conditions must be met: This is a learnable attention parameter vector.

[0090] After obtaining the semantic representation at the search keyword level, based on the category labeling information of the search keywords, the semantic representations of multiple search keywords within the same category are aggregated to construct the semantic prototype representation of the corresponding category. The semantic prototype is obtained by normalizing and aggregating the mean of the semantic representations of samples within the category, and is used to characterize the overall distribution characteristics of the category in the semantic representation space. By introducing the semantic prototype representation, the semantic modeling of search keywords is extended from the sample level to the category level, providing a stable semantic reference for subsequent similarity-based discrimination decisions.

[0091] set up This represents the semantic representation of the i-th search keyword, and its category label is y. i ,

[0092] For category c, its semantic prototype is defined as the normalized mean of the semantic representation of the search keywords for that category:

[0093]

[0094] in, This represents the set of samples corresponding to category c.

[0095] Explanation of the Semantic Prototype Construction and Update Mechanism

[0096] After obtaining the semantic representation at the search keyword level, the semantic prototype construction module aggregates multiple semantic vectors under the same category based on the category labeling information of the keyword to construct the semantic prototype representation of the corresponding category.

[0097] In one embodiment, the semantic prototype is constructed offline: during the model training phase, the semantic representations of search keywords of the same category in the training set are normalized and averaged to obtain the prototype vector of that category in the semantic representation space.

[0098] In another alternative embodiment, the semantic prototype can employ an online or incremental update mechanism: when new samples arrive, the prototype vector is adjusted by a moving average or momentum update to adapt to the dynamic changes in the distribution of search keywords.

[0099] Both of the above methods fall within the protection scope of this invention.

[0100] Step 3: Extracting structural pattern features from search keywords

[0101] This step addresses the challenge of identifying structurally anomalous search keywords by explicitly modeling their character composition, structural patterns, and semantic risks. Specifically, this step employs a hierarchical approach to model Pattern features, characterizing the structurally anomalous properties of search keywords at three levels: character statistics, structural pattern, and semantic risk.

[0102] First, at the character statistics layer, the overall distribution characteristics of search keywords at the character composition level are modeled. The normalized value of the search keyword length and the proportion of different character types (numbers, letters, Chinese characters, and symbols) in the search keywords are statistically analyzed to reflect input patterns with low semantic meaning and high structural anomalies, such as abnormal number strings or random character combinations. This layer's features do not rely on semantic information and are mainly used to provide a coarse-grained characterization of the overall structural anomalies of the search keywords.

[0103] Secondly, at the structural pattern layer, regular expression rules and pattern matching are used to detect whether search keywords contain structural patterns with explicit format constraints, such as URLs, domain name fragments, file paths, email formats, or command-line inputs. Relevant features are represented in binary or normalized count form to explicitly reflect whether search keywords match high-confidence structural anomalies. These features typically possess strong determinism and business interpretability in invalid search keyword identification.

[0104] Secondly, at the semantic risk layer, by matching search keywords with a predefined risk term list or rule set, the hit rate of potentially illegal or high-risk content in the search keywords is statistically analyzed, and a continuous risk score representation is constructed. This layer's features characterize the potential risk level of search keywords, rather than directly providing a judgment result, thus maintaining rule controllability while avoiding overly rigid decision-making methods.

[0105] Through the collaborative modeling of the three layers of rule features, discrete rule information is uniformly mapped into low-dimensional, continuous Pattern feature vectors with clear business meaning. The resulting Pattern representation does not directly participate in the construction of semantic prototypes, but rather, in the subsequent multi-channel feature fusion and classification decision stages, it functionally supplements the deficiencies of text semantic representation in structural anomaly identification, providing stable and reliable auxiliary information for search keyword discrimination based on semantic prototype constraints.

[0106] Step 4: Multi-channel feature fusion and prototype constraint discrimination

[0107] After obtaining the semantic features, semantic prototype representations, and structural pattern features of the search keywords, multi-channel information is fused and modeled. Considering the differences in representation space attributes between textual semantic features and pattern rule features, this step adopts a functionalized multi-channel fusion strategy, clearly defining the roles of different channels. The multi-channel feature fusion adopts a functionalized fusion approach, in which structural pattern features do not participate in the semantic prototype construction process, but only serve as auxiliary signals to adjust the discrimination results based on semantic prototypes.

[0108] Specifically, the semantic features of search keywords serve as the backbone representation to construct a unified semantic representation space and participate in the similarity calculation of semantic prototypes; the structural pattern features output by the Pattern rule channel participate in model reasoning in an independent encoding and auxiliary adjustment manner to enhance the model's ability to perceive structural anomalies and risk patterns, rather than directly participating in the construction process of semantic prototypes.

[0109] In the discrimination phase, the similarity relationship between the semantic representation of the search keyword and the semantic prototypes of each category is first calculated: given the semantic representation h_text of the search keyword to be classified, the cosine similarity between it and the semantic prototypes of each category is calculated:

[0110]

[0111] By comparing the proximity of search keywords to prototypes of different categories in the semantic space, preliminary discrimination results based on semantic distribution are obtained. For a binary classification task (Valid / Invalid), the discrimination score function for search keywords is defined as follows:

[0112]

[0113] Where: m is the discriminant margin between categories, and τ is a temperature coefficient used to adjust the distribution smoothness.

[0114] Building upon this, Pattern regular features are introduced as auxiliary signals to adjust and supplement the semantic similarity discrimination results, thereby improving the model's ability to identify structural anomaly search keywords. Let p_pattern represent the Pattern regular feature vector corresponding to the search keyword, and the final discrimination score can be expressed as:

[0115]

[0116] Where f(·) is a linear or nonlinear mapping function for the pattern features. Learnable adjustment coefficient

[0117] In this way, the classification decision process is transformed into a "similarity comparison between sample semantic representation and category semantic prototype", and the final judgment is completed under the auxiliary constraints of rule features. Thus, while maintaining the stability of the semantic representation space, it achieves collaborative modeling of the semantic rationality and structural anomaly of search keywords, and outputs the effective classification results of search keywords.

[0118] Step 5: Output invalid search keyword identification results and verify the effect.

[0119] After completing the search keyword feature modeling and classification in steps 1 to 4, the validity judgment result and confidence information of each search keyword are output. The judgment result can be used for application scenarios such as search keyword filtering, anomaly detection, log analysis or security auditing.

[0120] In one specific embodiment, the search keyword dataset constructed in step 1 is input into the search keyword classification model based on multi-channel feature fusion and semantic prototype constraints described in steps 2 to 4 to determine the validity of the search keywords. To verify the effectiveness of the technical solution of this invention, the classification results are comprehensively evaluated using evaluation metrics such as accuracy, precision, recall, and F1 score.

[0121] Text Channel Experiment

[0122] To verify the effectiveness and stability of the text semantic feature modeling method adopted in this invention in the search keyword representation space, different text representation models were compared and validated while maintaining the consistency of the classification decision structure. Experimental results show that the text representation method incorporating sequence modeling and attention aggregation mechanisms outperforms the text representation method without enhanced modeling in multiple evaluation metrics, thus providing a more stable and discriminative semantic representation foundation for subsequent classification based on semantic prototypes. The results are shown in Table 1 below:

[0123] Table 1 Experimental results of different text representation models

[0124] Model accuracy Accuracy Recall rate F1 score FastText 0.8970 0.8956 0.9197 0.9075 BERT 0.9603 0.9667 0.9478 0.9399 MiniLM 0.9606 0.9666 0.9609 0.9638 DeBERTA-V3-small 0.9610 0.9677 0.9600 0.9638 DeBERTa-v3-small + BiLSTM + Attention 0.9617 0.9679 0.9615 0.9647

[0125] The experimental results show that the DeBERTa-v3-small + BiLSTM + Attention model outperforms other text classification models in terms of accuracy, precision, recall, and F1 score. Therefore, this model will be used as the text representation model in subsequent decision mechanism experiments.

[0126] Decision-making mechanism experiment

[0127] While maintaining consistency in the semantic representation structure of the text, the performance of different classification decision mechanisms in the invalid search keyword identification task was compared and validated. The comparison included discrimination methods based on parameterized classification heads and those based on semantic prototype similarity. Experimental results show that, compared to methods directly using parameterized classification heads, the classification decision mechanism based on semantic prototype constraints has significant advantages in classification stability and comprehensive evaluation indicators. By introducing scale calibration and inter-category discrimination interval constraints on the basis of prototype similarity discrimination, the distinguishability between semantic prototypes of different categories is further enhanced, improving the overall accuracy of invalid search keyword identification.

[0128] This paper selects the following four representative classification decision mechanisms as comparison objects:

[0129] (1) Linear Head: In the semantic representation of search keywords It directly connects to a linear classification layer and outputs the predicted probability through the Sigmoid function, which is a typical parameterized classification head;

[0130] (2) MLP Head: Based on semantic representation, a multilayer perceptron classification head is introduced to improve the expressive power of decision boundaries through nonlinear mapping;

[0131] (3) Prototype-based (Raw): The cosine similarity between the semantic representation of the search keywords and the semantic prototype of the category is used for direct discrimination without introducing temperature scaling or discrimination interval;

[0132] (4) Prototype + Scaling + Margin (Ours): Based on the prototype similarity discrimination, temperature scaling and discrimination interval constraints are introduced to enhance the distinguishability between semantic prototypes of different categories, which constitutes the classification decision mechanism proposed in this invention.

[0133] Among them, the first two types of methods belong to parameterized classification heads, and the classification boundary is completely determined by the training data and model parameters. However, the semantic prototype-based method does not directly learn the category boundary function, but transforms the classification process into a "similarity comparison between the semantic representation of search keywords and the semantic prototype of the category", thereby achieving decoupling of representation learning and classification discrimination in the decision-making form.

[0134] Table 2 Experimental results for different classifiers

[0135] Model accuracy Accuracy Recall rate F1 score Linear Head 0.9617 0.9679 0.9675 0.9647 MLP Head 0.9613 0.9673 0.9614 0.9644 Prototype-based (Raw) 0.9590 0.9627 0.9622 0.9624 Ours 0.9627 0.9677 0.9660 0.9657

[0136] Table 2 presents the performance comparison results of different classification decision mechanisms on the invalid search keyword identification task. The overall results show that the semantic prototype-based classification decision mechanism exhibits better performance across multiple evaluation metrics. Compared with Linear Head and MLP Head using parameterized classification heads, the Prototype + Scaling + Margin decision mechanism proposed in this invention achieves better or comparable results in metrics such as Accuracy, Recall, and F1-score. Compared with the original prototype discrimination method without introducing scale and margin constraints, by introducing temperature scaling and inter-category discrimination margins, the method of this invention further enhances the discriminability between different categories of semantic prototypes, improving the overall accuracy of search keyword validity identification. These results demonstrate that the semantic prototype-based classification decision mechanism can effectively improve the discrimination effect of invalid search keyword identification while maintaining the stability of the semantic representation space structure, verifying the effectiveness of the proposed decision mechanism design.

[0137] Overall Model Comparison Experiment

[0138] In the task of classifying search keyword validity, the complete technical solution proposed in this invention was compared and verified with several existing search keyword classification models. Experimental results show that the method based on the pre-trained language model outperforms shallow text representation methods overall. Furthermore, by introducing structural pattern feature channels and semantic prototype constraint discrimination mechanisms, the technical solution proposed in this invention further improves in evaluation metrics such as accuracy, precision, recall, and F1 score, verifying the effectiveness and engineering applicability of this invention in complex search keyword scenarios.

[0139] To verify the overall performance of our proposed method in the search keyword validity classification task, we selected several representative search keyword classification models as comparison objects and conducted comparative experiments under the same dataset splitting and evaluation metric settings. The specific comparison models included FastText, BERT, MiniLM, DeBERTa-v3-small, and the complete model proposed in this paper (Ours). Among them, DeBERTa-v3-small, as a strong baseline model using only the text semantic channel, was used to verify the performance improvement effect after introducing multi-channel features and semantic prototype constraints.

[0140] The specific experimental results are shown in Table 3 below:

[0141] Table 3 Experimental results of different search keyword classification models

[0142] Model accuracy Accuracy Recall rate F1 score FastText 0.8970 0.8956 0.9197 0.9075 BERT 0.9606 0.9667 0.9608 0.9638 MiniLM 0.9606 0.9661 0.9614 0.9638 DeBERTA-V3-small 0.9610 0.9660 0.9624 0.9642 Ours 0.9673 0.9790 0.9693 0.9705

[0143] Table 3 shows the overall performance comparison results, indicating that the pre-trained language model-based method outperforms shallow models such as FastText, demonstrating the significant advantage of deep semantic modeling in keyword validity discrimination. Furthermore, the proposed complete model achieves optimal results in Accuracy, Precision, Recall, and F1-score. Compared to DeBERTa-v3-small, which only uses text semantic channels, the model further improves overall discrimination performance by introducing Pattern rule channels and semantic prototype constraint mechanisms. Experimental data show that the present invention achieves a recall rate of 0.9693 for structurally anomalous samples, an improvement of 3.5%-4.8% compared to conventional fusion methods. The false positive rate for normal samples is only 0.008, a reduction of 33%-46% compared to conventional fusion methods. These results ultimately validate the effectiveness of the proposed model.

[0144] The above examples illustrate the present invention only to aid in understanding it and are not intended to limit the scope of the invention. Those skilled in the art can make various simple deductions, modifications, or substitutions based on the ideas of this invention.

Claims

1. A real-time method for identifying the validity of search keywords based on multi-channel feature fusion and semantic prototype constraints, characterized in that, Includes the following steps: Step S1: During the Web search request processing, the search keywords to be identified are obtained in real time, and the search keywords are preprocessed to obtain standardized search keyword text; Step S2: Input the normalized search keyword text obtained in Step S1 into the text semantic channel, and use the pre-trained language model combined with sequence enhancement and attention aggregation mechanism to extract the semantic representation vector of the search keyword level; at the same time, based on the category labeling information, aggregate multiple semantic representation vectors of the search keyword level under the same category to construct the semantic prototype representation of the corresponding category. Step S3: Input the normalized search keyword text obtained in Step S1 into the structure pattern channel, extract features from three levels: character statistics layer, structure pattern layer and semantic risk layer, and generate structure pattern feature vector; Step S4: Discrimination based on functional fusion strategy: Calculate the similarity between the search keyword-level semantic representation vector obtained in step S2 and the semantic prototype representation to obtain a preliminary discrimination score, and use the structural pattern feature vector generated in step S3 to adjust the preliminary discrimination score to obtain the final discrimination score; Step S5: Output the validity identification result of the search keywords based on the final discrimination score obtained in step S4.

2. The method according to claim 1, characterized in that, In step S2, the specific process of extracting the semantic representation vector at the search keyword level includes: The normalized search keyword text is encoded using a pre-trained language model to obtain a token-level contextual semantic representation; The token-level context semantic representation is input into a bidirectional sequence model to jointly model the forward and backward dependencies of the sequence, resulting in a semantically enhanced sequence representation. By using the attention pooling mechanism, the semantic contributions of different tokens in the semantically enhanced sequence representation are adaptively weighted and aggregated to generate the search keyword-level semantic representation vector.

3. The method according to claim 1, characterized in that, In step S2, the specific process of constructing the semantic prototype representation of the corresponding category includes: For category c, obtain the set of semantic representation vectors of all search keywords under that category; The semantic representation vectors in the set are normalized and the mean is calculated to obtain the semantic prototype representation of the category. in, This represents the semantic representation of the i-th search keyword, and its category label is y. i , This represents the set of samples corresponding to category c; Alternatively, an online or incremental update mechanism can be used to adjust the prototype vector by moving average or momentum update when new samples arrive.

4. The method according to claim 1, characterized in that, In step S3, the extraction of the structural pattern feature vector specifically includes: In the character statistics layer, the normalized value of the length of the search keywords is calculated, as well as the proportion of different character types such as numbers, letters, Chinese characters and symbols in the search keywords; At the structural pattern layer, regular expression rules and pattern matching are used to detect whether the search keywords contain URLs, domain name fragments, file paths, email formats, or imperative inputs, and these are represented in binary or normalized count form. In the semantic risk layer, search keywords are matched with a predefined risk vocabulary or rule set to count the hits of potentially illegal or high-risk content and construct a continuous risk score representation. The above three layers of features are spliced ​​or merged to form the structural pattern feature vector Pattern.

5. The method according to claim 1, characterized in that, In step S4, the discrimination based on the functional fusion strategy specifically includes: Calculate the semantic representation vector of the search keyword level. semantic prototypes of each category Cosine similarity between them; A preliminary discrimination score function based on semantic distribution is defined, and the inter-class discrimination interval m and temperature coefficient τ are introduced to adjust the distribution smoothness. A structural pattern feature vector (Pattern) is introduced as an auxiliary signal to adjust and supplement the semantic similarity discrimination result; let p_pattern represent the pattern rule feature vector corresponding to the search keyword, and the final discrimination score is expressed as: Where f(·) is a linear or nonlinear mapping function for the structural pattern feature vector Pattern. β The learnable adjustment coefficient is used to control the adjustment strength of structural features on semantic discrimination; by limiting structural pattern features to only adjust semantic similarity scores without participating in semantic space construction, the functions of semantic discrimination and structural perception are decoupled.

6. The method according to any one of claims 1 to 5, characterized in that, In step S1, the preprocessing includes: Filter access records from the web access logs whose request path is the search interface and contains keyword parameters; extract the raw string from the GET parameters and perform URL decoding; The decoded text is stored using UTF-8 encoding, NFKC normalization is performed on full-width and half-width characters, leading and trailing whitespace characters are removed, and empty strings and pure symbol inputs are filtered out.

7. A real-time search keyword validity recognition system based on multi-channel feature fusion and semantic prototype constraints, used to implement the method as described in any one of claims 1 to 6, characterized in that, include: The data acquisition and preprocessing module is used to acquire the search keywords to be identified in step S1, and to perform URL decoding and normalization preprocessing to obtain normalized search keyword text. The text semantic feature modeling module is used in step S2 to input the normalized search keyword text into the text semantic channel, extract the search keyword-level semantic representation vector, and construct the semantic prototype representation of the corresponding category; The structural pattern feature extraction module is used in step S3 to input the standardized search keyword text into the structural pattern channel, extract features from three levels: character statistics, structural pattern and semantic risk, and generate a structural pattern feature vector. The multi-channel feature fusion and discrimination module is used in step S4 to calculate the similarity between the search keyword-level semantic representation vector and the semantic prototype representation, and to adjust the similarity discrimination result using the structural pattern feature vector, and output the final discrimination score. The result output module is used in step S5 to output the validity identification result of the search keywords based on the final discrimination score.

8. The system according to claim 8, characterized in that, The text semantic feature modeling module includes: The pre-trained encoding unit is used to perform token-level encoding of the input text using a pre-trained language model; the sequence augmentation unit is used to model the forward and backward dependencies of the encoding results using a bidirectional sequence model. Attention aggregation unit, used to aggregate sequence representations through attention mechanism to generate keyword-level semantic representation vectors; The prototype building unit is used to perform normalized mean aggregation or incremental update on the semantic representation vectors of similar samples based on category labels to generate semantic prototypes.

9. The system according to claim 8, characterized in that, The structural pattern feature extraction module includes: The character statistics unit is used to calculate the proportion of character types and the normalized length value; The pattern matching unit is used to detect URLs, file paths, and abnormal formats using regular expression rules; Risk scoring unit, used to generate continuous risk scores based on risk vocabulary matching; The feature fusion unit is used to integrate the features output by the above units into a continuous structural pattern feature vector.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Production management and control system and method based on business intelligence, computer and medium

    CN117252534A