Retrieval method, device and equipment for content source
Through natural language models, semantic analysis and vector correlation search are solved, and the existing data retrieval algorithms are achieved, and efficient and accurate data retrieval is achieved.
Patent Information
- Application Number
- CN202411509849.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-11
AI Technical Summary
The existing data retrieval algorithm is complex, has a large amount of calculation, consumes a lot of computing resources, is slow in retrieval speed and is low in retrieval efficiency.
Semantic analysis of the content to be retrieved through natural language models is obtained, and similar content is retrieved based on the vector correlation degree, thereby determining the source of the content.
It improves the search accuracy of similar content, reduces the amount of invalid search calculations, saves search computing resources, and improves search efficiency.
Smart Images

Figure CN119415774A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and equipment for searching content sources. Background Art
[0002] In the digital age, data retrieval has become a key means of obtaining information. With the rapid development of the Internet and database technology, we are surrounded by massive amounts of data, which makes efficient and accurate data retrieval technology particularly important.
[0003] In the related technology, there are two types of data retrieval methods: text-based and image-based. Text retrieval usually uses the longest common substring method to retrieve similar texts, while image retrieval extracts image key points based on Scale-Invariant Feature Transform (SIFT) to retrieve similar images.
[0004] However, since the above retrieval algorithm is relatively complex, has a large amount of calculation, consumes a lot of computing resources, has a slow retrieval speed, and has a low retrieval efficiency. Summary of the invention
[0005] The embodiment of the present application provides a method, device and equipment for searching content sources, which can improve the search efficiency. The technical solution is as follows.
[0006] In one aspect, a method for searching content sources is provided, the method comprising:
[0007] Acquire a first search content, where the first search content is data content whose content source is to be determined;
[0008] Performing semantic analysis on the first search content through a natural language model to obtain a first feature vector, where the first feature vector is used to represent the semantics of the first search content;
[0009] Based on the vector association degree between the first feature vector and a plurality of candidate feature vectors, determining a target feature vector that meets the association degree requirement with the first feature vector from the plurality of candidate feature vectors, the plurality of candidate feature vectors being feature vectors corresponding to a plurality of candidate data contents, the plurality of candidate feature vectors including the target feature vector;
[0010] A search result of the first search content is determined based on the content source of the candidate data content corresponding to the target feature vector, and the search result is used to indicate the content source of the first search content.
[0011] On the other hand, a retrieval device for content sources is provided, the device comprising:
[0012] An acquisition module, used to acquire first search content, wherein the first search content is data content whose content source is to be determined;
[0013] An analysis module, configured to perform semantic analysis on the first search content through a natural language model to obtain a first feature vector, wherein the first feature vector is used to represent the semantics of the first search content;
[0014] a matching module, configured to determine, based on a vector correlation between the first feature vector and a plurality of candidate feature vectors, a target feature vector that meets a correlation requirement with the first feature vector from the plurality of candidate feature vectors, the plurality of candidate feature vectors being feature vectors corresponding to a plurality of candidate data contents, the plurality of candidate feature vectors including the target feature vector;
[0015] A determination module is used to determine a search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector, wherein the search result is used to indicate the content source of the first search content.
[0016] In some embodiments, the acquisition module is further used to acquire a vector database, wherein the vector database includes the multiple candidate feature vectors corresponding to the multiple candidate data contents, the candidate feature vectors corresponding to candidate source tags, and the candidate source tags are used to indicate the candidate content source of the candidate data content corresponding to the candidate feature vectors;
[0017] The matching module is also used to determine the target feature vector from the vector database based on the vector correlation between the first feature vector and the multiple candidate feature vectors in the vector database, and the target feature vector corresponds to a target source label, and the target source label is used to indicate the content source of the candidate data content corresponding to the target feature vector.
[0018] In some embodiments, the determination module is further used to determine the search result of the first search content based on the target source tag.
[0019] In some embodiments, the acquisition module is further used to:
[0020] Acquire the plurality of candidate data contents;
[0021] Performing semantic analysis on the multiple candidate data contents by using the natural language model to obtain the multiple candidate feature vectors;
[0022] The plurality of candidate feature vectors are stored in association with candidate source labels corresponding to the candidate data content to obtain the vector database.
[0023] In some embodiments, the acquisition module is further used to cluster the multiple candidate feature vectors to obtain multiple clusters, each of which includes at least one candidate feature vector corresponding to the same cluster label;
[0024] The matching module is further used to determine a target cluster that meets the matching relationship from multiple clusters based on the matching degree between the first feature vector and the cluster label, wherein the target cluster includes at least one candidate feature vector;
[0025] The matching module is further configured to determine the target feature vector from the target cluster based on a vector association between the first feature vector and the at least one candidate feature vector in the target cluster.
[0026] In some embodiments, the acquisition module is further used to translate the candidate data content according to multiple candidate languages to obtain data content in multiple languages corresponding to the candidate data content;
[0027] The analysis module is further used to perform semantic analysis on the multiple language data contents through the natural language model to obtain the multiple language content feature vectors, the multiple language content feature vectors respectively correspond to language labels, and the multiple language content feature vectors correspond to the same candidate source label;
[0028] The matching module is further used to identify a first language category corresponding to the first search content;
[0029] The matching module is further used to filter and obtain at least one language content feature vector corresponding to the first language category according to the language label;
[0030] The matching module is further configured to determine the target feature vector from the at least one language content feature vector based on a vector correlation between the first feature vector and the at least one language content feature vector.
[0031] In some embodiments, the acquisition module is further used to:
[0032] Obtaining an average feature vector between the first feature vector and the target feature vector;
[0033] The average feature vector is stored in the vector database as the candidate feature vector.
[0034] In some embodiments, the acquisition module is further used to acquire a plurality of sample contents, wherein the plurality of sample contents are respectively annotated with reference semantic tags, and the reference semantic tags are used to indicate the semantics of the sample contents;
[0035] The analysis module is further configured to perform semantic analysis on the plurality of sample contents respectively through a candidate natural language model to obtain corresponding sample feature vectors;
[0036] The analysis module is further used to train the semantic analysis capability of the candidate natural language model based on the difference between the sample feature vector and the reference semantic label to obtain the natural language model.
[0037] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement a retrieval method for a content source as described in any of the above-mentioned embodiments of the present application.
[0038] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement a retrieval method for a content source as described in any of the above-mentioned embodiments of the present application.
[0039] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any of the above-mentioned methods for searching content sources.
[0040] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0041] Through the natural language model, semantic analysis is performed on the content to be retrieved, and the actual meaning of the content to be retrieved is understood, so that the feature vector of the content to be retrieved can represent the content meaning. On the basis of understanding the content meaning, similar content is retrieved based on the vector association, and the content source of the content to be retrieved is determined based on the source of similar content. The retrieval accuracy of similar content can be improved based on the understanding of the content meaning, so that similar content can be accurately found based on the vector association, reducing the amount of invalid retrieval calculations, saving retrieval calculation resources, and improving retrieval efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. 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 creative work.
[0043] Figure 1 is a schematic diagram of a computer system provided by an exemplary embodiment of the present application;
[0044] Figure 2 is a flowchart of a method for retrieving content sources provided by an exemplary embodiment of the present application;
[0045] Figure 3 is a flow chart of a vector matching method provided by an exemplary embodiment of the present application;
[0046] Figure 4 It is a schematic diagram of a search process based on text semantics and image semantics provided by an exemplary embodiment of the present application;
[0047] Figure 5 is a structural block diagram of a retrieval device for content sources provided by an exemplary embodiment of the present application;
[0048] Figure 6 It is a structural block diagram of a terminal provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0050] It should be understood that although the terms first, second, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0051] In the digital age, data retrieval has become a key means of obtaining information. With the rapid development of the Internet and database technology, we are surrounded by massive amounts of data, which makes efficient and accurate data retrieval technology particularly important. In the related technologies, there are two types of data retrieval methods: text-based and image-based. Text retrieval usually uses the longest common substring method to retrieve similar texts, while image retrieval retrieves similar images by extracting image key points based on SIFT. However, due to the large amount of calculation of the above retrieval algorithm, it consumes more computing resources and has low retrieval efficiency.
[0052] The retrieval method for content sources provided in the embodiments of the present application performs semantic analysis on the content to be retrieved through a natural language model to understand the actual meaning of the content to be retrieved, so that the feature vector of the content to be retrieved can represent the content meaning. On the basis of understanding the content meaning, similar content is retrieved based on vector association, so that the content source of the content to be retrieved is determined based on the source of similar content. The retrieval accuracy of similar content can be improved based on the understanding of the content meaning, so that similar content can be accurately found based on vector association, which reduces the amount of invalid retrieval calculations, saves retrieval calculation resources, and improves retrieval efficiency.
[0053] First, the computer system of this application is introduced. Please refer to Figure 1 , which shows a schematic diagram of a computer system provided by an exemplary embodiment of the present application, and the computer system includes: a terminal 10 and a server 20.
[0054] The terminal 10 has a target application installed therein, and the target application may be any application with a data retrieval function, such as an intelligent query program, a retrieval platform, or multimedia software, which is not limited in the embodiment of the present application.
[0055] In some embodiments, the terminal 10 provides a data retrieval function to the user by running a target application. The user can input a first search content in the target application to obtain a content source of the first search content.
[0056] Optionally, the server 20 may be implemented as a background server of a target application program, for providing data retrieval services for the terminal 10 .
[0057] There is a network connection between the terminal 10 and the server 20 .
[0058] Schematically, the terminal 10 obtains and sends the first search content to the server 20. A natural language model is deployed in the server 20. The server 20 receives the first search content, performs semantic analysis on the first search content through the natural language model, and obtains a first feature vector. The first feature vector is used to characterize the semantics of the first search content. Based on the vector correlation between the first feature vector and multiple candidate feature vectors, a target feature vector that meets the correlation requirement with the first feature vector is determined from multiple candidate feature vectors. The multiple candidate feature vectors are feature vectors corresponding to multiple candidate data contents. The multiple candidate feature vectors include the target feature vector. The search result of the first search content is determined based on the content source of the candidate data content corresponding to the target feature vector. The search result is used to indicate the content source of the first search content. The server 20 returns the search result to the terminal 10 for display or broadcasting.
[0059] Optionally, the above natural language model may also be deployed in the terminal 10.
[0060] It is worth noting that the above-mentioned background service content and interaction methods are merely illustrative examples and are not limited to the embodiments of the present application.
[0061] The above-mentioned terminal is optional. The terminal can be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an e-book reader, a Moving Picture Experts Group Audio Layer III (MP3) player, a Moving Picture Experts Group Audio Layer IV (MP4) player, a smart TV, a smart car, and other forms of terminal devices, which are not limited to the embodiments of the present application.
[0062] It is worth noting that the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers. They can also be cloud servers that provide basic cloud computing services such as cloud services, cloud security, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0063] Among them, cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing.
[0064] In some embodiments, the above server can also be implemented as a node in a blockchain system.
[0065] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions. For example, the operation data and account information involved in this application are all obtained with full authorization.
[0066] To further explain, before collecting relevant data of users (for example, search content and content sources involved in this application, etc.) and during the process of collecting relevant data of users, this application can display a prompt interface, pop-up window or output voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of users after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of users are terminated, that is, the relevant data of users are not obtained. In other words, all user data collected by this application are collected with the consent and authorization of the user, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of the relevant regions.
[0067] For illustration, please refer to Figure 2 , which shows a flowchart of a method for searching content sources provided by an exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by both a terminal and a server. The present application embodiment takes the method executed by a terminal as an example for explanation. Figure 2 As shown, the method comprises the following steps:
[0068] Step 210: Obtain the first search content.
[0069] The first search content is data content whose source is to be determined.
[0070] The terminal is installed with a target application, which may be any application with data retrieval function, such as an intelligent query program, a retrieval platform, multimedia software, etc., which is not limited in the embodiments of the present application.
[0071] The first search content may be input by the user based on a search input operation, or may be automatically collected by the target application with authorization, which is not limited in the embodiments of the present application.
[0072] Optionally, the retrieval input operation includes but is not limited to any form of input operation such as text input operation, voice input operation, image transmission operation, gesture command operation, quick query operation, etc., which is not limited in the embodiments of the present application.
[0073] Illustratively, taking the automatic collection of the first search content as an example, the target application can automatically collect the text content as the first search content when it recognizes the text content enclosed in quotation marks; or, when the target application recognizes that a specified area in the program interface displays text content or image content, it automatically captures the program interface image of the specified area as the first search content; or, when the target application includes text content in the program interface whose character count reaches a preset threshold, it automatically reads the text content as the first search content, etc.
[0074] It is worth noting that the above-mentioned method of automatically collecting the first search content is only an illustrative example and is not limited to this in the embodiments of the present application.
[0075] The first search content includes, but is not limited to, text content, image content, video content, audio content, and other content in any media form, which is not limited in this embodiment of the present application.
[0076] The embodiment of the present application is explained by taking the example that the first search content includes at least one of text content and image content, wherein, if the first search content includes video content, the video content can be converted into multiple image contents for retrieval, and if the first search content includes audio content, the audio content can be converted into text content for retrieval (for example, lyrics text, note text, noise signal numerical text, dialogue text, natural language text, etc.).
[0077] It is worth noting that the above content processing method is only an illustrative example and is not limited to this in the embodiments of the present application.
[0078] Step 220: Perform semantic analysis on the first search content through a natural language model to obtain a first feature vector.
[0079] The first feature vector is used to represent the semantics of the first search content.
[0080] Taking the example that the first search content includes text content, the first feature vector is used to represent the text semantics of the text content.
[0081] Taking the example that the first search content includes image content, the first feature vector is used to represent the image meaning of the image content.
[0082] When the first search content includes both text content and image content, the text content and the image content can be split and processed, or the corresponding processing method can be determined according to the content ratio. For example, when the text information included in the image represented as image content occupies 80% of the image area, the text content can be extracted from the image content through algorithms such as Optical Character Recognition (OCR) to participate in the retrieval calculation. The embodiments of the present application are not limited to this.
[0083] The natural language model is a machine learning model with semantic analysis capabilities.
[0084] Optionally, for the first search content including image content, a singular value decomposition (SVD) algorithm may be first used to compress the image content to obtain compressed first search content, and a semantic analysis is performed on the compressed first search content through a natural language model to obtain a first feature vector.
[0085] In some embodiments, the retrieval method for content sources provided by the embodiments of the present application also includes a training process of a natural language model.
[0086] Schematically, the training process includes obtaining multiple sample contents, each of which is marked with a reference semantic label, performing semantic analysis on the multiple sample contents through a candidate natural language model to obtain a sample feature vector, and training the semantic analysis capability of the candidate natural language model based on the difference between the sample feature vector and the reference semantic label to obtain a natural language model.
[0087] Schematically, the prediction loss is determined based on the difference between the sample feature vector and the reference semantic label, and the candidate natural language model is trained based on the prediction loss until the training conditions are met to obtain a natural language model.
[0088] The training conditions include but are not limited to at least one of the following: the prediction loss converges, the prediction loss value is less than a preset loss threshold, and the number of training times reaches a preset number threshold.
[0089] Reference semantic tags are used to indicate the semantics of the sample content.
[0090] Illustratively, for the sample image content, the reference semantic labels may include image categories (for example, "this is a notification", "this is a cartoon", "this is a poster", etc.), object or scene categories in the image (for example, "portrait", "animal", "amusement park", etc.), image sentiment analysis content (for example, "sad", "cheerful", "lonely", etc.), and any other label content that can represent the meaning of the image, which is not limited in the embodiments of the present application.
[0091] It is worth noting that the above training method is only an illustrative example and is not limited to this embodiment of the present application.
[0092] Step 230 : Based on the vector association degree between the first feature vector and the plurality of candidate feature vectors, determine a target feature vector from the plurality of candidate feature vectors that meets the association degree requirement with the first feature vector.
[0093] The multiple candidate feature vectors are feature vectors corresponding to multiple candidate data contents, and the multiple candidate feature vectors include a target feature vector.
[0094] The vector relevance is used to represent the similarity or difference between the first search content and the candidate search content.
[0095] The vector association degree includes but is not limited to at least one kind of association data such as similarity, correlation, and difference between the first feature vector and the candidate feature vector.
[0096] Illustratively, the embodiment of the present application is described by taking the example that the vector relevance includes the vector similarity between the first vector feature and the candidate vector feature, and the terminal can determine the vector similarity between the first feature vector and the candidate feature vector by using a preset similarity algorithm.
[0097] Optionally, the preset similarity algorithm includes but is not limited to Euclidean distance, cosine similarity, Manhattan distance, Jaccard Similarity, Pearson Correlation Coefficient, Spearman's Rank Correlation Coefficient, Mahalanobis Distance, Dot Product, Vector Norm, Edit Distance and other algorithms, which are not limited in the embodiments of the present application.
[0098] Illustratively, the relevance requirement includes but is not limited to at least one of the vector similarity reaching a similarity threshold and the vector similarity being the highest.
[0099] The target feature vector is a feature vector of the candidate data content whose content meaning is most related to the first search content.
[0100] Schematically, the process of determining the target feature vector includes obtaining a vector database, the vector database including multiple candidate feature vectors corresponding to multiple candidate data contents, the candidate feature vectors corresponding to candidate source tags, the candidate source tags are used to indicate the candidate content source of the candidate data content corresponding to the candidate feature vector; based on the vector correlation between the first feature vector and multiple candidate feature vectors in the vector database, determining the target feature vector from the vector database.
[0101] In some embodiments, it is necessary to pre-build a vector database. Schematically, multiple candidate data contents are obtained, semantic analysis is performed on the multiple candidate data contents through a natural language model to obtain multiple candidate feature vectors, and the multiple candidate feature vectors are associated and stored with candidate source labels corresponding to the candidate data contents to obtain a vector database.
[0102] The multiple candidate data contents may include search contents received by the target application within a historical time period, or may include data contents from other determined sources, which is not limited in this embodiment of the present application.
[0103] In some embodiments, in order to further reduce retrieval computing resources, when constructing a vector database, multiple candidate feature vectors can be clustered to obtain multiple cluster clusters, and the cluster cluster includes at least one candidate feature vector corresponding to the same cluster label. Then, when determining the target feature vector based on the vector correlation, the target cluster cluster that meets the matching relationship can be determined from multiple cluster clusters based on the matching degree between the first feature vector and the cluster label. The target cluster cluster includes at least one candidate feature vector. Based on the vector correlation between the first feature vector and at least one candidate feature vector in the target cluster cluster, the target feature vector is determined from the target cluster cluster. This can avoid vector correlation calculation between the first feature vector and each candidate feature vector, save computing resources, and improve retrieval efficiency.
[0104] Optionally, a K-Means clustering method may be used for clustering to obtain multiple clusters.
[0105] Schematically, K candidate feature vectors are randomly selected as cluster centers, where K is a positive integer and is less than the number of candidate feature vectors in a vector database; each candidate feature vector is assigned to the cluster center with the highest similarity to form multiple clusters; the average feature vector of at least one candidate feature vector in each cluster is calculated and updated as the cluster center, and each candidate feature vector is reassigned to the cluster center with the highest similarity until the degree of change in the cluster center is less than a preset Chengdu threshold, thereby obtaining multiple cluster clusters.
[0106] Optionally, clustering may also be performed using a pre-trained clustering model.
[0107] The training process of the cluster partition model includes: obtaining multiple sample feature vectors, presetting cluster partition labels for the multiple sample feature vectors, and the cluster partition labels are used to indicate the cluster distribution of the multiple sample feature vectors; clustering the multiple candidate feature vectors through a candidate cluster partition model to obtain a cluster partition result, and the candidate cluster partition model is a machine learning model for cluster partition feature vectors; training the candidate cluster partition model based on the difference between the cluster partition label and the cluster partition result to obtain a cluster partition model.
[0108] It is worth noting that the above-mentioned clustering division method and the training method of the clustering division model are only illustrative examples and are not limited to the embodiments of the present application.
[0109] In order to improve the retrieval accuracy, feature vectors corresponding to different languages may also be constructed for the same candidate content, thereby avoiding inaccurate retrieval when the content has the same meaning but is in different languages.
[0110] Schematically, the candidate data content is translated according to multiple candidate languages to obtain multiple language data contents corresponding to the candidate data content, and the multiple language data contents are semantically analyzed through a natural language model to obtain multiple language content feature vectors, wherein the multiple language content feature vectors correspond to different language labels, and the multiple language content feature vectors correspond to the same candidate source label. When retrieving a target feature vector, the first language category corresponding to the first search content is identified, and at least one language content feature vector corresponding to the first language category is obtained by screening according to the language label, and the target feature vector is determined from the at least one language content feature vector based on the vector correlation between the first feature vector and the at least one language content feature vector.
[0111] Step 240: Determine the search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector.
[0112] The search result is used to indicate the content source of the first search content.
[0113] The content source includes but is not limited to at least one source information such as the publishing platform of the first search content, the source of the excerpt, the creator, the object that first published the first search content in a historical time period, etc., and the embodiments of the present application are not limited to this.
[0114] In some embodiments, the target feature vector corresponds to a target source tag, and the target source tag is used to indicate the content source of the candidate data content corresponding to the target feature vector.
[0115] Optionally, the search result of the first search content is determined based on the target source tag.
[0116] Illustratively, the first search content includes text segment A, and the candidate data content corresponding to the target feature vector retrieved based on the vector association includes text segment B. The target source label corresponding to text segment B indicates that text segment B is excerpted from work C, then work C is determined as the content source of text segment A as the search result output.
[0117] In some embodiments, after the search result of the first search content is determined based on the target feature vector, a plurality of candidate feature vectors may be updated based on the first feature vector.
[0118] Illustratively, the first feature vector may be stored in a vector database as a candidate feature vector, or an average feature vector of the first feature vector and the target feature vector may be updated as a candidate feature vector, etc., which is not limited in the embodiments of the present application.
[0119] To summarize, the method provided in the embodiment of the present application performs semantic analysis on the content to be retrieved through a natural language model to understand the actual meaning of the content to be retrieved, so that the feature vector of the content to be retrieved can represent the content meaning. On the basis of understanding the content meaning, similar content is retrieved based on vector association, and the content source of the content to be retrieved is determined based on the source of similar content. The retrieval accuracy of similar content can be improved based on the understanding of the content meaning, so that similar content can be accurately found based on vector association, reducing the amount of invalid retrieval calculations, saving retrieval calculation resources, and improving retrieval efficiency.
[0120] In some embodiments, a vector database is pre-built to store multiple candidate feature vectors. Figure 3 , Figure 3 is a flow chart of a vector matching method provided by an exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by both a terminal and a server. The present application embodiment takes the method executed by a terminal as an example for explanation. Figure 3 As shown, the above step 230 includes the following steps:
[0121] Step 231, obtaining a vector database.
[0122] The vector database includes multiple candidate feature vectors corresponding to multiple candidate data contents. The candidate feature vectors correspond to candidate source tags, and the candidate source tags are used to indicate the candidate content sources of the candidate data contents corresponding to the candidate feature vectors.
[0123] The multiple candidate data contents may include search contents received by the target application within a historical time period, or may include data contents from other determined sources, which is not limited in this embodiment of the present application.
[0124] In some embodiments, in order to further reduce retrieval computing resources, when constructing a vector database, multiple candidate feature vectors can be clustered to obtain multiple cluster clusters, and the cluster clusters include at least one candidate feature vector corresponding to the same cluster label. Therefore, when determining the target feature vector based on the vector correlation, the target cluster cluster that meets the matching relationship can be determined from multiple cluster clusters based on the matching degree between the first feature vector and the cluster label, and the target cluster cluster includes at least one candidate feature vector. Based on the vector correlation between the first feature vector and at least one candidate feature vector in the target cluster cluster, the target feature vector is determined from the target cluster cluster, which can avoid calculating the vector correlation between the first feature vector and each candidate feature vector, saving computing resources and improving retrieval efficiency.
[0125] The cluster label may be an average feature vector corresponding to at least one candidate feature vector in the same cluster.
[0126] Optionally, determining the degree of match between the first feature vector and the cluster label includes determining a vector correlation between the first feature vector and an average feature vector of the cluster, and the matching relationship includes that the vector correlation meets a correlation requirement.
[0127] The method provided in the embodiment of the present application can reduce the calculation of vector association during the retrieval process, save computing resources, and improve retrieval efficiency by clustering multiple candidate feature vectors and screening target cluster clusters based on cluster labels.
[0128] In some embodiments, at least one candidate feature vector in the cluster may be divided into fields to obtain candidate feature vectors corresponding to a plurality of field categories, and the candidate feature vectors are classified and stored according to the field categories.
[0129] When retrieving the target feature vector, the first domain category corresponding to the first feature vector may also be identified. After determining the target cluster, the candidate feature vectors belonging to the first domain category in the target cluster are screened to perform vector correlation calculation with the first feature vector.
[0130] The method provided in the embodiment of the present application realizes further classification and division of similar feature vectors by performing field division on candidate feature vectors in the same cluster, so that during retrieval, candidate feature vectors belonging to the same field can be accurately matched to participate in vector correlation calculation, thereby further reducing the amount of calculation and improving retrieval accuracy by ensuring the field relevance of data content.
[0131] In some embodiments, in order to improve the retrieval accuracy, feature vectors corresponding to different languages may be constructed for the same candidate content, thereby avoiding inaccurate retrieval when the content has the same meaning but is in different languages.
[0132] Schematically, the candidate data content is translated according to multiple candidate languages to obtain multiple language data contents corresponding to the candidate data content, and the multiple language data contents are semantically analyzed through a natural language model to obtain multiple language content feature vectors, wherein the multiple language content feature vectors correspond to different language labels, and the multiple language content feature vectors correspond to the same candidate source label. When retrieving a target feature vector, the first language category corresponding to the first search content is identified, and at least one language content feature vector corresponding to the first language category is obtained by screening according to the language label, and the target feature vector is determined from the at least one language content feature vector based on the vector correlation between the first feature vector and the at least one language content feature vector.
[0133] Optionally, in order to reduce the waste of storage resources caused by too many languages requiring to store too many language content feature vectors for a single candidate data content, a small number of feature vectors corresponding to language categories can be constructed for the same candidate content. Before searching, the first search content is translated into the specified language category, and the feature vector is extracted as the first feature vector to participate in the search calculation, wherein the small number of language categories used when constructing the vector database are related to the usage area of the terminal device, or the language category used by the terminal device.
[0134] In some embodiments, when the language content feature vector of the first language category is not stored in the vector database, after determining the target feature vector, the first feature vector can be stored in the vector database as the candidate data content corresponding to the target feature vector based on the language content feature vector of the first language category.
[0135] The method provided in the embodiment of the present application can avoid the inability to accurately retrieve similar content due to different languages used in the content by adding language content feature vectors of different language categories to the candidate data content to participate in the retrieval calculation, thereby improving the retrieval accuracy and efficiency.
[0136] Step 232: Determine a target feature vector from the vector database based on the vector association between the first feature vector and a plurality of candidate feature vectors in the vector database.
[0137] The target feature vector corresponds to a target source label, and the target source label is used to indicate the content source of the candidate data content corresponding to the target feature vector.
[0138] If the vector correlation between the retrieved single target feature vector and the first feature vector meets the correlation requirement, the target source label corresponding to the target feature vector is used as the search result of the first search content.
[0139] If the vector correlations between the retrieved multiple target feature vectors and the first feature vector meet the correlation requirement, the multiple target source tags may be scored, and the search results of the first search content may be determined based on the scores.
[0140] Illustratively, if multiple target source tags include at least two identical target source tags, scoring is performed based on the number of identical target source tags, wherein the target source tag with the largest number of repetitions has the highest score, that is, the target source tag with the largest number of repetitions is used as the retrieval result of the first search content.
[0141] In some embodiments, if the number of multiple target feature vectors is greater than a first quantity threshold, the target source tag with the highest vector correlation is used as the retrieval result of the first retrieval content; if the number of multiple target feature vectors is less than a second quantity threshold, the first retrieval content is retrieved in sequence according to the content sources indicated by the multiple target source tags, and the target source tag of the retrieved first retrieval content is used as the retrieval result of the first retrieval content, wherein the first quantity threshold is greater than the second quantity threshold.
[0142] For illustration, please refer to Figure 4 , Figure 4 is a schematic diagram of a search process based on text semantics and image semantics provided by an exemplary embodiment of the present application. Figure 4 As shown, a vector database is pre-built, and step 410 is executed to generate feature vectors (embedding) for massive texts and pictures using a natural language model and store them in the vector database. During the retrieval process, steps 401 to 405 are executed in sequence. Step 401, obtain the text and pictures to be retrieved; step 402, generate embeddings for the text through a natural language model, and for pictures, first use the SVD algorithm to compress the pictures, and then use the natural language model to extract feature vectors for the pictures or texts; step 403, retrieve the feature vectors of the text or image; step 404, find the index corresponding to the most similar vector in the vector database; step 405, output the original source of the text and picture to be found.
[0143] In some embodiments, a preset text reading tool can be used to batch read text documents or text content in Portable Document Format (PDF), and a pre-trained natural language model can be used to perform semantic analysis to obtain feature vectors corresponding to the text content and store them in a vector database; for texts to be retrieved, the natural language model can be used to directly generate feature vectors for retrieval. For images, SVD is used to compress them first and then extract feature vectors.
[0144] To sum up, the method provided in the embodiment of the present application, by constructing a vector database, retrieves the content sources of data content with similar meanings as the search results, can simplify the search logic process, improve the search efficiency, speed up the search, perform searches based on the understanding of the content meaning, and improve the search accuracy.
[0145] The method provided in the embodiment of the present application implements a retrieval scheme based on text semantic understanding for text content, which can improve the accuracy of text retrieval; for image content, the SVD algorithm is used to compress the image and then extract the feature vector for retrieval, which reduces the amount of retrieval calculations for similar images, can speed up the retrieval process, and improve the efficiency of image retrieval.
[0146] Figure 5 is a structural block diagram of a retrieval device for content sources provided by an exemplary embodiment of the present application, such as Figure 5 As shown, the device includes the following parts:
[0147] An acquisition module 510 is used to acquire a first search content, where the first search content is data content whose source is to be determined;
[0148] An analysis module 520 is used to perform semantic analysis on the first search content through a natural language model to obtain a first feature vector, where the first feature vector is used to represent the semantics of the first search content;
[0149] A matching module 530 is used to determine, based on the vector correlation between the first feature vector and a plurality of candidate feature vectors, a target feature vector that meets the correlation requirement with the first feature vector from the plurality of candidate feature vectors, the plurality of candidate feature vectors being feature vectors corresponding to a plurality of candidate data contents, the plurality of candidate feature vectors including the target feature vector;
[0150] The determination module 540 is used to determine the search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector, and the search result is used to indicate the content source of the first search content.
[0151] In some embodiments, the acquisition module 510 is further used to acquire a vector database, wherein the vector database includes the plurality of candidate feature vectors corresponding to the plurality of candidate data contents, the candidate feature vectors corresponding to candidate source tags, and the candidate source tags are used to indicate candidate content sources of the candidate data contents corresponding to the candidate feature vectors;
[0152] The matching module 530 is also used to determine the target feature vector from the vector database based on the vector correlation between the first feature vector and the multiple candidate feature vectors in the vector database, and the target feature vector corresponds to a target source label, and the target source label is used to indicate the content source of the candidate data content corresponding to the target feature vector.
[0153] In some embodiments, the determination module 540 is further configured to determine the search result of the first search content based on the target source tag.
[0154] In some embodiments, the acquisition module 510 is further used to:
[0155] Acquire the plurality of candidate data contents;
[0156] Performing semantic analysis on the multiple candidate data contents by using the natural language model to obtain the multiple candidate feature vectors;
[0157] The plurality of candidate feature vectors are stored in association with candidate source labels corresponding to the candidate data content to obtain the vector database.
[0158] In some embodiments, the acquisition module 510 is further used to cluster the multiple candidate feature vectors to obtain multiple clusters, each of which includes at least one candidate feature vector corresponding to the same cluster label;
[0159] The matching module 530 is further configured to determine a target cluster that meets the matching relationship from multiple clusters based on the matching degree between the first feature vector and the cluster label, wherein the target cluster includes at least one candidate feature vector;
[0160] The matching module 530 is further configured to determine the target feature vector from the target cluster based on the vector association between the first feature vector and the at least one candidate feature vector in the target cluster.
[0161] In some embodiments, the acquisition module 510 is further used to translate the candidate data content according to multiple candidate languages to obtain data content in multiple languages corresponding to the candidate data content;
[0162] The analysis module 520 is further configured to perform semantic analysis on the multiple language data contents through the natural language model to obtain the multiple language content feature vectors, wherein the multiple language content feature vectors respectively correspond to language labels, and the multiple language content feature vectors correspond to the same candidate source label;
[0163] The matching module 530 is further configured to identify a first language category corresponding to the first search content;
[0164] The matching module 530 is further configured to filter and obtain at least one language content feature vector corresponding to the first language category according to the language label;
[0165] The matching module 530 is further configured to determine the target feature vector from the at least one language content feature vector based on the vector correlation between the first feature vector and the at least one language content feature vector.
[0166] In some embodiments, the acquisition module 510 is further used to:
[0167] Obtaining an average feature vector between the first feature vector and the target feature vector;
[0168] The average feature vector is stored in the vector database as the candidate feature vector.
[0169] In some embodiments, the acquisition module 510 is further used to acquire a plurality of sample contents, wherein the plurality of sample contents are respectively annotated with reference semantic tags, and the reference semantic tags are used to indicate the semantics of the sample contents;
[0170] The analysis module 520 is further configured to perform semantic analysis on the plurality of sample contents respectively through a candidate natural language model to obtain corresponding sample feature vectors;
[0171] The analysis module 520 is further used to train the semantic analysis capability of the candidate natural language model based on the difference between the sample feature vector and the reference semantic label to obtain the natural language model.
[0172] To summarize, the device provided in the embodiment of the present application performs semantic analysis on the content to be retrieved through a natural language model to understand the actual meaning of the content to be retrieved, so that the feature vector of the content to be retrieved can represent the content meaning. On the basis of understanding the content meaning, similar content is retrieved based on vector association, and the content source of the content to be retrieved is determined based on the source of similar content. The retrieval accuracy of similar content can be improved based on the understanding of the content meaning, so that similar content can be accurately found based on vector association, reducing the amount of invalid retrieval calculations, saving retrieval calculation resources, and improving retrieval efficiency.
[0173] It should be noted that the retrieval device for content sources provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0174] Figure 6 The structure block diagram of a terminal 600 provided by an exemplary embodiment of the present application is shown. The terminal 600 may be: a smart phone, a tablet computer, an MP3 player, an MP4 player, a notebook computer or a desktop computer. The terminal 600 may also be called a user equipment, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0175] Typically, the terminal 600 includes a processor 601 and a memory 602 .
[0176] The processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 601 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 601 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 601 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0177] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one instruction, which is used to be executed by the processor 601 to implement the retrieval method for the content source provided by the method embodiment of the present application.
[0178] In some embodiments, the terminal 600 further includes other components 603, which can be understood by those skilled in the art. Figure 6The structure shown in the figure does not constitute a limitation on the terminal 600, and the terminal 600 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0179] The embodiment of the present application also provides a computer device, which can be implemented as follows: Figure 1 The computer device includes a processor and a memory, wherein at least one instruction, at least one program, code set or instruction set is stored in the memory, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the retrieval method for content sources provided by the above-mentioned method embodiments.
[0180] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the retrieval method for content sources provided in the above-mentioned method embodiments.
[0181] The embodiments of the present application also provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the retrieval method for the content source provided by the above-mentioned method embodiments.
[0182] Optionally, the computer readable storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), Solid State Drives (SSD) or optical disks, etc. Among them, the random access memory may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0183] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0184] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for searching content sources, characterized in that: The method comprises: Acquire a first search content, where the first search content is data content whose content source is to be determined; Performing semantic analysis on the first search content through a natural language model to obtain a first feature vector, where the first feature vector is used to represent the semantics of the first search content; Based on the vector association degree between the first feature vector and a plurality of candidate feature vectors, determining a target feature vector that meets the association degree requirement with the first feature vector from the plurality of candidate feature vectors, the plurality of candidate feature vectors being feature vectors corresponding to a plurality of candidate data contents, the plurality of candidate feature vectors including the target feature vector; A search result of the first search content is determined based on the content source of the candidate data content corresponding to the target feature vector, and the search result is used to indicate the content source of the first search content.
2. The method according to claim 1, characterized in that The determining, based on the vector correlation between the first feature vector and a plurality of candidate feature vectors, a target feature vector that meets the correlation requirement with the first feature vector from the plurality of candidate feature vectors includes: Acquire a vector database, wherein the vector database includes the plurality of candidate feature vectors corresponding to the plurality of candidate data contents, the candidate feature vectors corresponding to candidate source tags, and the candidate source tags are used to indicate candidate content sources of the candidate data contents corresponding to the candidate feature vectors; Based on the vector correlation between the first feature vector and the multiple candidate feature vectors in the vector database, the target feature vector is determined from the vector database, and the target feature vector corresponds to a target source label, and the target source label is used to indicate the content source of the candidate data content corresponding to the target feature vector.
3. The method according to claim 2, characterized in that The determining the search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector includes: The search result of the first search content is determined based on the target source tag.
4. The method according to claim 2, characterized in that: The step of acquiring a vector database comprises: Acquire the plurality of candidate data contents; Performing semantic analysis on the multiple candidate data contents by using the natural language model to obtain the multiple candidate feature vectors; The plurality of candidate feature vectors are stored in association with candidate source labels corresponding to the candidate data content to obtain the vector database.
5. The method according to claim 4, characterized in that The method further comprises: Clustering the multiple candidate feature vectors to obtain multiple clusters, each of which includes at least one candidate feature vector corresponding to the same cluster label; The determining the target feature vector from the vector database based on the vector association degree between the first feature vector and the plurality of candidate feature vectors in the vector database comprises: Based on the matching degree between the first feature vector and the cluster label, determining a target cluster cluster that meets the matching relationship from multiple cluster clusters, wherein the target cluster cluster includes at least one candidate feature vector; The target feature vector is determined from the target cluster based on a vector association between the first feature vector and the at least one candidate feature vector in the target cluster.
6. The method according to claim 4, characterized in that The method further comprises: Translating the candidate data content according to multiple candidate languages to obtain data content in multiple languages corresponding to the candidate data content; Performing semantic analysis on the data contents of the multiple languages by using the natural language model to obtain the multiple language content feature vectors, wherein the multiple language content feature vectors respectively correspond to language labels, and the multiple language content feature vectors correspond to the same candidate source label; The determining the target feature vector from the vector database based on the vector association degree between the first feature vector and the plurality of candidate feature vectors in the vector database comprises: Identifying a first language category corresponding to the first search content; Filtering according to the language label to obtain at least one language content feature vector corresponding to the first language category; The target feature vector is determined from the at least one language content feature vector based on the vector correlation between the first feature vector and the at least one language content feature vector.
7. The method according to claim 4, characterized in that After determining the search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector, the method further includes: Obtaining an average feature vector between the first feature vector and the target feature vector; The average feature vector is stored in the vector database as the candidate feature vector.
8. The method according to any one of claims 1 to 7, characterized in that: Before performing semantic analysis on the first search content by using a natural language model to obtain a first feature vector, the method further includes: Acquire a plurality of sample contents, wherein the plurality of sample contents are respectively annotated with reference semantic tags, and the reference semantic tags are used to indicate the semantics of the sample contents; Performing semantic analysis on the plurality of sample contents respectively through a candidate natural language model to obtain corresponding sample feature vectors; The semantic analysis capability of the candidate natural language model is trained based on the difference between the sample feature vector and the reference semantic label to obtain the natural language model.
9. A search device for content sources, characterized in that: The device comprises: An acquisition module, used to acquire first search content, wherein the first search content is data content whose content source is to be determined; An analysis module, configured to perform semantic analysis on the first search content through a natural language model to obtain a first feature vector, wherein the first feature vector is used to represent the semantics of the first search content; a matching module, configured to determine, based on a vector correlation between the first feature vector and a plurality of candidate feature vectors, a target feature vector that meets a correlation requirement with the first feature vector from the plurality of candidate feature vectors, the plurality of candidate feature vectors being feature vectors corresponding to a plurality of candidate data contents, the plurality of candidate feature vectors including the target feature vector; A determination module is used to determine a search result of the first search content based on the content source of the candidate data content corresponding to the target feature vector, wherein the search result is used to indicate the content source of the first search content.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the content source retrieval method according to any one of claims 1 to 8.