A semantic search method and storage medium based on AI recognition of user intention

Through the AI-based semantic search method, the Transformer model and knowledge graph are used to deeply understand and expand user queries, which solves the problem of insufficient semantic understanding capabilities of existing search engines and achieves more accurate and personalized search results.

CN119621954BActive Publication Date: 2025-05-23杭州亚古科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510147772.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-05-23
Estimated Expiration
2045-02-11

AI Technical Summary

Technical Problem

Existing search engines have shortcomings in semantic understanding capabilities, and it is difficult to accurately capture the true intentions and needs behind user queries, especially when handling complex queries, resulting in a significant reduction in the accuracy and relevance of search results.

Method used

Using a semantic search method based on AI to identify user intentions, the query text input by the user is deeply understood through the Transformer model, the user's intent is predicted using a classifier, and the query text is expanded by constructing a knowledge graph, the similarity score between the query text and the document is calculated, and the user portrait is finally constructed to obtain a document list.

Benefits of technology

It achieves accurate grasp of user needs, improves the accuracy and comprehensiveness of searches, and enhances the personalization of search results and user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621954B_ABST
    Figure CN119621954B_ABST
Patent Text Reader

Abstract

The present invention provides a semantic search method and storage medium for identifying user intent based on AI, and the method includes: receiving a query text input by a user, performing preprocessing to extract key information; pre-training a Transformer model, inputting the query text to obtain an embedding vector; using a classifier to predict user intent based on the embedding vector; combining key information and user intent, using a knowledge graph to expand the query text, and generating an expanded query text; matching the expanded text with entities and relationships in the knowledge graph to obtain a related set; calculating a similarity score between the set and the document; constructing a user portrait, and generating a document list based on the portrait and the similarity score. The present invention deeply understands the query text through the Transformer model, and the classifier predicts intent, so as to accurately grasp user needs. Further, the query content is enriched through domain dictionary construction, synonym replacement and phrase expansion to improve search accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of semantic search technology, and in particular to a semantic search method and storage medium based on AI to identify user intent. Background Art

[0002] As a crucial branch of modern information retrieval technology, semantic search aims to significantly improve the accuracy and effectiveness of the retrieval system by deeply understanding the specific meaning of user queries. With the widespread popularization of Internet technology and the rapid expansion of data volume, traditional keyword-based search methods have become increasingly difficult to meet users' increasingly diverse information needs. Existing search engines generally have significant deficiencies in semantic understanding capabilities. They can often only mechanically understand the literal meaning of user queries, but cannot accurately capture the true intentions and needs hidden behind the queries. For example, when a user enters the query "How is the weather today?", the user's actual intention may be to understand the current weather conditions, but the search engine may only be able to find relevant documents containing the two keywords "today" and "weather", and cannot accurately determine that the user really wants to obtain real-time weather information. In addition, the lack of semantic understanding is particularly reflected in the processing of complex queries. When users enter complex queries containing multiple concepts, entities, and complex relationships, existing search engines often find it difficult to fully and accurately understand their overall meaning, which directly leads to a significant reduction in the accuracy and relevance of the retrieval results and cannot meet the actual needs of users. In this case, it is particularly important to improve the semantic understanding ability of search engines in order to better cope with complex and changing information retrieval scenarios. Summary of the invention

[0003] In order to solve the technical problem of low accuracy of search results in the prior art, the present invention provides the following technical solution:

[0004] In one aspect, a semantic search method for identifying user intent based on AI is provided, the method comprising:

[0005] S1. receiving a query text input by a user, and preprocessing the query text to obtain key information;

[0006] S2, pre-training the Transformer model, and inputting the query text into the trained Transformer model to obtain an embedding vector of the query text;

[0007] S3, predicting user intention using a classifier based on the embedding vector;

[0008] S4, expanding the query text using the constructed knowledge graph based on the key information and user intention to obtain an expanded query text;

[0009] S5, matching the expanded query text with the entities and relationships in the knowledge graph to obtain a set of entities and relationships related to the query text;

[0010] S6, calculating the similarity score between the set of entities and relations related to the query text and the document;

[0011] S7: Build a user portrait, and obtain a document list based on the user portrait and the similarity score.

[0012] As an optional embodiment of the present invention, optionally, obtaining key information in step S1 includes:

[0013] S101, performing word segmentation, stop word removal and restoration processing on the query text;

[0014] S102, obtaining entities in the query text, and determining a grammatical role of each entity in the query text in the query text;

[0015] S103: Annotate the grammatical roles, and obtain key information based on the annotated grammatical roles.

[0016] As an optional embodiment of the present invention, optionally, pre-training the Transformer model in step S2 includes:

[0017] S201, collecting text data, and performing word segmentation processing on the text data;

[0018] S202, constructing an input sequence based on the text data after the word segmentation processing;

[0019] S203, initializing the Transformer model, inputting the input sequence into the Transformer model, and training using the self-attention mechanism and feedforward neural network in the Transformer model;

[0020] S204: Calculate the loss between the output of the Transformer model and the target using a loss function, and iteratively update the parameters of the Transformer model using an optimization algorithm based on the loss.

[0021] As an optional embodiment of the present invention, optionally, the expression of the loss function in step S204 is:

[0022]

[0023] in, represents the loss of the Transformer model, Represents the number of samples of the Transformer model, Indicates samples, Indicates The true value of the samples, represents the logarithmic function, Represents the first The predicted value of a sample.

[0024] As an optional embodiment of the present invention, optionally, the expression for predicting the user intention using the classifier in step S3 is:

[0025]

[0026] in, Indicates The output of the hidden layer, σ() represents the nonlinear activation function, Indicates The weight matrix of the hidden layer, Indicates The output of the hidden layer, Indicates The bias of the hidden layer, represents the raw output vector of the final linear layer, Indicates The weight matrix of the hidden layer, Indicates The bias of the hidden layer, Indicates The predicted probability of each category, Indicates The score index of each category, represents the total number of categories, Indicates The score index of each category.

[0027] As an optional embodiment of the present invention, optionally, the expanded query text obtained in step S4 includes:

[0028] S401, constructing a domain dictionary related to the query text;

[0029] S402: Perform synonym replacement and phrase expansion on the query text based on the domain dictionary to obtain an expanded query text.

[0030] As an optional embodiment of the present invention, optionally, in step S6, the expression for calculating the similarity score between the set of entities and relations related to the query text and the document is:

[0031]

[0032] in, represents the similarity score, represents the vector representation of the query text, represents the dot product, represents the vector representation of the document, Indicates modulo.

[0033] As an optional embodiment of the present invention, optionally, constructing a user portrait in step S7 includes:

[0034] S701, obtaining historical behavior data of a user, and preprocessing the historical behavior data;

[0035] S702, extracting behavior features, interest features and attribute features based on the historical behavior data;

[0036] S703, respectively encode the behavior feature, interest feature and attribute feature to obtain a behavior feature vector, an interest feature vector and an attribute feature vector;

[0037] S704, concatenating the behavior feature vector, the interest feature vector and the attribute feature vector to obtain a user portrait feature vector;

[0038] S705: Add a label to the user portrait feature vector to obtain a user portrait.

[0039] As an optional embodiment of the present invention, optionally, the expression for obtaining the user portrait feature vector in step S704 is:

[0040]

[0041] in, The feature vector representing the user portrait, represents the activation function, Indicates the number of behavioral features, Indicates behavioral characteristics, express Moment The weight of the behavior feature, • represents the dot product, Indicates The conversion function of the behavioral characteristics is Indicates The original characteristics of the behavioral characteristics, represents the number of interesting feature vectors, Indicates Interest feature vectors, express Moment The weight of the feature of interest, Indicates The conversion function of the feature of interest, Indicates The original features of the features of interest, represents the number of attribute feature vectors, Indicates attribute feature vector, express Moment The weight of the attribute features, Indicates The conversion function of attribute features, Indicates The original features of the attribute features, A global context vector representing temporal dependencies.

[0042] On the other hand, a computer-readable storage medium is provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement any one of the above-mentioned semantic search methods based on AI to identify user intent.

[0043] The beneficial effects of the technical solution provided by the embodiment of the present invention are as follows: the present invention uses the Transformer model to perform deep semantic understanding of the query text input by the user, and uses the classifier to predict the user's intention, thereby achieving an accurate grasp of the user's needs. After obtaining the user's intention, the present invention further expands the query text, enriches the content of the query text by constructing a domain dictionary and performing synonym replacement and phrase expansion, and improves the accuracy and comprehensiveness of the search. At the same time, the present invention also calculates the similarity score between the set of entities and relationships related to the query text and the document, and quantitatively evaluates the relevance of the document to the user's query, further improving the accuracy of the search results. In addition, the present invention also constructs a user portrait, by obtaining the user's historical behavior data and preprocessing it, extracting behavioral features, interest features and attribute features, and encoding and splicing them, and finally obtaining a user portrait feature vector, and adding labels to it, so as to achieve an accurate grasp of the user's personalized needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0045] Figure 1It is a flow chart of a semantic search method based on AI recognition of user intent provided by an embodiment of the present invention;

[0046] Figure 2 It is a structural diagram of a semantic search device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0048] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.

[0049] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.

[0050] In the embodiments of the present invention, sometimes the subscripts such as W 1 It may be mistakenly written as a non-subscript form such as W1. When the difference is not emphasized, the meanings they express are the same.

[0051] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0052] like Figure 1 As shown, an embodiment of the present invention provides a semantic search method based on AI to identify user intent, the method comprising:

[0053] S1. receiving a query text input by a user, and preprocessing the query text to obtain key information;

[0054] It should be noted that in step S1, the preprocessing process of this embodiment includes steps such as removing irrelevant characters, word segmentation, part-of-speech tagging, and stop word filtering to ensure accurate extraction of key information. Key information includes core words and phrases in the query text and the semantic relationship between them.

[0055] S2, pre-training the Transformer model, and inputting the query text into the trained Transformer model to obtain an embedding vector of the query text;

[0056] It should be noted that the Transformer model is a deep learning model suitable for processing natural language processing tasks. In this embodiment, the Transformer model learns the language rules and semantic information of a large amount of text data through a pre-training process. When the query text is input into the trained Transformer model, the model can capture the semantic features in the query text and represent it as an embedding vector. This embedding vector is a high-dimensional vector that contains the deep semantic information of the query text, which provides a basis for subsequent intent recognition and query expansion.

[0057] S3, predicting user intention using a classifier based on the embedding vector;

[0058] It should be noted that the classifier is a machine learning model that can classify input data. In this embodiment, the classifier predicts the user intent based on the embedding vector of the query text. By training the classifier, it can learn the mapping relationship between different user intents and the embedding vector of the query text. When a new query text is input, the classifier can output the corresponding user intent, providing a basis for subsequent query expansion and search result sorting.

[0059] S4, expanding the query text using the constructed knowledge graph based on the key information and user intention to obtain an expanded query text;

[0060] It should be noted that the knowledge graph is a structured knowledge base that contains a large number of entities, attributes, and relationships. In this embodiment, the knowledge graph is used to expand the query text. Specifically, based on key information and user intent, entities and relationships related to the query text are found in the knowledge graph, and these entities and relationships are added to the query text as extended content. In this way, the expanded query text not only contains the information in the original query text, but also contains additional information related to the query text, thereby improving the accuracy and comprehensiveness of the search.

[0061] S5. Match the expanded query text with the entities and relationships in the knowledge graph to obtain a set of entities and relationships related to the query text;

[0062] It should be noted that step S5 is to further determine the specific location of the query text in the knowledge graph, as well as the detailed information of the entities and relationships related thereto. Through the matching process, a set of entities and a set of relationships highly related to the query text can be obtained, which provide an important basis for subsequent correlation calculations and search result sorting. The specific matching algorithm can adopt a strategy based on similarity calculation, such as cosine similarity, Jaccard similarity, etc., to evaluate the similarity between the expanded query text and each entity and relationship in the knowledge graph. In this way, the entities and relationships most relevant to the query text can be accurately screened out to ensure the accuracy and relevance of the search results.

[0063] S6, calculating the similarity score between the set of entities and relations related to the query text and the document;

[0064] It should be noted that in step S6, the calculation of similarity score is to evaluate the degree of association between the entity and relationship set related to the query text and the document. Specifically, various similarity calculation methods can be adopted, such as cosine similarity, Jaccard similarity, Euclidean distance, etc., to quantify the semantic distance between the query text and the document. In the calculation process, the vocabulary, phrases, sentences in the document and the semantic relationship between them are considered, and the entity and relationship set related to the query text are compared, thereby deriving the similarity score. This score reflects the correlation between the document and the query text, and provides a key basis for subsequent search result sorting. By calculating the similarity score, the document that best matches the query text can be found accurately, improving the accuracy and efficiency of search.

[0065] S7: Build a user portrait, and obtain a document list based on the user portrait and the similarity score.

[0066] It should be noted that the user portrait is a user model constructed based on the user's historical behavior, preferences, user personal attributes and other information. In this embodiment, the user portrait is used in combination with the similarity score to jointly determine the final document list. Specifically, the user's interest preference model is constructed based on the user's historical search records, click behavior, browsing time and other information. Then, the documents are sorted in combination with the similarity score. For documents that are highly matched with the user portrait and have a higher similarity score, they are placed in front and displayed to the user first. In this way, not only the personalization of the search results can be improved, but also the user's search experience and satisfaction can be improved. Finally, the sorted document list is displayed to the user to complete the entire semantic search process.

[0067] In summary, in this embodiment, first, the query text input by the user is received and preprocessed to extract key information. Then, the pre-trained Transformer model is used to convert the query text into an embedding vector, which is rich in the deep semantic information of the query text. Next, the classifier predicts the user's intention, and based on the key information and the user's intention, the knowledge graph is used to expand the query text to obtain a more abundant and comprehensive query content. Subsequently, the expanded query text is matched with the entities and relationships in the knowledge graph to determine the entity set and relationship set that are highly relevant to it. Then, the similarity scores between these sets and the documents are calculated to evaluate the degree of association between them. Finally, combining the user profile and the similarity scores, the documents are sorted and the sorted document list is presented to the user. The entire process not only improves the accuracy and comprehensiveness of the search, but also enhances the personalization of the search results and user satisfaction.

[0068] As an alternative embodiment of the present invention, optionally, obtaining the key information in step S1 includes:

[0069] S101. Perform word segmentation, stop word removal, and restoration processing on the query text;

[0070] It should be noted that word segmentation is to split the query text into individual independent lexical units, stop word removal is to remove those common words that are not helpful for query intention recognition, such as "de", "le", etc., and restoration processing is to restore the words to their basic forms, such as restoring "running" to "run", to improve the accuracy of subsequent processing. By performing these preprocessing operations on the query text, more accurate and useful key information can be further extracted, providing more reliable data support for subsequent steps.

[0071] S102. Obtain the entities in the query text and determine the syntactic roles of each entity in the query text;

[0072] It should be noted that entities are the words or phrases with clear meanings and independence in the query text, which carry the core information of the query text. Determining the syntactic roles of entities in the query text can help this embodiment better understand the semantic structure of the query text, so as to more accurately identify the user's query intention. For example, in a text about movie queries, "movie" is an entity, and its syntactic role in the text is the subject or object, which helps to understand whether the user is asking for information about a certain movie or discussing related content about a certain movie. By identifying the entities and their syntactic roles, the semantic information of the query text can be further enriched, providing a more accurate data basis for subsequent classifier prediction and user intention recognition.

[0073] S103: Annotate the grammatical roles, and obtain key information based on the annotated grammatical roles.

[0074] It should be noted that

[0075] The purpose of marking the grammatical roles is to clarify the specific role of each entity in the query text, which helps to understand the semantic content of the query text more deeply. The marked grammatical roles can clearly show the association and hierarchical relationship between entities, so as to extract more critical and useful information. For example, in a text about tourism query, by marking the grammatical roles of entities such as "attractions", "prices", and "transportation", their respective positions and functions in the query text can be clarified, and then it can be determined whether the user's query intention wants to know the detailed information of a certain attraction, or to compare the prices and traffic conditions of different attractions. Based on these marked grammatical roles, this embodiment can more accurately extract key information and provide more accurate and comprehensive data support for subsequent classifier prediction and user intention recognition. In this way, not only can the efficiency and accuracy of query text processing be improved, but also more personalized and satisfactory search results can be provided to users.

[0076] As an optional embodiment of the present invention, optionally, pre-training the Transformer model in step S2 includes:

[0077] S201, collecting text data, and performing word segmentation processing on the text data;

[0078] S202, constructing an input sequence based on the text data after the word segmentation processing;

[0079] It should be noted that the construction of the input sequence is to convert the text data into a format that the model can process. In this embodiment, the construction of the input sequence takes into account the vocabulary, phrases and contextual relationships between the text data to ensure that the model can fully capture the semantic information of the text data. By arranging the text data after word segmentation in an orderly manner, an input sequence is formed to provide basic data for subsequent model training. In this way, after receiving the input sequence, the Transformer model can use its own attention mechanism to assign weights to each element in the sequence, thereby learning the deep semantic features in the text data and providing strong support for the query text embedding vector conversion in the subsequent steps.

[0080] S203, initializing the Transformer model, inputting the input sequence into the Transformer model, and training using the self-attention mechanism and feedforward neural network in the Transformer model;

[0081] It should be noted that the initialization of the Transformer model is to ensure that the model is in a reasonable state before the training begins. Subsequently, the constructed input sequence is input into the Transformer model, and the model uses its own self-attention mechanism and feedforward neural network to learn and train the input sequence. The self-attention mechanism enables the model to pay attention to each element in the input sequence, and to distribute weights according to the degree of association between the elements, thereby capturing the key semantic information in the text data. The feedforward neural network is responsible for further processing and conversion of the captured semantic information to generate an embedded vector rich in deep semantic information. Through continuous training and optimization, the Transformer model can learn the deep semantic features in the text data, and provide more accurate and comprehensive data support for the query text embedded vector conversion in the subsequent steps. In this way, when the query text input by the user is received, the present embodiment can quickly convert it into an embedded vector, providing a strong data basis for subsequent classifier prediction and user intent recognition.

[0082] S204: Calculate the loss between the output of the Transformer model and the target using a loss function, and iteratively update the parameters of the Transformer model using an optimization algorithm based on the loss.

[0083] It should be noted that the loss function is a function used to evaluate the difference between the output of the Transformer model and the target. It can help the model understand its own prediction error and guide the update direction of the model parameters. In this embodiment, the loss function is used to calculate the loss value between the model output and the target. Subsequently, based on the calculated loss value, the parameters of the Transformer model are iteratively updated using an optimization algorithm, such as the Adam optimization algorithm. The optimization algorithm continuously adjusts the parameters of the model so that the output of the model gradually approaches the target, thereby reducing the loss value. Through continuous iterative training, the Transformer model can gradually learn the deep semantic features in the text data and improve its own prediction accuracy and generalization ability. In this way, when the Transformer model training is completed, it can effectively convert the query text input by the user into an embedded vector rich in deep semantic information, providing more accurate and reliable data support for subsequent classifier predictions and user intent recognition.

[0084] As an optional embodiment of the present invention, optionally, the expression of the loss function in step S204 is:

[0085]

[0086] in, Represents the loss of the Transformer model;

[0087] Indicates the number of samples of the Transformer model;

[0088] Indicates samples;

[0089] Indicates The true value of samples;

[0090] represents the logarithmic function;

[0091] Represents the first The predicted value of a sample.

[0092] As an optional embodiment of the present invention, optionally, the expression for predicting the user intention using the classifier in step S3 is:

[0093]

[0094] in, Indicates The output of the hidden layer;

[0095] σ() represents a nonlinear activation function;

[0096] Indicates The weight matrix of the hidden layer;

[0097] Indicates The output of the hidden layer;

[0098] Indicates The bias of the hidden layer;

[0099] represents the raw output vector of the final linear layer;

[0100] Indicates The weight matrix of the hidden layer;

[0101] Indicates The bias of the hidden layer;

[0102] Indicates The predicted probability of each category;

[0103] Indicates The scoring index of each category;

[0104] Indicates the total number of categories;

[0105] Indicates The score index of each category.

[0106] It should be noted that in the above expression, the classifier uses a multi-layer neural network structure, which maps the embedding vector output by the Transformer model to the predicted probability of the user's intention through a combination of nonlinear activation functions and linear layers. Specifically, each hidden layer performs a nonlinear transformation on the input and linearly combines it through the weight matrix and bias to obtain the input of the next hidden layer. Finally, the original output vector is obtained through the linear layer and normalized by the softmax function to obtain the predicted probability of each category. In this way, the classifier can predict the intention of the user's query text based on the embedding vector output by the Transformer model.

[0107] As an optional embodiment of the present invention, optionally, the expanded query text obtained in step S4 includes:

[0108] S401, constructing a domain dictionary related to the query text;

[0109] It should be noted that the domain dictionary contains professional terms and common words related to the query text, which can help the model better understand the semantic information of the query text. By introducing the domain dictionary, the model's recognition ability for query text in a specific field can be improved, thereby further improving the accuracy and relevance of search results. The specific method of constructing a domain dictionary includes but is not limited to collecting professional terms and common words from literature, books, network resources, etc. in related fields, and screening and sorting them. These words can be weighted according to their importance or frequency so that they can be given different levels of attention in subsequent processing.

[0110] S402: Perform synonym replacement and phrase expansion on the query text based on the domain dictionary to obtain an expanded query text.

[0111] It should be noted that synonym replacement refers to replacing certain words in the query text with their synonyms or near-synonyms, thereby increasing the diversity of the query text and improving the coverage of search results. Phrase expansion refers to expanding a single word in the query text into a related phrase or phrase to more accurately express the user's query intent. Through synonym replacement and phrase expansion, the semantic information of the query text can be further enriched and the model's ability to understand the user's query intent can be improved. In specific implementation, a rule-based method or a machine learning-based method can be used for synonym replacement and phrase expansion. The rule-based method relies on the synonym and phrase relationships in the domain dictionary, while the machine learning-based method can learn the semantic similarity and correlation between words by training the model.

[0112] As an optional embodiment of the present invention, optionally, in step S6, the expression for calculating the similarity score between the set of entities and relations related to the query text and the document is:

[0113]

[0114] in, represents the similarity score;

[0115] A vector representation of the query text;

[0116] represents the dot product;

[0117] A vector representation of the document;

[0118] Indicates modulo.

[0119] As an optional embodiment of the present invention, optionally, constructing a user portrait in step S7 includes:

[0120] S701, obtaining historical behavior data of a user, and preprocessing the historical behavior data;

[0121] It should be noted that historical behavior data includes but is not limited to the user's previous search history, click history, browsing history, etc., which can reflect the user's interests and preferences. By preprocessing historical behavior data, useful information can be extracted to provide a basis for subsequent user portrait construction. The specific methods of preprocessing include but are not limited to data cleaning, deduplication, formatting and other steps to ensure the accuracy and consistency of the data.

[0122] S702, extracting behavior features, interest features and attribute features based on the historical behavior data;

[0123] It should be noted that behavioral features refer to the behavioral patterns of users when performing operations such as searching, clicking, and browsing, such as search frequency, click-through rate, and dwell time. Interest features refer to the degree of interest of users in different fields or topics, which can be extracted by analyzing the user's search history and click records. Attribute features refer to the user's personal attribute information, such as age, gender, occupation, etc., which can be obtained through user registration information or third-party data sources. By extracting these features, we can have a more comprehensive understanding of user preferences and needs, thereby providing users with more personalized search results and services.

[0124] S703, respectively encode the behavior feature, interest feature and attribute feature to obtain a behavior feature vector, an interest feature vector and an attribute feature vector;

[0125] It should be noted that the encoding process can use methods such as one-hot encoding and word embedding to convert discrete features into continuous vector representations for subsequent calculations and analysis. By combining and fusing these feature vectors, a vector representation of the user portrait can be obtained, thereby achieving a comprehensive description and characterization of the user's interests and preferences. In this way, in the subsequent search process, search results and services that are more in line with the user's interests and needs can be recommended to the user based on the vector representation of the user portrait, thereby improving the accuracy and satisfaction of the search.

[0126] S704, concatenating the behavior feature vector, the interest feature vector and the attribute feature vector to obtain a user portrait feature vector;

[0127] It should be noted that the splicing of the behavior feature vector, the interest feature vector and the attribute feature vector can comprehensively reflect the user's multi-dimensional information, thereby more accurately describing the user's portrait. In the specific implementation, the vector splicing method can be used to combine the three feature vectors in a certain order to obtain the user portrait feature vector. In this way, in the subsequent search process, the search results and services that are more in line with their personalized needs can be recommended to the user based on the user portrait feature vector, thereby improving the accuracy of the search and user satisfaction. At the same time, by storing and updating the user portrait feature vector, it is also possible to continuously track and analyze the user's interests and preferences, providing users with a more dynamic and personalized search experience.

[0128] S705: Add a label to the user portrait feature vector to obtain a user portrait.

[0129] It should be noted that tags are further descriptions and classifications of user portrait feature vectors, which can help the model understand and identify user interests and needs more quickly. The specific content of tags can be designed and defined according to actual application scenarios and needs, such as the user's age group, gender, occupation, interests and hobbies. By adding tags, a more detailed and accurate description of user portraits can be achieved, thereby providing users with more personalized search results and services. In specific implementation, rule-based methods or machine learning-based methods can be used to add and classify tags. Rule-based methods rely on preset tag libraries and rule sets, while machine learning-based methods can learn the correlation and similarity between tags and user portrait feature vectors by training models.

[0130] As an optional embodiment of the present invention, optionally, the expression for obtaining the user portrait feature vector in step S704 is:

[0131]

[0132] in, The feature vector representing the user portrait, represents the activation function, Indicates the number of behavioral features, Indicates behavioral characteristics, express Moment The weight of the behavior feature, • represents the dot product, Indicates The conversion function of the behavioral characteristics is Indicates The original characteristics of the behavioral characteristics, represents the number of interesting feature vectors, Indicates Interest feature vectors, express Moment The weight of the feature of interest, Indicates The conversion function of the feature of interest, Indicates The original features of the features of interest, represents the number of attribute feature vectors, Indicates attribute feature vector, express Moment The weight of the attribute features, Indicates The conversion function of attribute features, Indicates The original features of the attribute features, A global context vector representing temporal dependencies.

[0133] It should be noted that this expression comprehensively considers the user's behavioral characteristics, interest characteristics, and attribute characteristics, and introduces a time-dependent global context vector to capture the user's behavioral changes and interest drift at different time points. Through activation functions and conversion functions, the original features can be converted into more expressive feature vectors to better describe the user's portrait. At the same time, by adjusting the weights of different features at different time points, a more dynamic and accurate capture of user interests and needs can be achieved. In this way, in the subsequent search process, based on the expression of the user portrait feature vector, search results and services that are more in line with their personalized needs and interest preferences can be recommended to users, further improving the accuracy of the search and user satisfaction.

[0134] Figure 2 is a structural diagram of a semantic search device provided by an embodiment of the present invention, such as Figure 2 As shown, the semantic search device 410 may include a first processor 2001 .

[0135] Optionally, the semantic search device 410 may further include a memory 2002 and a transceiver 2003 .

[0136] The first processor 2001, the memory 2002 and the transceiver 2003 may be connected via a communication bus.

[0137] Combine the following Figure 2 The components of the semantic search device 410 are described in detail:

[0138] The first processor 2001 is the control center of the semantic search device 410, and may be a processor or a general term for multiple processing elements. For example, the first processor 2001 is one or more central processing units (CPUs), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more microprocessors (digital signal processors, DSPs), or one or more field programmable gate arrays (field programmable gate arrays, FPGAs).

[0139] Optionally, the first processor 2001 may perform various functions of the semantic search device 410 by running or executing a software program stored in the memory 2002 and calling data stored in the memory 2002 .

[0140] In a specific implementation, as an embodiment, the first processor 2001 may include one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in FIG.

[0141] In a specific implementation, as an embodiment, the semantic search device 410 may also include multiple processors, such as Figure 2 The first processor 2001 and the second processor 2004 are shown in FIG. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0142] The memory 2002 is used to store the software program for executing the solution of the present invention, and is controlled to be executed by the first processor 2001. The specific implementation method can refer to the above method embodiment, which will not be repeated here.

[0143] Optionally, the memory 2002 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2002 may be integrated with the first processor 2001, or may exist independently and access the first processor 2001 through the interface circuit ( Figure 2 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.

[0144] The transceiver 2003 is used to communicate with a network device or a terminal device.

[0145] Optionally, the transceiver 2003 may include a receiver and a transmitter ( Figure 2 The receiver is used to implement a receiving function, and the transmitter is used to implement a sending function.

[0146] Optionally, the transceiver 2003 may be integrated with the first processor 2001, or may exist independently and communicate with the first processor 2001 through the interface circuit ( Figure 2 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.

[0147] It should be noted that Figure 2 The structure of the semantic search device 410 shown in the figure does not constitute a limitation on the router, and the actual knowledge structure recognition device may include more or fewer components than those shown in the figure, or combine certain components, or arrange the components differently.

[0148] In addition, the technical effects of the semantic search device 410 can refer to the technical effects of the semantic search method based on AI to identify user intentions described in the above method embodiment, and will not be repeated here.

[0149] It should be understood that the first processor 2001 in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0150] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A semantic search method based on AI to identify user intent, characterized in that: The method comprises: S1. receiving a query text input by a user, and preprocessing the query text to obtain key information; S2, pre-training the Transformer model, and inputting the query text into the trained Transformer model to obtain an embedding vector of the query text; S3. Predicting the user intention using a classifier based on the embedding vector. The expression for predicting the user intention using the classifier is: ; ; ; in, Indicates The output of the hidden layer, σ() represents the nonlinear activation function, Indicates The weight matrix of the hidden layer, Indicates The output of the hidden layer, Indicates The bias of the hidden layer, represents the raw output vector of the final linear layer, Indicates The weight matrix of the hidden layer, Indicates The bias of the hidden layer, Indicates The predicted probability of each category, Indicates The score index of each category, represents the total number of categories, Indicates categories, Indicates The scoring index of each category; S4, expanding the query text using the constructed knowledge graph based on the key information and user intention to obtain an expanded query text; S5. Match the expanded query text with the entities and relationships in the knowledge graph to obtain a set of entities and relationships related to the query text; S6, calculating the similarity score between the set of entities and relations related to the query text and the document; S7: construct a user portrait, and obtain a document list based on the user portrait and the similarity score. The user portrait construction includes: S701, obtaining historical behavior data of a user, and preprocessing the historical behavior data; S702, extracting behavior features, interest features and attribute features based on the historical behavior data; S703, respectively encode the behavior feature, interest feature and attribute feature to obtain a behavior feature vector, an interest feature vector and an attribute feature vector; S704: Concatenate the behavior feature vector, the interest feature vector and the attribute feature vector to obtain a user portrait feature vector. The expression for obtaining the user portrait feature vector is: ; in, The feature vector representing the user portrait, represents the activation function, Indicates the number of behavioral features, Indicates behavioral characteristics, express Moment The weight of the behavior feature, • represents the dot product, Indicates The conversion function of the behavioral characteristics is Indicates The original characteristics of the behavioral characteristics, represents the number of interesting feature vectors, Indicates Interest feature vectors, express Moment The weight of the feature of interest, Indicates The conversion function of the feature of interest, Indicates The original features of the features of interest, represents the number of attribute feature vectors, Indicates attribute feature vector, express Moment The weight of the attribute features, Indicates The conversion function of attribute features, Indicates The original features of the attribute features, A global context vector representing temporal dependencies; S705: Add a label to the user portrait feature vector to obtain a user portrait.

2. The semantic search method based on AI recognition of user intention according to claim 1, characterized in that: The key information obtained in step S1 includes: S101, performing word segmentation, stop word removal and restoration processing on the query text; S102, obtaining entities in the query text, and determining a grammatical role of each entity in the query text in the query text; S103: Annotate the grammatical roles, and obtain key information based on the annotated grammatical roles.

3. The semantic search method based on AI recognition of user intention according to claim 1, characterized in that: Pre-training the Transformer model in step S2 includes: S201, collecting text data, and performing word segmentation processing on the text data; S202, constructing an input sequence based on the text data after the word segmentation processing; S203, initializing the Transformer model, inputting the input sequence into the Transformer model, and training using the self-attention mechanism and feedforward neural network in the Transformer model; S204: Calculate the loss between the output of the Transformer model and the target using a loss function, and iteratively update the parameters of the Transformer model using an optimization algorithm based on the loss.

4. The semantic search method based on AI recognition of user intention according to claim 3 is characterized in that: In step S204, the loss function is expressed as: ; in, represents the loss of the Transformer model, Represents the number of samples of the Transformer model, Indicates samples, Indicates The true value of the samples, represents the logarithmic function, Represents the first The predicted value of a sample.

5. The semantic search method based on AI recognition of user intention according to claim 1, characterized in that: The expanded query text obtained in step S4 includes: S401, constructing a domain dictionary related to the query text; S402: Perform synonym replacement and phrase expansion on the query text based on the domain dictionary to obtain an expanded query text.

6. The semantic search method based on AI recognition of user intention according to claim 1, characterized in that: In step S6, the expression for calculating the similarity score between the set of entities and relations related to the query text and the document is: ; in, represents the similarity score, represents the vector representation of the query text, represents the dot product, represents the vector representation of the document, Indicates modulus.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, and the program code can be called by a processor to execute the semantic search method based on AI to identify user intent as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Query statement generation method and device based on large language model, equipment and medium

    CN118964560A

  • Information retrieval query method for legal data service platform

    CN118981512A