Searching method and system based on computer natural language processing
By using semantic knowledge graphs and deep learning models to generate semantic vectors, combining query logs to analyze user intentions, and using dynamic sharding and cross-shashing graph attention networks, the problems of semantic association breakage and intention drift in traditional search technology are solved, and efficient and accurate search result generation is achieved.
Patent Information
- Application Number
- CN202510636434.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-17
- Publication Date
- 2025-08-29
AI Technical Summary
Traditional search technology cannot effectively capture the implicit semantics and contextual associations of user queries, lacks domain knowledge guidance, ignores the dynamic drift characteristics of intentions, and static sharding strategy leads to semantic association breaks and lacks cross-modal knowledge fusion.
The preset semantic knowledge graph is used to extract the synonyms and contextual relationships of the query text to generate semantic vectors; analyze user search intentions based on the historical behavior feature sequence of the query log; filter information matching sets through the semantic matching algorithm; use context-aware dynamic sharding algorithm to process information; use cross-shash graph attention network for semantic aggregation and dynamic projection to generate search results.
It realizes efficient and accurate search in complex semantic scenarios, improves search accuracy and system response speed, and solves the problems of semantic gap, intention recognition deviation and distributed retrieval efficiency in traditional search technology.
Smart Images

Figure CN120561300A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer science and information technology, and in particular relates to a search method and system based on computer natural language processing. Background Art
[0002] With the rapid development of natural language processing and information retrieval technologies, intelligent search methods based on semantic understanding have become a research hotspot. Traditional search technologies primarily rely on keyword matching and inverted indexing, performing document retrieval through word frequency statistics or Boolean logic. However, these methods suffer from a semantic gap, meaning they are unable to effectively capture the implicit semantics and contextual associations of user queries. With the introduction of deep learning, neural network-based semantic vector generation methods have been gradually applied to the search field, computing semantic similarity by mapping text into a low-dimensional vector space. However, traditional semantic matching methods lack domain knowledge guidance, making them particularly limited in terms of specialized terminology, synonym expansion, and polysemy resolution. For example, in the medical field, searching for myocardial infarction treatment options without integrating the medical knowledge graph to expand synonyms and associated symptoms can miss key information. Traditional methods for analyzing user intent typically employ statistical modeling based on click behavior in query logs or employ shallow neural networks to extract behavioral features. However, these methods ignore the dynamic drift of intent. For example, a user's intent for the same query term, such as Python, may shift from learning the programming language to downloading crawler tools over different time periods. Traditional static modeling methods have difficulty capturing such temporal changes, leading to biased intent recognition. For large-scale data retrieval, traditional distributed indexing technology, namely static sharding strategies, divides data based on document IDs or hash values. However, in semantic search scenarios, static sharding can lead to broken semantic associations. For example, documents related to artificial intelligence may be scattered across multiple shards, and cross-shard semantic aggregation is inefficient, affecting the relevance ranking of search results. In addition, existing semantic matching algorithms focus more on the surface semantics of text and lack cross-modal knowledge fusion. For example, when searching for new energy vehicle battery technology, failing to combine multi-source data such as technical patents and academic papers in the knowledge graph may result in search results being limited to news reports and lacking in-depth professional content. Summary of the Invention
[0003] Based on this, it is necessary to provide a search method and system based on computer natural language processing that can solve the above problems.
[0004] In a first aspect, the present application provides the above-mentioned search method based on computer natural language processing, comprising:
[0005] Use the preset semantic knowledge graph to extract synonym sets and contextual relationships of keywords in the query text, and use the deep learning model to generate semantic vectors;
[0006] Based on semantic vectors, historical behavior feature sequences are extracted from query logs, and the user search intent is analyzed using the attention mechanism model.
[0007] Based on the search intent, a semantic matching algorithm is used to perform semantic similarity matching on the pre-built database to obtain an information matching set that meets the preset similarity threshold;
[0008] Use context-aware dynamic sharding algorithm to perform distributed processing on information matching sets and generate index sharding clusters;
[0009] The cross-shard graph attention network is used to semantically aggregate the index shard clusters, and a search result set is generated after dynamic semantic projection.
[0010] In one embodiment, a preset semantic knowledge graph is used to extract synonym sets and contextual relationships of keywords in the query text, and a deep learning model is used to generate semantic vectors, including:
[0011] Extract the temporal semantic features of the query text through a bidirectional sequence encoder;
[0012] Utilize the preset semantic knowledge graph to extract synonym sets and contextual association relationships of keywords in the temporal semantic features within the same semantic space, and generate extended semantic features;
[0013] The extended semantic features are semantically fused using a multi-layer Transformer encoder to generate a semantic vector carrying the semantic dimension weight identifier.
[0014] In one embodiment, a multi-layer Transformer encoder is optimized using a contrastive loss function with the following interpretability constraint:
[0015]
[0016] in, Represents the semantic vector of the i-th keyword, P i represents the positive sample set, N i represents the negative sample set, v n ∈N i Represents the negative sample semantic vector, v p ∈P i represents the positive sample semantic vector, Indicates cosine similarity calculation, represents the interpretability scaling factor, represents the expected value of the similarity of positive samples, It represents the expected value of the similarity of negative samples.
[0017] In one embodiment, based on semantic vectors, historical behavior feature sequences are extracted from query logs, and the user search intent is analyzed using an attention mechanism model, including:
[0018] Extract historical behavior feature sequences from query logs, including user click heat distribution, result switching frequency, and deep interaction duration, to form a user behavior feature tensor set;
[0019] Perform cross-attention weight assignment on the semantic vector and the user behavior feature tensor to generate an attention-enhanced spatiotemporal joint feature representation;
[0020] Attention-enhanced spatiotemporal joint feature representation uses a long short-term memory network to capture the drifting characteristics of intent in the temporal dimension;
[0021] Multi-scale feature extraction of intent drift features is performed through a temporal convolutional network to generate user search intent with temporal change confidence annotations.
[0022] In one embodiment, when performing cross-attention weight assignment on the semantic vector and the user behavior feature tensor, the following formula is used:
[0023]
[0024] in, represents the semantic vector, d v represents the semantic space dimension, represents the three-dimensional user behavior feature tensor, T represents the time step, L represents the feature level, d h represents the hidden layer dimension, represents the trainable attention projection matrix, represents the adaptive temperature coefficient, E represents the expected calculation of the sliding window, represents the adaptive activation function.
[0025] In one embodiment, based on the search intent, a semantic matching algorithm is used to perform semantic similarity matching on a pre-built database to obtain an information matching set that meets a preset similarity threshold, including:
[0026] Extract professional terms from the domain knowledge information base associated with the preset semantic knowledge graph, and use the knowledge enhancement model to integrate them with the user's search intent to generate an enhanced intent vector;
[0027] Based on the enhanced intent vector, the node association path of the graph neural network is used to generate a candidate result set;
[0028] The similarity between the candidate result set and the enhanced intent vector is calculated, and the candidate results with scores greater than the preset threshold are filtered to form an information matching set.
[0029] In one embodiment, the following formula is used to calculate the similarity between the candidate result set and the enhanced intent vector:
[0030]
[0031] Among them, s(u) represents the similarity score, represents the embedding vector of node u, v enh represents the enhanced intention vector, λ represents the cross-modal fusion coefficient, Represents a symmetric distribution similarity measure, parameter KL represents relative entropy, P text (u) represents the text semantic distribution of node u, P graph (u) represents the graph structure distribution of node u.
[0032] In a second aspect, the present application also provides a search system based on computer natural language processing, comprising:
[0033] The semantic parsing module is used to extract synonym sets and contextual relationships of keywords in the query text using a preset semantic knowledge graph, and generate semantic vectors using a deep learning model;
[0034] The intent analysis module is used to extract historical behavior feature sequences from query logs based on semantic vectors and analyze user search intent using an attention mechanism model.
[0035] The semantic retrieval module is used to perform semantic similarity matching on the pre-built database based on the search intent using a semantic matching algorithm to obtain an information matching set that meets a preset similarity threshold;
[0036] The index optimization module is used to perform distributed processing on the information matching set based on the context-aware dynamic sharding algorithm to generate index sharding clusters;
[0037] The result generation module is used to perform semantic aggregation on the index shard cluster using the cross-shard graph attention network, and generate a search result set after dynamic semantic projection.
[0038] In a third aspect, the present application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned search method based on computer natural language processing are implemented.
[0039] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned search method based on computer natural language processing are implemented.
[0040] The above-mentioned search method, system, computer device and storage medium based on computer natural language processing extract the synonym set and contextual association relationship of keywords through the semantic knowledge graph, and combine deep learning to generate multi-dimensional semantic vectors, effectively solving the semantic gap problem of traditional keyword matching; based on the joint modeling of query log historical behavior characteristics and attention mechanism, dynamic perception and accurate capture of user search intentions are realized; further through semantic similarity matching screening and context-aware dynamic sharding technology, distributed retrieval efficiency is optimized while ensuring the integrity of semantic associations; relying on the semantic aggregation and dynamic projection mechanism of the cross-shard graph attention network, efficient integration of multi-source heterogeneous data and accurate generation of search results are realized, thereby improving search accuracy and system response speed in complex semantic scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 This is a flow chart of a search method based on computer natural language processing of the present invention;
[0043] Figure 2 This is a structural diagram of a search system based on computer natural language processing according to the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0045] The present application discloses a search method and system based on computer natural language processing, which is applied to a terminal device and server cluster architecture: the terminal device is used to input queries, collect interactive data, and display results; the server cluster includes an application server for deploying semantic processing and sorting algorithms, and a distributed storage cluster for storing knowledge graphs, historical data, and retrieval information. When a user initiates a search request through a terminal, the terminal transmits the query text and interactive data to the application server. The application server calls the semantic knowledge graph and historical interactive data in the distributed storage, generates semantic vectors through natural language processing, analyzes user intent, and then retrieves relevant information from the distributed storage in parallel based on the intent. After sorting, it returns to the terminal for display, thus realizing efficient and accurate semantic search interaction in multi-terminal scenarios.
[0046] In one embodiment, Figure 1 As shown, a search method based on computer natural language processing is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0047] S101, using a preset semantic knowledge graph to extract synonym sets and contextual association relationships of keywords in the query text, and using a deep learning model to generate semantic vectors.
[0048] Among them, a bidirectional sequence encoder can be used to perform word segmentation and entity recognition on the query text, extract core keywords, and obtain temporal semantic features that include word order and contextual dependencies. The preset semantic knowledge graph is a database containing a large amount of semantic relationships and knowledge, covering various words, concepts, and the relationships between them. Using the preset semantic knowledge graph, a set of synonyms for the keywords in the same semantic space is found, and the contextual relationships between these keywords are clarified to generate extended semantic features. Deep learning models such as multi-layer Transformer encoders can be used to further process the extended semantic features to generate semantic vectors. The semantic vectors obtained in this way can more accurately represent the comprehensive semantics of the query text.
[0049] S102, based on the semantic vector, extracts the historical behavior feature sequence from the query log, and uses the attention mechanism model to analyze and obtain the user's search intention.
[0050] Query logs comprehensively record various user behaviors during the search process. Historical behavioral feature sequences can be extracted from three dimensions: click heat distribution, result switching frequency, and in-depth interaction duration. These sequences are then integrated to form a historical behavioral feature sequence. The attention mechanism model can be a long-short-term memory network and a temporal convolutional network. The long-short-term memory network captures the intention drift characteristics of the historical behavior feature sequence, and the temporal convolutional network performs multi-scale feature extraction. Convolution operations are performed on features at different time scales to generate user search intent, representing the direction of the user's information needs. Through these steps, user historical behavior data and semantic vector information are deeply mined to accurately analyze user search intent.
[0051] S103 , based on the search intent, a semantic matching algorithm is used to perform semantic similarity matching on the pre-built database to obtain an information matching set that meets a preset similarity threshold.
[0052] The semantic matching algorithm can understand the semantic content of the text, perform a semantic comparison between the search intent and the data in the pre-built database, and filter out information that matches the search intent from the pre-built database. For example, for the search intent of "apple", if the database stores information related to Apple products such as iPhones and apples, the semantic matching algorithm can determine the degree of semantic relevance of this information to the search intent of "apple". By traversing the data in the database, calculating the semantic similarity between each piece of data and the search intent one by one, and analyzing factors such as the semantic features of the text and contextual relationships, the degree of similarity between the two is determined. Based on the preset similarity value threshold, data with a similarity score exceeding the threshold is filtered to form an information matching set, which contains information that is semantically close to the user's search intent and meets certain matching criteria. This provides preliminary data screening for the subsequent generation of search results and reduces the amount of data to be processed.
[0053] S104: Distributed processing is performed on the information matching set using a context-aware dynamic sharding algorithm to generate an index sharding cluster.
[0054] Among them, the context-aware dynamic sharding algorithm dynamically divides data based on the contextual semantics of the information. For example, when processing information matching sets on the development trends of artificial intelligence, data with closely related semantics, such as artificial intelligence technology innovation and market application growth trends, are divided into the same index shard even if they are not originally stored adjacently, thereby ensuring the integrity of the semantic association. Through distributed processing, large-scale information matching sets are distributed to multiple nodes for storage and management. During the processing process, the data is divided into different subsets according to their contextual semantic relationships, and each subset is an index shard. The index shards together form an index shard cluster. Through processing, the efficiency of data storage and retrieval is improved, and different nodes can process the data of their own shards in parallel. This ensures that in subsequent semantic aggregation, information related to the search intent can be quickly obtained from the associated index shards, providing strong support for generating high-quality search results.
[0055] S105, using the cross-shard graph attention network to semantically aggregate the index shard clusters, and generate a search result set after dynamic semantic projection.
[0056] The cross-shard graph attention network is a specialized neural network architecture designed to process semantic relationships between data distributed across different shards. It considers connections between shards within an index shard cluster and aggregates semantically related data from different shards. This attention mechanism automatically focuses on information that is more relevant to the current search intent. For example, when searching for AI applications in healthcare, the network will focus on data related to AI technology and healthcare applications across different shards and integrate this semantically related data, allowing related information to be interconnected and complemented, forming a more complete semantic representation. Dynamic semantic projection transforms and maps semantic information according to specific rules. Based on the search intent and the characteristics of the current data, it dynamically adjusts the projection method to transform the integrated semantic information into a form suitable for user presentation. Dynamic semantic projection transforms the aggregated semantic information into specific search results, organizes them into a set, and ranks them based on factors such as relevance and importance. Results that better match the search intent and provide more comprehensive and accurate information are prioritized, presenting users with an organized set of search results that meets their search needs.
[0057] The above-mentioned search method based on computer natural semantic processing uses a preset semantic knowledge graph to extract synonym sets and contextual associations of keywords in the query text, and generates semantic vectors with the help of a deep learning model, which effectively makes up for the defect that traditional keyword matching cannot capture implicit semantics and contextual associations, and solves the semantic gap problem; based on the semantic vector, historical behavior feature sequences are extracted from the query log, and the attention mechanism model is used to analyze the user's search intention, which can better capture the dynamic drift characteristics of the intention and achieve accurate intention recognition; based on the search intention, the semantic matching algorithm is used to perform semantic similarity matching on the pre-built database to find the information matching set that meets the threshold; the context-aware dynamic sharding algorithm is used to perform distributed processing to generate index shard clusters, avoiding the semantic association break caused by traditional static sharding and optimizing the distributed retrieval efficiency; the cross-shard graph attention network is used to perform semantic aggregation on the index shard cluster, and a search result set is generated through dynamic semantic projection, realizing the efficient integration of multi-source heterogeneous data, and improving the accuracy of search and system response speed in complex semantic scenarios.
[0058] In one embodiment, a preset semantic knowledge graph is used to extract synonym sets and contextual relationships of keywords in the query text, and a deep learning model is used to generate semantic vectors, including:
[0059] S201, extracting temporal semantic features of the query text through a bidirectional sequence encoder;
[0060] S202, using a preset semantic knowledge graph to extract synonym sets and contextual association relationships of keywords in the temporal semantic features within the same semantic space, and generate extended semantic features;
[0061] S203: Use a multi-layer Transformer encoder to perform semantic fusion on the extended semantic features to generate a semantic vector carrying a semantic dimension weight identifier.
[0062] Specifically, the bidirectional sequence encoder can analyze the query text simultaneously in both forward and backward directions. In natural language, the meaning of a word often depends on its surrounding context. For example, the phrase "an apple fell from a tree" and the phrase "I like to eat apples" have different meanings in different contexts. Forward analysis allows the model to learn the semantic dependencies between words from the beginning to the end, while backward analysis captures the semantic connections from the end to the beginning. This fully captures the semantic information of each word in the text at different time steps—that is, the sequential position of the words in the text—and extracts temporal semantic features that encompass both word order and contextual dependencies, laying the foundation for further understanding of the text's semantics. After obtaining the temporal semantic features of the query text, keywords are identified from these features. For example, "car" and "engine" are keywords. Using the semantic knowledge graph, synonyms for these keywords can be found within the same semantic space, such as "car" and "motor vehicle." Furthermore, contextual connections between keywords can be identified, such as "car" associated with tires and seats, and "engine" associated with fuel and pistons. These synonyms and associations are integrated into the original temporal semantic features to generate extended semantic features, enriching the semantic information and providing a deeper understanding of the query's meaning. The multi-layer Transformer encoder (a deep learning encoder based on self-attention that converts input sequences such as text and images into high-dimensional vector representations rich in contextual information) utilizes techniques such as multi-head attention to perform weighted fusion of information from different semantic dimensions within the extended semantic features. Different semantic information, such as keywords, synonyms, and contextual information, plays varying roles in representing the query's semantic meaning. The Transformer encoder automatically learns and assigns appropriate weights to these different semantic dimensions. For example, for the query "battery technology for electric vehicles," when generating a semantic vector, semantic information related to battery technology is given a higher weight. After weighted fusion, a semantic vector is generated that carries semantic dimension weights, reflecting the importance of different semantic information within the overall semantic vector. This allows the semantic vector to more accurately represent the query's comprehensive semantics, providing strong support for operations such as search intent analysis and semantic matching.
[0063] In one embodiment, at S301 , a multi-layer Transformer encoder is optimized using a contrastive loss function with the following interpretability constraints:
[0064]
[0065] in, Represents the semantic vector of the i-th keyword, P i represents the positive sample set, N i represents the negative sample set, v n ∈N i Represents the negative sample semantic vector, v p ∈P i represents the positive sample semantic vector, Indicates cosine similarity calculation, represents the interpretability scaling factor, represents the expected value of the similarity of positive samples, It represents the expected value of the similarity of negative samples.
[0066] For example, the semantic vector of the i-th keyword It carries the semantic information of the corresponding keywords and is a numerical representation of the semantics of the keywords in the query text. i It is a set of samples that are artificially set or filtered through certain rules and have similar semantics to the i-th keyword and meet specific semantic associations. For example, when searching for apple-related content, the positive sample set may contain semantic vectors corresponding to texts closely related to apple semantics, such as Red Fuji apples and apple nutritional value, to provide positive semantic matching references. i It is a set of samples with a large semantic difference from the i-th keyword. For the keyword apple, the negative sample set may contain semantic vectors corresponding to texts that are not related to apple semantics, such as Apple stock and Android phones. It is used to compare and distinguish irrelevant semantics and strengthen the model's ability to judge correct semantics. Negative sample semantic vector v n ∈N i And the positive sample semantic vector v p ∈P i Participate in the cosine similarity calculation to measure the similarity with the semantic vector of the i-th keyword, and reflect the cosine similarity calculation of the difference between the positive sample and the negative sample and the semantic vector of the target keyword. It is used to calculate the similarity between two vectors a and b. By calculating the cosine similarity between the semantic vector of the i-th keyword and the semantic vectors of the positive and negative samples, the degree of semantic similarity between them is determined. The closer the similarity value is to 1, the more similar the semantics of the two vectors are; the closer it is to -1, the greater the semantic difference is. It provides a quantitative indicator for measuring the semantic relevance between samples and keywords. The expected value of positive sample similarity and the expected value of negative sample similarity are calculated, and the similarity calculation results are scaled to make the model training more stable and interpretable, balance the influence of positive and negative samples in the loss function, and avoid excessive dominance of one type of sample on the model training. The expected value of negative sample similarity is obtained by averaging the similarity between the semantic vector of the i-th keyword and the semantic vectors of all samples in the positive sample set, reflecting the model's overall understanding of the semantic similarity between the positive sample and the keyword under the current training state. Similar to the expected value of positive sample similarity, this is the average similarity between the semantic vector of the i-th keyword and the semantic vectors of all samples in the negative sample set. It reflects the model's overall judgment of the degree of semantic difference between the negative sample and the keyword.
[0067] In one embodiment, based on semantic vectors, historical behavior feature sequences are extracted from query logs, and the user search intent is analyzed using an attention mechanism model, including:
[0068] S401, extracting historical behavior feature sequences including three dimensions, namely, user click heat distribution, result switching frequency, and deep interaction duration, from the query log to form a user behavior feature tensor set;
[0069] S402, performing cross-attention weight assignment on the semantic vector and the user behavior feature tensor to generate an attention-enhanced spatiotemporal joint feature representation;
[0070] S403, based on attention-enhanced spatiotemporal joint feature representation, uses long short-term memory networks to capture the drifting characteristics of intentions in the temporal dimension;
[0071] S404: Perform multi-scale feature extraction on the intent drift feature through a temporal convolutional network to generate user search intent with a temporal change confidence annotation.
[0072] Specifically, query logs record various user behaviors during the search process. User click heat distribution reflects the level of user attention paid to different search results. For example, when searching for recommended tourist attractions, frequent clicks on descriptions of certain attractions indicate that these attractions are of particular interest. Result switching frequency reflects user satisfaction with the search results and their desire to explore more information. Frequent switching suggests that the currently displayed content may not meet their needs. Deep interaction duration indicates the depth of user interaction with search results. If a user spends a significant amount of time browsing a result page, it indicates that the result is highly engaging or that the user is deeply engaged in the content. Information from these three dimensions is extracted from query logs and organized into a user behavior feature tensor set according to a specific structure. This comprehensively records historical user behavior patterns and provides a data foundation for subsequent analysis. When performing cross-attention weight allocation, the attention projection matrix can be trained to automatically learn and assign weights based on the characteristics of the semantic vector and the user behavior feature tensor. Adaptive temperature coefficients and adaptive activation functions dynamically adjust the sensitivity and method of weight calculation. This allows the model to focus on interrelated and important information in the semantic vector and the behavior feature tensor, generating an attention-enhanced spatiotemporal joint feature representation that fuses semantic and behavioral information in both spatiotemporal dimensions, providing features for capturing user search intent. Long Short-Term Memory (LSTM) networks (LSTMs) possess memory capabilities and can handle long-term dependencies in time series data. Based on the generated spatiotemporal joint feature representation, LSTMs can capture changes in user intent at different time points, known as intent drift. For example, a user may initially search for fitness and want to learn about exercise methods, but later, when they look at fitness equipment, their intent shifts. The LSTM network memorizes these temporal variations, accurately capturing the evolution of user intent over time and improving the accuracy of search intent analysis. A temporal convolutional network (TCN) performs multi-scale feature extraction on the intent drift features output by the LSTM network. The TCN performs convolution operations at different time scales, such as focusing on recent changes in user search behavior at short time scales and analyzing long-term search preference trends at longer time scales. This multi-scale analysis mines richer feature information and generates user search intent with confidence annotations for temporal variations. The confidence annotations reflect the model's degree of certainty in the inferred search intent, facilitating subsequent sorting and filtering of search results by confidence, thereby improving the relevance and reliability of search results.
[0073] In one embodiment, in S501, when performing cross-attention weight allocation on the semantic vector and the user behavior feature tensor, the following formula is used:
[0074]
[0075] in, represents the semantic vector, d v represents the semantic space dimension, represents the three-dimensional user behavior feature tensor, T represents the time step, L represents the feature level, dh represents the hidden layer dimension, represents the trainable attention projection matrix, represents the adaptive temperature coefficient, E represents the expected calculation of the sliding window, represents the adaptive activation function.
[0076] Specifically, the semantic vector Carrying the semantic information of the text, determining the semantic direction of the model's attention, the semantic space dimension d v It depends on how the deep learning model constructs the semantic vector. It defines the number of dimensions in the space where the semantic vector resides. Different dimensions represent semantic information from different aspects. For example, in a three-dimensional semantic space, each dimension represents a different semantic feature, such as the theme, emotion, and entity relationship, which determines the complexity and expressiveness of the semantic vector. It is constructed from user behavior data extracted from query logs. T represents the time step, which records the temporal sequence information of user behavior, such as the user's search and click operations at different times. L represents the feature level, which is used to distinguish different types of behavioral features, such as click heat distribution, result switching frequency, and deep interaction duration. h The hidden layer dimension is an internal parameter set during the model's processing of behavioral features, which determines the model's ability to abstract and represent behavioral features. The three-dimensional user behavior feature tensor comprehensively records the user's historical behavior patterns, providing a behavioral data foundation for analyzing user search intent. Trainable attention projection matrix The result of continuous adjustment and optimization during the model training process is to map the semantic vector and the user behavior feature tensor to the same space so that the two can be effectively associated and calculated. Through learning, the potential connection between the semantic vector and the behavior feature tensor is found, providing a key transformation for the subsequent calculation of the attention weight. For example, if the semantic vector and the behavior feature tensor cannot be directly compared in the initial state, the trainable attention projection matrix will transform them to make them comparable, thereby determining which behavior features are more relevant to the semantic vector. Adaptive temperature coefficient It is obtained based on the result of the sliding window expectation calculation E. The sliding window expectation calculation is the calculation of the user behavior feature tensor within a certain time window. The adaptive temperature coefficient τ is used to adjust the focus in the attention weight calculation process. When τ is large, the model has a low degree of discrimination between different behavioral features, and the attention is relatively scattered; when τ is small, the model has a high degree of discrimination between different behavioral features, and the attention is more focused on behavioral features that are more relevant to the semantic vector. According to the dynamic changes in user behavior, the degree of refinement of attention allocation is adaptively adjusted. The sliding window expectation calculation E can dynamically consider the user's recent behavioral change trends, rather than relying solely on behavioral data in a fixed time period. For example, when calculating the adaptive temperature coefficient τ, the sliding window expectation calculation adjusts the value of τ in real time based on the changes in the user behavior feature tensor near the current time point, making the model more sensitive to changes in user behavior. Adaptive activation function This function performs nonlinear transformations on weighted calculation results, enhancing the model's expressive power and enabling it to learn more complex relationships. By combining logarithmic and exponential operations on the input values, the adaptive activation function can convert linear weighted results into attention weights that are more realistic. For example, it can map linear values within a certain range to a more discriminative range, highlighting important behavioral features and suppressing unimportant ones, accurately reflecting the correlation between semantic vectors and user behavioral characteristics.
[0077] In one embodiment, based on the search intent, a semantic matching algorithm is used to perform semantic similarity matching on a pre-built database to obtain an information matching set that meets a preset similarity threshold, including:
[0078] S601, extracting professional terms from the domain knowledge information base associated with the preset semantic knowledge graph, and integrating them with the user's search intent using a knowledge enhancement model to generate an enhanced intent vector;
[0079] S602, based on the enhanced intent vector, using the node association path of the graph neural network to generate a candidate result set;
[0080] S603: Calculate the similarity between the candidate result set and the enhanced intent vector, and filter the candidate results with scores greater than a preset threshold to form an information matching set.
[0081] Specifically, the domain knowledge database associated with the pre-built semantic knowledge graph contains specialized knowledge and terminology in a specific field. For example, in the medical field, this database may contain specialized terms such as disease names, treatment methods, and drug names. After extracting these specialized terms, the knowledge enhancement model is used to integrate these terms with the user's search intent. The knowledge enhancement model analyzes the semantic relationships between specialized terms and the user's search intent and integrates them. For example, if the user's search intent is for diabetes treatments, specialized terms such as insulin therapy and diet control are extracted from the domain knowledge database. The knowledge enhancement model combines these terms with the user's search intent to generate an enhanced intent vector. This vector not only contains the user's original search intent but also incorporates domain knowledge, making the intent more accurate and comprehensive. Graph neural networks are neural network models specialized for processing graph-structured data. In this scenario, the information in the pre-built database can be viewed as nodes in the graph, and the relationships between nodes, such as semantic and logical associations, can be represented by edges. The enhanced intent vector acts as a guide, guiding the graph neural network to find relevant nodes in the graph. For example, for the enhanced intent vector for diabetes treatments, the graph neural network follows the node-association path and finds information nodes related to diabetes treatment, such as introductions to different treatments and the latest research findings. The information represented by these found nodes constitutes the candidate result set, which is the information that is preliminarily screened out and may be related to the user's search intent. To calculate the similarity between the candidate result set and the enhanced intent vector, a variety of methods can be used, such as cosine similarity, Euclidean distance, etc., to measure the semantic proximity between the candidate results and the enhanced intent vector. A threshold is set based on historical experience or data as a criterion for judging whether the candidate results are sufficiently similar to the user's search intent. For example, if the threshold is set to 0.7, only candidate results with a similarity score greater than 0.7 with the enhanced intent vector can be screened out, forming an information matching set together. This set contains information that is highly semantically similar to the user's search intent and is the core data source for subsequent search results.
[0082] In one embodiment, in S701, when calculating the similarity between the candidate result set and the enhanced intent vector, the following formula is used:
[0083]
[0084] Among them, s(u) represents the similarity score, represents the embedding vector of node u, v enh represents the enhanced intention vector, λ represents the cross-modal fusion coefficient, Represents a symmetric distribution similarity measure, parameter KL represents relative entropy, P text (u) represents the text semantic distribution of node u, P graph(u) represents the graph structure distribution of node u.
[0085] For example, the similarity score s(u) represents the degree of similarity between node u, i.e., a candidate result in the candidate result set, and the enhanced intent vector. It is a quantitative indicator for judging whether the candidate result matches the user's search intent. The higher the score, the more semantically similar the candidate result is to the enhanced intent vector. The node u is encoded by the graph neural network. When processing graph structure data, the graph neural network converts the node's feature information such as text content and association relationships into a low-dimensional vector representation, namely the node's embedding vector. It contains the comprehensive features of node u and is used to measure the similarity with the enhanced intent vector in the vector space. Different graph neural network models and training methods will affect the generation of the embedding vector for subsequent similarity calculations. Enhanced intent vector v enh It is generated by integrating the knowledge enhancement model with the user's search intent, combining the user's original search intent and domain expertise to represent a more accurate search demand. In similarity calculation, it serves as a reference standard to measure the matching degree of candidate results. The cross-modal fusion coefficient λ is manually set and continuously optimized during the model training process. Its function is to balance the weights of the two different similarity calculation methods in the formula. The value of λ can be adjusted according to the specific application scenario and data characteristics to find the most suitable method to measure the similarity between the candidate results and the enhanced intent vector. Symmetric distribution similarity measure It is used to measure the similarity between two probability distributions P and Q. In this formula, P and Q are the text semantic distribution P of node u respectively. text (u) and graph structure distribution P graph (u), and calculated by relative entropy KL. Relative entropy KL can measure the difference between the two distributions. The symmetric feature of JS enables it to more comprehensively reflect the similarity of the two distributions, avoiding the unidirectional problem that may be caused by simply using relative entropy. When calculating the similarity between the candidate results and the enhanced intent vector, by considering the similarity of the text semantic distribution and graph structure distribution of the node, the matching degree between the candidate results and the user's search intent can be evaluated from multiple angles, thereby improving the matching accuracy. The text semantic distribution P of node u text (u) comes from the analysis of the text content contained in node u. Through natural language processing technology, the text of node u is segmented, represented by word vectors, and analyzed semantically to obtain the probability distribution of different semantic elements in the text. For example, for a node containing information related to apples, its text semantic distribution may have different probability values in semantic categories such as fruit, nutrition, and eating methods, reflecting the emphasis of the text content of the node on different semantic aspects. The graph structure distribution P of node u graph(u) is generated based on the position and connectivity of node u in the graph structure. In graph neural networks, the connectivity of nodes and the characteristics of their surrounding neighboring nodes influence their graph structure distribution. For example, the nodes directly connected to the apple node include orchards and planting techniques. These connectivity relationships and neighboring node characteristics are encoded into the graph structure distribution, reflecting the semantic association characteristics of the node in the entire graph structure. This supplements the structural information beyond the text semantic distribution and makes the similarity calculation more comprehensive.
[0086] The above-mentioned search method based on computer natural language processing uses a preset semantic knowledge graph to extract the synonym set and contextual association relationship of the query text keywords, and generates a semantic vector with the help of a deep learning model, which effectively fills the semantic gap problem existing in traditional keyword matching and can better capture the implicit semantics and contextual association of the text; based on the semantic vector, it extracts a historical behavior feature sequence including three dimensions of user click heat distribution, result switching frequency and deep interaction time from the query log, and uses the attention mechanism model to analyze the user's search intention, which can accurately capture the dynamic drift characteristics of the intention and realize accurate intention recognition; based on the search intention, it uses a semantic matching algorithm The system performs semantic similarity matching on pre-built databases, extracts professional terms from the domain knowledge information library associated with the preset semantic knowledge graph, and fuses them with the user's search intent to generate an enhanced intent vector. The system then combines the graph neural network to generate a candidate result set and screens it to form an information matching set, thereby improving the accuracy of semantic matching. A context-aware dynamic sharding algorithm is used to distribute the information matching set to generate an index shard cluster, avoiding the semantic association breakage caused by traditional static sharding and optimizing distributed retrieval efficiency. A cross-shard graph attention network is used to semantically aggregate the index shard cluster, and dynamic semantic projection is used to generate a search result set, achieving efficient integration of multi-source heterogeneous data. This significantly improves the accuracy and system response speed of searches in complex semantic scenarios, effectively addressing the shortcomings of traditional search technologies in semantic understanding, intent analysis, distributed retrieval, and cross-modal fusion.
[0087] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0088] Based on the same inventive concept, the embodiments of the present application also provide a computer natural language processing-based search system for implementing the aforementioned computer natural language processing-based search method. The implementation solution provided by this system is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more embodiments of a computer natural language processing-based search system provided below can be found in the above-mentioned limitations of a computer natural language processing-based search method, and will not be repeated here.
[0089] In an exemplary embodiment, Figure 2 As shown, a search system based on computer natural language processing is provided, comprising:
[0090] Semantic parsing module 11, used to extract synonym sets and contextual association relationships of keywords in the query text using a preset semantic knowledge graph, and generate semantic vectors using a deep learning model;
[0091] Intent analysis module 12, used to extract historical behavior feature sequences from query logs based on semantic vectors, and analyze the user's search intent using an attention mechanism model;
[0092] Semantic retrieval module 13, used to perform semantic similarity matching on a pre-built database based on search intent using a semantic matching algorithm to obtain an information matching set that meets a preset similarity threshold;
[0093] An index optimization module 14 is configured to perform distributed processing on the information matching set based on a context-aware dynamic sharding algorithm to generate an index sharding cluster;
[0094] The result generation module 15 is used to perform semantic aggregation on the index shard clusters using the cross-shard graph attention network, and generate a search result set after dynamic semantic projection.
[0095] In one embodiment, the semantic parsing module 11 is further configured to:
[0096] Extract the temporal semantic features of the query text through a bidirectional sequence encoder;
[0097] Utilize the preset semantic knowledge graph to extract synonym sets and contextual association relationships of keywords in the temporal semantic features within the same semantic space, and generate extended semantic features;
[0098] The extended semantic features are semantically fused using a multi-layer Transformer encoder to generate a semantic vector carrying the semantic dimension weight identifier.
[0099] In one embodiment, the semantic parsing module 11 is further configured to optimize the multi-layer Transformer encoder using the following interpretability-constrained contrast loss function:
[0100]
[0101] in, Represents the semantic vector of the i-th keyword, P i represents the positive sample set, N i represents the negative sample set, v n ∈N i Represents the negative sample semantic vector, v p ∈P i represents the positive sample semantic vector, Indicates cosine similarity calculation, represents the interpretability scaling factor, represents the expected value of the similarity of positive samples, It represents the expected value of the similarity of negative samples.
[0102] In one embodiment, the intention analysis module 12 is further configured to:
[0103] Extract historical behavior feature sequences from query logs, including user click heat distribution, result switching frequency, and deep interaction duration, to form a user behavior feature tensor set;
[0104] Perform cross-attention weight assignment on the semantic vector and the user behavior feature tensor to generate an attention-enhanced spatiotemporal joint feature representation;
[0105] Attention-enhanced spatiotemporal joint feature representation uses a long short-term memory network to capture the drifting characteristics of intent in the temporal dimension;
[0106] Multi-scale feature extraction of intent drift features is performed through a temporal convolutional network to generate user search intent with temporal change confidence annotations.
[0107] In one embodiment, the intention analysis module 12 is further configured to perform cross-attention weighting on the semantic vector and the user behavior feature tensor using the following formula:
[0108]
[0109] in, represents the semantic vector, d v represents the semantic space dimension, represents the three-dimensional user behavior feature tensor, T represents the time step, L represents the feature level, d h represents the hidden layer dimension, represents the trainable attention projection matrix, represents the adaptive temperature coefficient, E represents the expected calculation of the sliding window, represents the adaptive activation function.
[0110] In one embodiment, the semantic search module 13 is further configured to:
[0111] Extract professional terms from the domain knowledge information base associated with the preset semantic knowledge graph, and use the knowledge enhancement model to integrate them with the user's search intent to generate an enhanced intent vector;
[0112] Based on the enhanced intent vector, the node association path of the graph neural network is used to generate a candidate result set;
[0113] The similarity between the candidate result set and the enhanced intent vector is calculated, and the candidate results with scores greater than the preset threshold are filtered to form an information matching set.
[0114] In one embodiment, the semantic retrieval module 13 is further configured to calculate the similarity between the candidate result set and the enhanced intent vector using the following formula:
[0115]
[0116] Among them, s(u) represents the similarity score, represents the embedding vector of node u, v enh represents the enhanced intention vector, λ represents the cross-modal fusion coefficient, Represents a symmetric distribution similarity measure, parameter KL represents relative entropy, P text (u) represents the text semantic distribution of node u, P graph (u) represents the graph structure distribution of node u.
[0117] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the search method based on computer natural language processing as described above are implemented.
[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0119] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the components described as separate parts may or may not be physically separated, and the parts displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. A person of ordinary skill in the art can understand and implement it without expending creative work.
[0120] The above-described embodiments merely represent several implementation methods of the embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the concept of the embodiments of the present application, and these modifications and improvements fall within the scope of protection of the embodiments of the present application.
Claims
1. A search method based on computer natural language processing, characterized in that: The method comprises: Use the preset semantic knowledge graph to extract synonym sets and contextual relationships of keywords in the query text, and use the deep learning model to generate semantic vectors; Based on the semantic vector, historical behavior feature sequences are extracted from the query logs, and the user search intent is analyzed using an attention mechanism model. Based on the search intent, a semantic similarity matching algorithm is used to perform semantic similarity matching on a pre-built database to obtain an information matching set that meets a preset similarity threshold; Performing distributed processing on the information matching set using a context-aware dynamic sharding algorithm to generate an index sharding cluster; The cross-shard graph attention network is used to semantically aggregate the index shard clusters, and a search result set is generated after dynamic semantic projection.
2. The method according to claim 1, characterized in that The method of extracting synonym sets and contextual relationships of keywords in the query text using a preset semantic knowledge graph and generating semantic vectors using a deep learning model includes: Extracting temporal semantic features of the query text through a bidirectional sequence encoder; Using a preset semantic knowledge graph, extracting synonym sets and contextual association relationships of keywords in the temporal semantic features within the same semantic space, and generating extended semantic features; The extended semantic features are semantically fused using a multi-layer Transformer encoder to generate a semantic vector carrying a semantic dimension weight identifier.
3. The method according to claim 2, characterized in that The multi-layer Transformer encoder is optimized using a contrastive loss function with the following interpretability constraints: in, Represents the semantic vector of the i-th keyword, P i represents the positive sample set, N i represents the negative sample set, v n ∈N i Represents the negative sample semantic vector, v p ∈P i represents the positive sample semantic vector, Indicates cosine similarity calculation, represents the interpretability scaling factor, represents the expected value of the similarity of positive samples, It represents the expected value of the similarity of negative samples.
4. The method according to claim 1, wherein The method extracts historical behavior feature sequences from query logs based on the semantic vectors and uses an attention mechanism model to analyze and obtain user search intent, including: Extracting a historical behavior feature sequence including three dimensions, namely, user click heat distribution, result switching frequency, and deep interaction duration, from the query log to form a user behavior feature tensor set; Performing cross-attention weight assignment on the semantic vector and the user behavior feature tensor to generate an attention-enhanced spatiotemporal joint feature representation; Based on the attention-enhanced spatiotemporal joint feature representation, a long short-term memory network is used to capture the intention drift characteristics in the time dimension; Multi-scale feature extraction is performed on the intention drift features through a temporal convolutional network to generate user search intentions with temporal change confidence annotations.
5. The method according to claim 4, characterized in that When performing cross-attention weight allocation on the semantic vector and the user behavior feature tensor, the following formula is used: in, represents the semantic vector, d v represents the semantic space dimension, represents the three-dimensional user behavior feature tensor, T represents the time step, L represents the feature level, d h represents the hidden layer dimension, represents the trainable attention projection matrix, represents the adaptive temperature coefficient, E represents the expected calculation of the sliding window, represents the adaptive activation function.
6. The method according to claim 1, characterized in that Based on the search intent, a semantic similarity matching algorithm is used to perform semantic similarity matching on a pre-built database to obtain an information matching set that meets a preset similarity threshold, including: Extracting professional terms from the domain knowledge information base associated with the preset semantic knowledge graph, and fusing them with the user search intent using a knowledge enhancement model to generate an enhanced intent vector; Based on the enhanced intent vector, a candidate result set is generated using the node association path of the graph neural network; The similarity between the candidate result set and the enhanced intention vector is calculated, and candidate results with scores greater than a preset threshold are screened to form an information matching set.
7. The method according to claim 6, characterized in that When calculating the similarity between the candidate result set and the enhanced intent vector, the following formula is used: Among them, s(u) represents the similarity score, represents the embedding vector of node u, v enh represents the enhanced intention vector, λ represents the cross-modal fusion coefficient, Represents a symmetric distribution similarity measure, parameter KL represents relative entropy, P text (u) represents the text semantic distribution of node u, P graph (u) represents the graph structure distribution of node u.
8. A search system based on computer natural language processing, characterized in that: The system comprises: The semantic parsing module is used to extract synonym sets and contextual relationships of keywords in the query text using a preset semantic knowledge graph, and generate semantic vectors using a deep learning model; An intent analysis module is used to extract historical behavior feature sequences from query logs based on the semantic vectors and analyze the user's search intent using an attention mechanism model; A semantic retrieval module is used to perform semantic similarity matching on a pre-built database based on the search intent using a semantic matching algorithm to obtain an information matching set that meets a preset similarity threshold; An index optimization module, configured to perform distributed processing on the information matching set based on a context-aware dynamic sharding algorithm to generate an index sharding cluster; The result generation module is used to perform semantic aggregation on the index shard cluster using a cross-shard graph attention network, and generate a search result set after dynamic semantic projection.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
AI application center application rapid delivery and full life cycle management method and system
CN120832890A
Semantic indexing and content retrieval method for remote sensing time series data
CN120950740A
Intelligent customer intention recognition method and system based on multi-modal deep learning
CN121093278A
Intelligent customer intent recognition method and system based on multi-modal deep learning
CN121093278B
Cross-language retrieval method
CN121117156A