Text matching method, device and equipment and computer readable storage medium

By constructing a graph model to calculate the vector representations of historical search terms and documents, the problem of low efficiency and low accuracy in training sample generation in existing technologies is solved, achieving efficient and accurate training sample set generation and improving the performance of text matching models.

CN113407704BActive Publication Date: 2026-07-24TENCENT TECH (BEIJING) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECH (BEIJING) CO LTD
Filing Date
2021-02-05
Publication Date
2026-07-24

Smart Images

  • Figure CN113407704B_ABST
    Figure CN113407704B_ABST
Patent Text Reader

Abstract

The application provides a text matching method, device and equipment and a computer readable storage medium, and applies to the field of artificial intelligence technology; the method comprises the following steps: receiving a search word submitted by each client; according to the search word, at least one matched document is matched from a preset document resource library by using a text matching model; the training sample used by the text matching model is combined data obtained by combining a historical search word and a historical matched document in historical search session information; the annotation information of the training sample is obtained by calculating the vector representation of the historical search word and the historical matched document by using a graph model, and is obtained by classifying and annotating the correlation of the combined data based on the vector representation; the graph model is constructed by a plurality of historical search session information; a search result page is generated according to the at least one matched document, and the search result page is correspondingly pushed to each client for display. Through the application, the efficiency of generating the training sample and the accuracy of the text matching model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a text matching method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] Currently, there are two common methods for generating training sample data for text matching models in Natural Language Processing (NLP): First, through manual annotation; this method has high accuracy but low production efficiency, and the number of samples generated is unlikely to reach tens of millions. Second, by directly filtering search click logs; this method can obtain a large amount of training sample data, but is affected by search ranking models, resulting in less semantic information covered by the samples and lower accuracy. Therefore, using training sample data generated by either of these methods to train a text matching model will reduce the accuracy of text matching. Summary of the Invention

[0003] This application provides a text matching method, apparatus, device, and computer-readable storage medium, which can improve the efficiency of generating training samples and the accuracy of text matching models.

[0004] The technical solution of this application embodiment is implemented as follows: This application provides a text matching method, including: Receive search terms submitted by each client; Based on the search term, a text matching model is used to match at least one matching document from a preset document resource library; the training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents from historical search session information; the annotation information of the training samples is obtained by calculating the vector representation of the historical search terms and the historical matching documents through a graph model, and classifying and labeling the combined data based on the vector representation; the graph model is constructed from multiple historical search session information, and the graph model represents the click relationship between historical search terms and historical matching documents; A search results page is generated based on the at least one matching document, and the search results page is pushed to each client for display.

[0005] In the above method, before matching at least one target document from a preset document resource library using a text matching model based on the search term, the method further includes: Extract multiple historical search session information containing click events from a preset historical search record library; each of the multiple historical search session information contains a historical search term and at least one historical matching document corresponding to the historical search term; Each historical search term and each historical matching document in the multiple historical search session information is used as a point element. The connection relationship between the point elements is obtained according to the click relationship between the historical search term and at least one historical matching document in each historical search session information, thereby constructing the graph model. Based on the graph model, the search term vector representation of each historical search term and the document vector representation of each historical matching document are calculated. Each historical search term is combined with each historical matching document to obtain a combined data set; Based on the search term vector representation and the document vector representation, the similarity of each combination of data in the combined data is obtained, and each combination of data is classified and labeled based on the similarity to obtain a training sample set; The initial text matching model is trained using the training sample set to obtain the text matching model.

[0006] In the above method, the step of classifying and labeling the relevance of each combination of data in the combined data based on the search term vector representation and the document vector representation to obtain a training sample set includes: For each combination of data, the cosine distance corresponding to each combination of data is calculated based on the search term vector representation of the historical search terms and the document vector representation of the historical matching documents in the combination of data. When the cosine distance is greater than a first preset distance threshold, each combination of data is labeled as a relevant sample; or, when the cosine distance is less than a second preset distance threshold, each combination of data is labeled as an irrelevant sample; wherein, the first preset distance threshold is greater than the second preset distance threshold. Each labeled combination of data is used as a training sample, thus obtaining the training sample set.

[0007] In the above method, each historical search session information includes behavioral sequence information of the historical search term and the at least one historical matching document, wherein the behavioral sequence information represents the order in which the historical search term and the at least one historical matching document appear; the step of using each historical search term and each historical matching document in the plurality of historical search session information as point elements, and obtaining the connection relationship between the point elements according to the click relationship between the historical search term and the at least one historical matching document in each historical search session information, thereby constructing the graph model, includes: Each historical search term and each historical matching document are used as point elements. In each historical search session information, the adjacent order relationship between the point elements corresponding to the historical search session information is obtained based on the behavior sequence information contained in the historical search session information. Based on the adjacent order relationship, the directed connection paths between the point elements corresponding to the historical search session information are obtained, and then a directed graph model is constructed based on each historical search session information as the graph model.

[0008] In the above method, calculating the search term vector representation of each historical search term and the document vector representation of each historical matched document based on the graph model includes: Starting from each point element in the set of point elements, random pathfinding is performed in the directed graph model according to the connection path and recorded as the current pathfinding path. When the pathfinding reaches a point element with no other connection path, or when the length of the current pathfinding path reaches a preset length threshold, a pathfinding sequence corresponding to each point element is generated according to the current pathfinding path, thereby obtaining a set of pathfinding sequences. Using a sequence vector transformation algorithm, the vector representation of each point element in each pathfinding sequence is calculated in the pathfinding sequence set, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0009] In the above method, each historical search session information includes the click relationship between the historical search term and the at least one historical matching document. The step of obtaining the connection relationship between the point elements based on the click relationship between the historical search term and the at least one historical matching document in each historical search session information, thereby constructing the graph model, includes: In each historical search session information, the connection relationship between the point elements corresponding to the historical search session information is obtained according to the click relationship, and a click bipartite graph is constructed based on the connection relationship as the graph model.

[0010] In the above method, calculating the search term vector representation of each historical search term and the document vector representation of each historical matched document based on the graph model includes: Each historical search term is segmented into words, and based on the segmentation results of each historical search term, an initial search term vector representation of each historical search term is obtained; In the first iteration, in the click bipartite graph, for each historical matching document, the initial document vector representation of each historical matching document is obtained by weighted averaging the initial search term vector representations of the historical search terms that are connected to each historical matching document. In the click bipartite graph, for each historical search term, the initial document vector representations of the historical matching documents that are connected to each historical search term are weighted and averaged to obtain the intermediate search term vector representation of each historical search term; The next iteration is performed based on the intermediate search term vector representation of each historical search term. In the next iteration, the initial document vector representation of each historical matching document is updated according to the intermediate search term vector representation to obtain the intermediate document vector representation of each historical matching document. The iteration continues until the preset iteration condition is reached, and the search term vector representation of each historical search term and the document vector representation of each historical matching document are obtained.

[0011] This application provides a text matching device, including:

[0012] The receiving module is used to receive the search terms submitted by each client; A text matching model is used to match at least one matching document from a preset document resource library based on the search term. The training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents from historical search session information. The annotation information of the training samples is obtained by calculating the vector representations of the historical search terms and the historical matching documents through a graph model, and classifying and labeling the combined data based on the relevance of the vector representations. The graph model is constructed from multiple historical search session information and represents the click relationship between historical search terms and historical matching documents. The push module is used to generate a search results page based on the at least one matching document, and push the search results page to each client for display.

[0013] In the above-described device, the text matching device further includes a training sample generation module, which is used to extract multiple historical search session information containing click events from a preset historical search record library before matching at least one target document from a preset document resource library using a text matching model based on the search term; each of the multiple historical search session information contains a historical search term and at least one historical matching document corresponding to the historical search term; Each historical search term and each historical matching document in the multiple historical search session information is used as a point element. The connection relationship between the point elements is obtained according to the click relationship between the historical search term and at least one historical matching document in each historical search session information, thereby constructing the graph model. Based on the graph model, the search term vector representation of each historical search term and the document vector representation of each historical matching document are calculated. Each historical search term and each historical matching document are combined to obtain a combined data set. Based on the search term vector representation and the document vector representation, the similarity of each combined data in the combined data is obtained. Based on the similarity, each combined data is classified and labeled to obtain a training sample set. The initial text matching model is trained using the training sample set to obtain the text matching model.

[0014] In the above-described apparatus, the training sample generation module is further configured to, for each combination of data, calculate the cosine distance corresponding to each combination of data based on the search term vector representation of the historical search terms and the document vector representation of the historical matching documents in the combination of data; when the cosine distance is greater than a first preset distance threshold, label each combination of data as a relevant sample; or, when the cosine distance is less than a second preset distance threshold, label each combination of data as an irrelevant sample; wherein, the first preset distance threshold is greater than the second preset distance threshold; and use each labeled combination of data as a training sample to obtain the training sample set.

[0015] In the above apparatus, each historical search session information includes behavioral sequence information of the historical search term and the at least one historical matching document, wherein the behavioral sequence information represents the occurrence order of the historical search term and the at least one historical matching document; the training sample generation module is further configured to use each historical search term and each historical matching document as point elements, and in each historical search session information, obtain the adjacency order relationship between the point elements corresponding to the historical search session information based on the behavioral sequence information contained in the historical search session information; obtain the directed connection path between the point elements corresponding to the historical search session information based on the adjacency order relationship, and then construct a directed graph model as the graph model based on each historical search session information.

[0016] In the above-described apparatus, the training sample generation module is further configured to take each point element in the point element set as a starting point, perform random pathfinding in the directed graph model according to the connection path, and record it as the current pathfinding path. When the pathfinding reaches a point element with no other connection path, or when the length of the current pathfinding path reaches a preset length threshold, the module generates a pathfinding sequence corresponding to each point element according to the current pathfinding path, thereby obtaining a pathfinding sequence set. Using a sequence vector conversion algorithm, the module calculates the vector representation of each point element in each pathfinding sequence in the pathfinding sequence set, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0017] In the above device, each historical search session information includes the click relationship between the historical search term and the at least one historical matching document. The training sample generation module is further configured to obtain the connection relationship between the point elements corresponding to the historical search session information in each historical search session information according to the click relationship, and construct a click bipartite graph as the graph model based on the connection relationship.

[0018] In the aforementioned apparatus, the training sample generation module is further configured to segment each historical search term, and based on the segmentation results of each historical search term, obtain an initial search term vector representation for each historical search term; in the first iteration, in the click bipartite graph, for each historical matching document, a weighted average is performed using the initial search term vector representations of historical search terms connected to each historical matching document to obtain an initial document vector representation for each historical matching document; in the click bipartite graph, for each historical search term, a weighted average is performed using the initial document vector representations of historical matching documents connected to each historical search term to obtain an intermediate search term vector representation for each historical search term; the next iteration is performed based on the intermediate search term vector representations of each historical search term, and in the next iteration, the initial document vector representation of each historical matching document is updated according to the intermediate search term vector representation to obtain an intermediate document vector representation for each historical matching document, and the iteration continues until a preset iteration condition is reached, resulting in the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0019] This application provides an electronic device, including: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the method provided in the embodiments of this application.

[0020] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute and implement the method provided in this application.

[0021] The embodiments of this application have the following beneficial effects: Based on massive amounts of historical search session information, a graph model is constructed to represent the relationship between each historical search term and each historical matching document. The graph model is then used to calculate the vector representation of each historical search term and each historical matching document. This allows for the calculation of the relevance of combined data obtained by recombining historical search terms and historical matching documents, thus obtaining a large amount of combined data of historical search terms and historical matching documents that have never appeared in the historical search session information, improving the diversity of the training sample set. Furthermore, based on the vector representation of each historical search term and historical matching document, the relevance between historical search terms and historical matching documents in each combined data set can be mined, and each combined data pair can be automatically and accurately labeled based on the relevance. This improves the efficiency and accuracy of training sample set generation and allows the generated training sample set to carry more semantic information. Therefore, the training sample set generated using the method of this application embodiment can improve the text matching model's performance in semantic understanding and robustness, thereby improving the accuracy of text matching. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the process framework for generating a sample set using the current text matching model provided in this application embodiment; Figure 2 This is an optional structural diagram of the text matching system architecture provided in the embodiments of this application; Figure 3 This is an optional structural schematic diagram of the text matching device provided in the embodiments of this application; Figure 4 This is an optional flowchart illustrating the text matching method provided in the embodiments of this application; Figure 5 This is an optional flowchart illustrating the text matching method provided in the embodiments of this application; Figure 6 This is an optional flowchart illustrating the text matching method provided in the embodiments of this application; Figure 7-1 This is a schematic diagram of the historical search session information in sequence form provided in the embodiments of this application; Figure 7-2 This is a schematic diagram of the directed graph model provided in the embodiments of this application; Figure 7-3This is a schematic diagram of the pathfinding sequence set provided in the embodiments of this application; Figure 7-4 This is a schematic diagram of the item2vec algorithm model provided in the embodiments of this application; Figure 8 This is an optional flowchart illustrating the text matching method provided in the embodiments of this application; Figure 9 This is a schematic diagram of the click bipartite graph model provided in the embodiments of this application; Figure 10 This is a schematic diagram of a historical search click scenario provided in an embodiment of this application; Figure 11 This is a schematic diagram of the training sample set generation process framework provided in the embodiments of this application; Figure 12 This is a schematic diagram of the structure of the text matching device provided in the embodiments of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0025] If the application documents contain similar descriptions such as "first / second", the following explanation shall be added: In the following description, the terms "first / second / third" are used only to distinguish similar objects and do not represent a specific order of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0027] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0028] 1) Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0029] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0030] 2) Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP technologies typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.

[0031] 3) Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0032] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.

[0033] Currently, text matching in natural language processing can generally be understood as a relevance classification problem between a first text and a second text. In search engines, it can be understood as determining whether a search term (query) and a document (doc) are related. Therefore, the sample set used to train a text matching model is typically a triple of search term-document-label, used to represent whether the query and document are related, as shown in the following example:

[0034] The current framework for relevance labeling methods can be summarized as follows: Figure 1As shown, the process begins by extracting search click logs over a specific period from a massive search log dataset, identifying clicked query-doc pairs, and placing them into a candidate pool. Then, these query-doc pairs are used as candidate samples, and their relevance is determined through manual annotation or machine annotation based on a pre-defined strategy. Classification and labeling are then performed based on this relevance to obtain a sample set. Manual annotation relies on human knowledge and experience to determine relevance, resulting in high accuracy. However, it suffers from two main drawbacks: firstly, it is costly, requiring training for annotators and often necessitating multiple annotations per sample to maintain accuracy, further increasing labor costs; secondly, it is inefficient, with a qualified annotator producing only about a thousand labeled samples per day, insufficient to meet the demands of tens of millions of samples required by popular deep learning text matching models. Therefore, manual annotation struggles to obtain large-scale training samples, resulting in low annotation efficiency. Machine annotation typically involves classifying and labeling documents based on pre-defined strategies. A common strategy is to classify based on click-through rate (CTR), such as classifying documents with higher CTRs for a query as relevant samples, documents with lower CTRs as irrelevant samples, and documents clicked in query 1 as irrelevant samples in query 2. While machine annotation can quickly generate a large number of training samples, it has two main drawbacks: First, CTR-based rules are easily affected by ranking models or the Matthew effect, leading to decreased annotation accuracy. Specifically, documents displayed earlier in a query, regardless of relevance, will naturally have a higher CTR than those displayed later. Therefore, documents with lower CTRs are highly likely not irrelevant samples. Second, directly extracting training samples from search logs means that the samples are heavily influenced by search recall / ranking models; only documents with high ranking scores have a chance to be displayed and become training samples. This method ignores a large number of semantically relevant samples that are not displayed by the ranking model, resulting in insufficient semantically relevant information in the final sample set. Therefore, the accuracy of sample relevance labeling in the sample set generated by machine annotation is low, which in turn affects the accuracy of text matching processing by the text matching model trained using the machine-annotated sample set.

[0035] The solutions provided in this application involve technologies such as natural language processing in artificial intelligence, and are specifically illustrated through the following embodiments: This application provides a text matching method, apparatus, device, and computer-readable storage medium, which can improve the efficiency of generating training samples and the accuracy of text matching by the trained text matching model. The following describes exemplary applications of the electronic devices provided in this application. These electronic devices can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), or as servers. The following describes exemplary applications when the electronic device is implemented as a server.

[0036] See Figure 2 , Figure 2 This is an optional architecture diagram of the text matching system 100 provided in the embodiments of this application. In order to support a search application, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0037] Terminal 400 is equipped with a search application client 401 (exemplary examples show search application clients 4001-1 and 401-2), which receives user-input search terms through at least one control in the search interface of the search application client 401 and submits the search terms to server 200. Server 200 receives the search terms submitted by each client; based on the search terms, it uses a text matching model to match at least one matching document from a preset document resource library; the training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents in historical search session information; the annotation information of the training samples is obtained by calculating the vector representation of historical search terms and historical matching documents through a graph model, and classifying the relevance of the combined data based on the vector representation; the graph model is constructed from multiple historical search session information, and the graph model represents the click relationship between historical search terms and historical matching documents; a search results page is generated based on at least one matching document, and the search results page is pushed to each client 401-1 or 401-2 for display.

[0038] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Terminal 400 may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited thereto. Terminals and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.

[0039] See Figure 3 , Figure 3 This is a schematic diagram of the structure of the server 200 provided in the embodiments of this application. Figure 3 The server 200 shown includes at least one processor 410, memory 450, at least one network interface 420, and a user interface 430. The various components in server 200 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 3 The general labeled all buses as Bus System 440.

[0040] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0041] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0042] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.

[0043] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.

[0044] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0045] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.). The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.

[0046] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 3 A text matching device 455 stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a receiving module 4551, a text matching module 4552, and a pushing module 4553. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.

[0047] In other embodiments, the text matching device provided in this application can be implemented in hardware. As an example, the text matching device provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the text matching method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0048] The text matching method provided in this application will be described in conjunction with exemplary applications and implementations of the server provided in the embodiments of this application.

[0049] See Figure 4 , Figure 4 This is an optional flowchart illustrating the text matching method provided in this application embodiment, which will be combined with... Figure 4 The steps shown are explained.

[0050] S101. Receive the search terms submitted by each client.

[0051] In this embodiment of the application, the text matching device can obtain the search terms submitted by the application from the client, and perform a text matching process based on the search terms.

[0052] In some embodiments, the client may be a software application configured on the same device as the text matching device, used as a front-end application to interact with the user and to exchange data with the text matching device running in the background to achieve the text matching function; the client may also be an application on a terminal, connecting to the text matching device configured on a server via a network to exchange data and achieve the text matching function.

[0053] S102. Based on the search term, use a text matching model to match at least one matching document from a preset document resource library; the training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents in historical search session information; the annotation information of the training samples is obtained by calculating the vector representation of historical search terms and historical matching documents through a graph model, and classifying and annotating the combined data based on the vector representation; the graph model is constructed from multiple historical search session information, and the graph model represents the click relationship between historical search terms and historical matching documents.

[0054] In this embodiment, the text matching device converts the received search terms into a data type that can be recognized by a neural network, such as a vector or feature, to obtain search input data. The text matching device uses a text matching model to perform semantic recognition, similarity prediction and other processing based on the search input data, and matches at least one matching document from a preset document resource library as the search result corresponding to the search term.

[0055] In this embodiment, before the text matching device uses the text matching model to perform text matching processing on search terms, it first needs to train the initial text matching model using a training sample set to obtain the text matching model. In this embodiment, when constructing the training sample set, it is necessary to extract multiple historical search term-historical matching document association pairs with click exposure from multiple historical search session information, such as the historical search record database in the browser's backend server. Based on the click relationships of these multiple historical search term-historical matching document association pairs, a graph model is constructed. Using the graph model, vector representation calculations are performed on all historical search terms and all historical matching documents included in multiple combinations to obtain the vector representation (embedding) corresponding to each historical search term and each historical matching document. The text matching device can recombine each historical search term and each historical matching document to obtain a combined data set of historical search term-historical matching documents that have never appeared in the multiple historical search session information. Within this combined data set, for each combined data set, the similarity between the historical search terms and historical matching documents is calculated based on their respective vector representations, and the combined data is labeled based on the similarity. For example, if the similarity is higher than a preset threshold, it is labeled as a relevant sample; if the similarity is lower than the preset threshold, it is labeled as an irrelevant sample. This allows for the labeling of each combination of data, and the labeled combination dataset can be used as a training sample set.

[0056] In this embodiment of the application, the preset document resource library can be a massive amount of document resources on the network, or it can be the local document resources of the device when the text matching device and the client are configured on the same device.

[0057] S103. Generate a search results page based on at least one matching document, and push the search results page to each client for display.

[0058] In this embodiment, the text matching device can generate a search results page containing at least one matching document based on at least one matching document and combined with network models such as search ranking models, and then push the search results page to the client that submitted the corresponding search terms, so that the search results page can be displayed on each client.

[0059] In some embodiments, the text matching device can input at least one matching document as input data into a search ranking model. The search ranking model then sorts the at least one matching document according to a preset ranking strategy, such as user historical click preferences, and generates a corresponding list display page as the search results page based on the ranking results.

[0060] It is understood that, in this embodiment, the text matching device can construct a graph model representing the relationship between each historical search term and each historical matching document based on massive historical search session information. The graph model is then used to calculate the vector representation of each historical search term and each historical matching document. This allows the device to utilize the respective vector representations of each historical search term and each historical matching document to calculate the relevance of the combined data obtained by recombining historical search terms and historical matching documents. This approach not only obtains a large amount of combined data of historical search terms and historical matching documents that have never appeared in the historical search session information, improving the diversity of the training sample set, but also mines the relevance between historical search terms and historical matching documents in each combined data based on their respective vector representations. Based on this relevance, each combined data pair is automatically and accurately labeled, thereby improving the efficiency and accuracy of training sample set generation and enabling the generated training sample set to carry more semantic information. Therefore, the training sample set generated using the method of this embodiment can improve the text matching model's semantic understanding and robustness, thus improving the accuracy of text matching.

[0061] In some embodiments, see Figure 5 , Figure 5 This is an optional flowchart illustrating the method provided in an embodiment of this application, based on... Figure 4 Before S102, S201-S206 can also be executed, which will be explained in conjunction with each step.

[0062] S201. Extract multiple historical search session information containing click events from a preset historical search record library; each of the multiple historical search session information contains a historical search term and at least one historical matching document corresponding to the historical search term.

[0063] In this embodiment, a preset historical search record database stores a large number of historical search records corresponding to users' historical search behaviors. The preset historical search record database is a collection of information records of multiple historical conversations between various clients and the text matching device, collected by the text matching device within a preset time period, such as several months or several weeks.

[0064] In some embodiments, the text matching device can divide a historical session based on the search term and a preset non-response duration. The text matching device can treat consecutive historical search clicks on the same client as a single historical session, where consecutive historical search clicks target the same historical search term, and the time interval between each adjacent historical search click does not exceed the preset non-response duration. For example, with a preset non-response duration of 5 minutes, when client 1 submits historical search term 1 to the text matching device, the text matching device can record a historical search action corresponding to historical search term 1. If, within 5 minutes, the text matching device receives one or more clicks from client 1 targeting at least one historical candidate document 1 corresponding to historical search term 1, the text matching device can record the historical search action of historical search term 1 and the aforementioned one or more clicks as historical session 1, and record the corresponding session information for historical session 1, such as the search term, session time, historical candidate documents and document click order corresponding to each click event, and client information, etc., as the information record for historical session 1.

[0065] In some embodiments, the text matching device can also divide different historical session processes according to the search term. For example, when the text matching device receives a historical search term 1 submitted by the client 1, if it receives a new historical search term 2 submitted by the client 1, it can take the continuous historical search click behavior corresponding to the historical search term 2 as historical session 2, and record the corresponding session information of historical session 2 as information record of historical session 2, thereby forming a preset historical search record library organized in the form of sessions.

[0066] For example, client U1 submits a historical search term Q1 at time T1 and clicks on historical candidate documents D1 and D2 corresponding to Q1 in sequence; client U2 submits a historical search term Q2 at time T2 and clicks on historical matching document D3 corresponding to Q2; client U2 submits a historical search term Q3 at time T3 and clicks on historical candidate documents D4 and D5 corresponding to Q3 in sequence; client U3 submits a historical search term Q4 at time T4, clicks on historical matching document D6 corresponding to Q4, and clicks on historical matching document D7 corresponding to Q4 at time T5 after a preset no-response timeout; client U4 submits a historical search term Q5 at time T6 and does not click on any historical candidate documents before the preset no-response timeout. The preset historical search record database can contain different information records corresponding to different historical sessions, such as {U1, T1, Q1->D1->D2}, {U2, T2, Q2->D3}, {U2, T3, Q3->D4->D5}, {U3, T4, Q4->D6}, {U3, T5, Q4->D7}, and {U4, T6, Q5}.

[0067] In this embodiment of the application, the text matching device extracts information records of historical sessions containing click events from a preset historical search record library based on the information records of each historical session, thereby obtaining information on multiple historical search sessions.

[0068] For example, in the above example, the text matching device can extract {U1, T1, Q1->D1->D2}, {U2, T2, Q2->D3}, {U2, T3, Q3->D4->D5}, {U3, T4, Q4->D6}, and {U3, T5, Q4->D7} as historical search session information 1 to 5, thereby obtaining multiple historical search session information. The text matching device uses D1 and D2 as at least one historical matching document corresponding to Q1 in historical search session information 1; uses D3 as at least one historical matching document corresponding to Q2 in historical search session information 2; uses D4 and D5 as at least one historical matching document corresponding to Q2 in historical search session information 3; uses D6 as at least one historical matching document corresponding to Q4 in historical search session information 4; and uses D7 as at least one historical matching document corresponding to Q4 in historical search session information 5.

[0069] S202. Treat each historical search term and each historical matching document as a point element, and obtain the connection relationship between the point elements based on the click relationship between the historical search term and at least one historical matching document in each historical search session information, thereby constructing a graph model.

[0070] In this embodiment of the application, the text matching device can treat each historical search term and each historical matching document in multiple historical search session information as an independent point element; then, based on the click relationship between the historical search term and at least one historical matching document in each historical search session information, it can construct the connection relationship between the vertices, wherein the connection relationship can be represented as the connection between point elements in the graph model, thereby constructing the graph model.

[0071] In this embodiment, the text matching device can construct a directed graph as a graph model based on multiple historical search session information, or it can construct a click-based bipartite graph as a graph model, which will be described in detail in the following embodiments.

[0072] S203. Calculate the search term vector representation of each historical search term and the document vector representation of each historical matched document based on the graph model.

[0073] In this embodiment, since the graph model represents the mutual click relationship between each historical search term and each historical matching document in multiple historical search session information, the text matching device can calculate the vector representation of each historical search term and each historical matching document based on the graph model, thereby representing the search term and the matching document using a unified data form.

[0074] In this embodiment of the application, the methods in S202 and S203 can be implemented in the following two ways: In some embodiments, see Figure 6 , Figure 6 This is an optional flowchart illustrating the text matching method provided in this application embodiment. Each historical search session information includes behavioral sequence information of historical search terms and at least one historical matching document. The behavioral sequence information represents the order in which historical search terms appear and at least one historical matching document. Figure 5 S202 shown can be implemented by S2021 to S2022, and correspondingly, S203 can be implemented by S2031 to S2032, which will be explained in conjunction with each step.

[0075] S2021. Take each historical search term and each historical matching document as point elements. In each historical search session information, based on the behavior sequence information contained in the historical search session information, obtain the adjacent order relationship between the point elements corresponding to the historical search session information.

[0076] In this embodiment, in each historical search session information, the historical search terms and at least one historical matching document can be represented in the order of occurrence of the corresponding search or click actions, that is, the order in which the historical search terms and at least one historical matching document appear, in the form of a behavior sequence. The text matching device can use each historical search term and each historical matching document as point elements in a preset directed graph template, and in each historical search session information, based on the behavior sequence information contained in the historical search session information, obtain the adjacent order relationship between the point elements in the historical search session information.

[0077] In some embodiments, the text matching device can collect information from multiple historical search sessions from various clients, such as... Figure 7-1 As shown, A, B, C, D, E, and F can be point elements abstracted from historical search terms or historical matched documents. Figure 7-1 In this context, a unique ID is used to identify the dot element. For example, for... Figure 7-1 The diagram shows the historical search session information for client U1. Dot element D represents the historical search term 1 submitted by U1, and dots A and B represent two historical matching documents 1 and 2 that client U1 clicked sequentially for that historical search term. For the historical search session information for client U2, dots B and E belong to the same historical session, representing historical matching documents 2 and 3 that client U2 clicked respectively. Dot elements D and E belong to the next historical session, where dot element D represents the historical search term 1 submitted by client U2 after clicking historical matching documents 2 and 3, and dots E and F represent two historical matching documents 4 and 5 that client U2 clicked sequentially based on historical search term 1. For the historical search session information corresponding to client U3, point elements E, C, and B belong to the same historical session. Point element E represents the historical matching document 4 clicked by client U3, point element C represents the historical search term 2 submitted by client U3, and point element B represents the historical matching document 3 clicked by client U3 based on historical search term 2. Point elements B and A belong to the next historical session, representing the two historical matching documents 2 and 1 clicked by the client in sequence based on historical search term 2, respectively.

[0078] exist Figure 7-1 In the example of historical search session information D->A->B corresponding to U1, the two adjacent order relationships of D->A and A->B are determined.

[0079] S2022. Based on the adjacent order relationship, obtain the directed connection path between the point elements corresponding to the historical search session information, and then construct a directed graph model as a graph model based on each historical search session information.

[0080] In this embodiment, the text matching model can connect the point elements corresponding to the historical search session information according to the adjacent order relationship to obtain the directed connection paths between the point elements corresponding to the historical search session information. Then, based on each historical search session information, all the connections between each point element are obtained, thereby constructing a directed graph model as a graph model. In some embodiments, based on Figure 7-1 In the multiple historical search session information shown, for client U1, the connection paths can be constructed from the point elements D, A, and B contained in U1, based on the adjacent order relationships D->A and A->B, forming a line from D to A and a line from A to B. The text matching device performs the same processing on the multiple historical search session information corresponding to each client, thereby obtaining... Figure 7-2 The directed graph model shown.

[0081] S2031. Starting from each point element in the point element set, perform random pathfinding in the directed graph model according to the connection path and record it as the current pathfinding path. When the pathfinding reaches a point element with no other connection path, or when the length of the current pathfinding path reaches a preset length threshold, generate a pathfinding sequence corresponding to each point element according to the current pathfinding path, and then obtain a pathfinding sequence set.

[0082] In this embodiment, the text matching device takes each point element in the point element set as the starting point and performs a random walk in the directed graph model according to the connection path between point elements in the directed graph model. The path selection of the random walk can be determined by the DeepWalk algorithm or other algorithms. This embodiment does not limit the choice.

[0083] In this embodiment, during each random walk, the text matching device records the point elements traversed in the current random walk, recording them as the current pathfinding path. The current pathfinding path is updated in real-time during each random walk. When the walk reaches a point element without adjacent points (i.e., without other connecting paths), or when the length of the current pathfinding path reaches a preset length threshold (e.g., the number of point elements traversed), the current random walk stops. Based on the last recorded current pathfinding path, a pathfinding sequence is generated according to the pathfinding order between the point elements. The text matching device can perform the same processing on each point element. Furthermore, to improve the accuracy of subsequent calculations based on the pathfinding sequence, the text matching device can also perform multiple random walks with different pathfinding paths starting from the same point element to further increase the number of generated pathfinding sequences, thereby obtaining at least one pathfinding sequence corresponding to each point element, which serves as a set of pathfinding sequences.

[0084] In some embodiments, based on Figure 7-2The graph model shown indicates that at least one pathfinding sequence obtained by the text matching device can be as follows: Figure 7-3 As shown.

[0085] S2032. Using a sequence vector transformation algorithm, in the pathfinding sequence set, calculate the vector representation of each point element in each pathfinding sequence, and then obtain the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0086] In this embodiment, the text matching device can use a pathfinding sequence set as input data and calculate the vector representation of each point element in the pathfinding sequence set using a sequence vector conversion algorithm. The text matching device can then obtain the vector representation of the historical search term or historical matched document corresponding to each point element based on the vector representation of that point element, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matched document.

[0087] In some embodiments, the sequence vector transformation algorithm can be an item2vec algorithm, such as a word2vec algorithm, used to calculate the vector representation of each element in the input sequence or text. The text matching device can use the pathfinding sequence set as input data, through... Figure 7-4 The word2vec algorithm model shown in the figure randomly initializes each point element in the pathfinding sequence set to obtain an initial vector representation of each point element. Based on the contribution relationship between sequences, iteratively calculates and updates the initial vector representation of each point element to obtain the intermediate vector representation of each point element in each iteration until a preset convergence condition is reached, such as when the similarity of the vector representations of adjacent point elements is higher than a preset convergence threshold, the vector representation of each point element is obtained.

[0088] In some embodiments, see Figure 8 , Figure 8 This is an optional flowchart illustrating the text matching method provided in this application embodiment. Each historical search session information includes the click relationship between historical search terms and at least one historical matching document. Figure 5 The process of obtaining the connection relationship between point elements based on the click relationship between historical search terms and at least one historical matching document in each historical search session information, as shown in S202, and thus constructing a graph model, can be implemented through S2023. S203 can be implemented through S2034 to S2036, and will be explained in conjunction with each step.

[0089] S2023. In each historical search session information, based on the click relationship, obtain the connection relationship between the point elements corresponding to the historical search session information, and construct a click bipartite graph as a graph model based on the connection relationship.

[0090] In this embodiment of the application, the text matching device can connect point elements based on the click relationship between historical search terms and at least one historical matching document in each historical search session information, thereby constructing a click bipartite graph as a graph model.

[0091] In some embodiments, the historical search term in historical search session information 6 is "entertainment combination 101", and at least one historical matching document is doc1 and doc2; the historical search term in historical search session information 7 is "entertainment combination", and at least one historical matching document is doc2 and docn; the text matching device can construct a matching function based on the click relationship in historical search session information 6 and historical search session information 7. Figure 9 The click-based bipartite graph shown is used as a graph model.

[0092] S2033. Segment each historical search term into words, and based on the segmentation results of each historical search term, obtain the initial search term vector representation of each historical search term.

[0093] In this embodiment of the application, the text matching device can perform semantic word segmentation on each historical search term using a word segmentation algorithm, and obtain an initial search term vector representation for each historical search term based on the word segmentation results.

[0094] In some embodiments, for the historical search term "entertainment combination 101", the text matching device can use a word segmentation algorithm to segment it into "entertainment combination" and "101", and then perform average initialization on the vector corresponding to each word to obtain the initial search term vector representation corresponding to "entertainment combination 101": "entertainment combination: 0.5; 101: 0.5".

[0095] S2034. In the first iteration, in the click bipartite graph, for each historical matching document, the initial document vector representation of each historical matching document is obtained by weighted averaging the initial search term vector representations of the historical search terms that are connected to each historical matching document.

[0096] In some embodiments, the text matching device can calculate the initial document vector representation of each historically matched document using formula (1), as follows: (1) in, It is the vector representation of the i-th query in the (n-1)-th round. It is the weight of the edge between the i-th query and the j-th document in the bipartite graph (usually the number of clicks is used as the edge weight). It is the vector representation of the j-th document in the n-th round.

[0097] S2035. In the click bipartite graph, for each historical search term, the initial document vector representation of the historical matching documents that are connected to each historical search term is used to perform a weighted average to obtain the intermediate search term vector representation of each historical search term.

[0098] In some embodiments, the text matching device can calculate the intermediate search term vector representation of each historical search term using formula (2), as follows: (2) in, It is the vector representation of the j-th document in the n-th round. It represents the weight of the edge between the i-th query and the j-th document in the bipartite graph. It is the vector representation of the j-th query in the n-th round.

[0099] S2036. Based on the intermediate search term vector representation of each historical search term, proceed to the next iteration. In the next iteration, update the initial document vector representation of each historical matching document according to the intermediate search term vector representation to obtain the intermediate document vector representation of each historical matching document. Continue iterating until the preset iteration condition is met to obtain the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0100] In this embodiment, the text matching device performs the next iteration based on the intermediate search term vector representation of each historical search term. In the next iteration, the intermediate document vector representation of each historical matching document is calculated according to formula (1) based on the intermediate search term vector representation of each historical search term. Based on the intermediate document vector representation of each historical matching document, the intermediate search term vector representation of each historical search term is calculated and updated according to formula (2). The text matching device iterates in the same way until the preset iteration condition is reached, and then obtains the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0101] In this embodiment, the preset iteration condition indicates that the calculated values ​​of the search term vector representation of each historical search term and the document vector representation of each historical matching document have stabilized and converged. In some embodiments, the preset iteration condition may be that the error between the vector after each iteration and the vector of the previous iteration is less than a preset error threshold, or it may be a preset number of iterations, such as 3 iterations. The specific choice is made according to the actual situation, and this embodiment does not limit it.

[0102] S204. Combine each historical search term with each historical matching document to obtain a combined data set.

[0103] In this embodiment of the application, the text matching device can combine each historical search term with each historical matching document based on a preset combination strategy, such as one-to-one combination or random combination, to obtain a combined data set.

[0104] It is understood that, in the embodiments of this application, since the text matching device recombines historical search terms and historical matching documents in an individual manner, the combined data set may contain query-doc pairs that have never appeared in the historical search session set, thereby increasing the diversity of the samples.

[0105] S205. Based on the search word vector representation and document vector representation, obtain the similarity of each combination of data in the combined data, classify and label each combination of data based on the similarity, and obtain the training sample set.

[0106] In this embodiment of the application, for each combination of data, the text matching device can calculate the similarity of the combination of data based on the search term vector representation corresponding to the historical search term and the document vector representation corresponding to the historical matched document.

[0107] In some embodiments, the text matching device can calculate the cosine distance between the search term vector representation and the document vector representation as the similarity, or it can use a neural network model to perform network inference based on the search term vector representation and the document vector representation, and output the similarity probability between historical search terms and historical matched documents in the combined data as the similarity. The specific choice depends on the actual situation, and the embodiments of this application are not limited thereto.

[0108] In some embodiments, Figure 5 The shown S205 can be implemented through S2051 to S2053, which will be explained in conjunction with each step.

[0109] S2051. For each combination of data, calculate the cosine distance corresponding to each combination of data based on the search term vector representation of the historical search terms and the document vector representation of the historical matching documents in the combination of data.

[0110] In this embodiment, the text matching model can calculate the cosine value of the angle between the search word vector representation and the document vector representation in a vector space as the cosine distance, which is used to measure the magnitude of the difference between two individuals. A cosine distance close to 1 and an angle close to 0 indicate that the two vectors are more similar, while a cosine distance close to 0 and an angle close to 90 degrees indicate that the two vectors are less similar.

[0111] S2052. When the cosine distance is greater than the first preset distance threshold, each combination of data is labeled as a relevant sample; or, when the cosine distance is less than the second preset distance threshold, each combination of data is labeled as an unrelated sample; wherein, the first preset distance threshold is greater than the second preset distance threshold.

[0112] In this embodiment, when the cosine distance is greater than a first preset distance threshold, it indicates that the historical search terms and historical matched documents in the combined data have a high similarity. The text matching model labels this combined data as relevant samples, which can be used as positive examples to train the initial text matching model. When the cosine distance is less than a second preset distance threshold, it indicates that the historical search terms and historical matched documents in the combined data have a low similarity. The text matching model labels this combined data as irrelevant samples, which can be used as negative examples to train the initial text matching model.

[0113] In some embodiments, the first preset distance threshold can be 0.8, the second preset distance threshold can be 0.2, and other thresholds can also be set according to actual needs. This application embodiment does not limit the threshold.

[0114] S2053. Take each labeled combination of data as a training sample to obtain the training sample set.

[0115] In this embodiment of the application, the text matching device can use each labeled combination of data as a training sample to obtain a training sample set.

[0116] S206. Use the training sample set to train the initial text matching model to obtain the text matching model.

[0117] In this embodiment of the application, the text matching device trains the initial text matching model using a training sample set, thereby obtaining the text matching model to be used in S102.

[0118] It is understood that in this embodiment, the text matching model can obtain a large number of query-doc pairs that have never appeared in historical search session information as initial training samples. Furthermore, it can mine the correlation between query-doc pairs by calculating the vector representation of each historical search term and each historical matching document through a graph model, and automatically and accurately label the query-doc pairs. This improves the efficiency and accuracy of training sample set generation and allows the generated training sample set to carry more semantic information. Therefore, the training sample set generated using the method of this embodiment can improve the text matching model's semantic understanding and robustness, thereby enhancing the accuracy of text matching.

[0119] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.

[0120] In a historical search click scenario, a user submits the search term "NBA Lakers vs. Hawks" via the client, which corresponds to 4 historical candidate documents, such as... Figure 10 As shown. The user then clicked on document 2, one of the four historical candidate documents, namely the document "Lakers vs. Hawks Full Game Replay". Following the current training sample generation method, based on the click-through rate, the original query-doc pair is relevance-labeled, resulting in relevant samples including: "NBA Lakers vs. Hawks" - document 2; and irrelevant samples including: "NBA Lakers vs. Hawks" - document 1, "NBA Lakers vs. Hawks" - document 3, and "NBA Lakers vs. Hawks" - document 4. However, using the method provided in this application embodiment, after... Figure 11 The process shown involves extracting multiple historical search session information from massive historical search records of multiple clients, constructing a directed graph or bipartite graph as a graph model based on the multiple historical search session information, calculating the vector representation of each query and each document in the multiple historical search session information based on the graph model, then recombining each query and each document to obtain combined data, and performing similarity labeling on the recombined query-doc combined data based on the vector representation of each query and each document to obtain the label of each query-doc combined data, and finally obtaining multiple query-doc-label triple arrays as training sample sets. For example, using the method in the embodiments of this application, the relevant samples that can be generated include: "nba Lakers vs. Hawks" - Document 2; "nba Lakers vs. Hawks" - "nba Lakers vs. Hawks Highlights", etc., and the irrelevant samples include: "nba Lakers vs. Hawks" - Document 1, "nba Lakers vs. Hawks" - Document 3, "nba Lakers vs. Hawks" - Document 4, "nba Lakers vs. Hawks" - "Naughty Kitten Runs into Hawk's Nest to Play".

[0121] As can be seen, the relevant or irrelevant samples generated by the method in this application embodiment can be query-doc pairs that have never appeared in the historical search session information, and therefore are less affected by the search ranking model. Furthermore, the irrelevant samples in this application embodiment also carry the semantic information of "eagle", and refer to different entities from "eagle" in the search term, thus preserving more semantic information. Compared with the training samples extracted by traditional methods, the method proposed in this paper is more efficient, has better accuracy, and carries obvious semantic information.

[0122] The following description continues to illustrate the exemplary structure of the text matching device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 12 As shown, the software module stored in the text matching device 455 in the memory 450 may include: The receiving module 4551 is used to receive the search terms submitted by each client; The text matching model 4552 is used to match at least one matching document from a preset document resource library based on the search term. The training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents from historical search session information. The annotation information of the training samples is obtained by calculating the vector representation of the historical search terms and the historical matching documents through a graph model, and classifying and labeling the combined data based on the vector representation. The graph model is constructed from multiple historical search session information and represents the click relationship between historical search terms and historical matching documents. The push module 4553 is used to generate a search results page based on the at least one matching document, and push the search results page to each client for display.

[0123] In some embodiments, the text matching device further includes a training sample generation module, which is used to extract multiple historical search session information with click events from a preset historical search record library before matching at least one target document from a preset document resource library based on the search term using a text matching model; each historical search session information includes a historical search term and at least one historical matching document corresponding to the historical search term; each historical search term and each historical matching document in the multiple historical search session information is used as a point element, and the matching is performed based on the historical search term in each historical search session information and at least one historical matching document. The click relationships of historical matching documents are used to obtain the connection relationships between the point elements, thereby constructing the graph model; based on the graph model, the search term vector representation of each historical search term and the document vector representation of each historical matching document are calculated; each historical search term and each historical matching document are combined to obtain a combined data set; based on the search term vector representation and the document vector representation, the similarity of each combined data in the combined data is obtained, and each combined data is classified and labeled based on the similarity to obtain a training sample set; the initial text matching model is trained using the training sample set to obtain the text matching model.

[0124] In some embodiments, the training sample generation module is further configured to, for each combination of data, calculate the cosine distance corresponding to each combination of data based on the search term vector representation of the historical search terms and the document vector representation of the historical matching documents in the combination of data; when the cosine distance is greater than a first preset distance threshold, label each combination of data as a relevant sample; or, when the cosine distance is less than a second preset distance threshold, label each combination of data as an irrelevant sample; wherein, the first preset distance threshold is greater than the second distance threshold; and use each labeled combination of data as a training sample to obtain the training sample set.

[0125] In some embodiments, each historical search session information includes behavioral sequence information of the historical search term and the at least one historical matching document, wherein the behavioral sequence information represents the order in which the historical search term and the at least one historical matching document appear; the training sample generation module is further configured to use each historical search term and each historical matching document as point elements, and in each historical search session information, obtain the adjacency order relationship between the point elements corresponding to the historical search session information based on the behavioral sequence information included in the historical search session information; obtain the directed connection path between the point elements corresponding to the historical search session information based on the adjacency order relationship, and then construct a directed graph model as the graph model based on each historical search session information.

[0126] In some embodiments, the training sample generation module is further configured to take each point element in the point element set as the starting point, perform random pathfinding in the directed graph model according to the connection path, and record it as the current pathfinding path. When the pathfinding reaches a point element with no other connection path, or when the length of the current pathfinding path reaches a preset length threshold, generate the current pathfinding sequence corresponding to each point element, thereby obtaining a pathfinding sequence set. Using a sequence vector conversion algorithm, calculate the vector representation of each point element in each pathfinding sequence in the pathfinding sequence set, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0127] In some embodiments, each historical search session information includes the click relationship between the historical search term and the at least one historical matching document. The training sample generation module is further configured to obtain the connection relationship between the point elements corresponding to the historical search session information in each historical search session information according to the click relationship, and construct a click bipartite graph as the graph model based on the connection relationship.

[0128] In some embodiments, the training sample generation module is further configured to segment each historical search term, and based on the segmentation results of each historical search term, obtain an initial search term vector representation for each historical search term; in the first iteration, in the click bipartite graph, for each historical matching document, a weighted average is performed using the initial search term vector representations of historical search terms connected to each historical matching document to obtain an initial document vector representation for each historical matching document; in the click bipartite graph, for each historical search term, a weighted average is performed using the initial document vector representations of historical matching documents connected to each historical search term to obtain an intermediate search term vector representation for each historical search term; the next iteration is performed based on the intermediate search term vector representations of each historical search term, and in the next iteration, the initial document vector representation of each historical matching document is updated according to the intermediate search term vector representation to obtain an intermediate document vector representation for each historical matching document, and the iteration continues until a preset iteration condition is reached to obtain the search term vector representation of each historical search term and the document vector representation of each historical matching document.

[0129] It should be noted that the description of the above device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0130] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the text matching method described above in this application.

[0131] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to perform the method provided in this application, for example... Figure 4-9 The method shown.

[0132] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0133] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0134] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborative files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0135] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.

[0136] In summary, through the embodiments of this application, the text matching device can construct a graph model representing the relationship between each historical search term and each historical matching document based on massive historical search session information. The graph model is used to calculate the vector representation of each historical search term and each historical matching document. This allows for the calculation of the relevance of combined data obtained by recombining historical search terms and documents, leveraging the respective vector representations of each historical search term and document. This approach not only obtains a large amount of combined data of historical search terms and documents that have never appeared in historical search session information, improving the diversity of the training sample set, but also mines the relevance between historical search terms and documents in each combined data based on their respective vector representations. Furthermore, it automatically and accurately labels each combined data pair based on the relevance, thereby improving the efficiency and accuracy of training sample set generation and imbuing the generated training sample set with more semantic information. Therefore, the training sample set generated using the method of this application embodiment can improve the text matching model's semantic understanding and robustness, thus enhancing the accuracy of text matching.

[0137] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A text matching method, characterized in that, include: Receive search terms submitted by each client; Based on the search terms, at least one matching document is selected from a preset document resource library using a text matching model; The training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents from historical search session information. The annotation information of the training samples is obtained by calculating the vector representation of the historical search terms and the historical matching documents through a graph model, and classifying and annotating the combined data based on the vector representation. Each historical search session contains behavioral sequence information of the historical search term and at least one historical matching document, wherein the behavioral sequence information represents the order in which the historical search term and the at least one historical matching document appear. The graph model is constructed as follows: each historical search term and each historical matching document in multiple historical search session information are used as vertex elements; in each historical search session information, the adjacency order relationship between the vertex elements corresponding to the historical search session information is obtained based on the behavioral sequence information contained in the historical search session information; the directed connection path between the vertex elements corresponding to the historical search session information is obtained based on the adjacency order relationship; and a directed graph model is constructed based on each historical search session information as the graph model. The training sample set is obtained as follows: each historical search term is combined with each historical matching document to obtain a combined data set; for each combined data in the combined data set, when the cosine distance corresponding to the combined data is greater than a first preset distance threshold, each combined data is labeled as a relevant sample; when the cosine distance is less than a second preset distance threshold, each combined data is labeled as an irrelevant sample; wherein, the first preset distance threshold is greater than the second preset distance threshold; each labeled combined data is used as a training sample to obtain the training sample set; A search results page is generated based on the at least one matching document, and the search results page is pushed to each client for display.

2. The method according to claim 1, characterized in that, Before matching at least one matching document from a preset document resource library using a text matching model based on the search term, the method further includes: Extract multiple historical search session information containing click events from a preset historical search record library; each of the multiple historical search session information contains a historical search term and at least one historical matching document corresponding to the historical search term; Based on the graph model, the search term vector representation of each historical search term and the document vector representation of each historical matching document are calculated. The initial text matching model is trained using the training sample set to obtain the text matching model.

3. The method according to claim 2, characterized in that, The calculation of the search term vector representation for each historical search term and the document vector representation for each historical matched document based on the graph model includes: Starting from each point element in the set of point elements, random path finding is performed in the directed graph model according to the connection path and recorded as the current path finding path. When the path finding reaches a point element with no other connection path, or when the length of the current path finding path reaches a preset length threshold, a path finding sequence corresponding to each point element is generated according to the current path finding path, thereby obtaining a path finding sequence set. Using a sequence vector transformation algorithm, the vector representation of each point element in each pathfinding sequence is calculated in the pathfinding sequence set, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matching document.

4. A text matching device, characterized in that, include: The receiving module is used to receive the search terms submitted by each client; A text matching model is used to match at least one matching document from a preset document resource library based on the search term; the training samples used by the text matching model are combined data obtained by combining historical search terms and historical matching documents in historical search session information; The annotation information of the training samples is obtained by calculating the vector representation of the historical search terms and the historical matching documents through a graph model, and classifying and annotating the combined data based on the vector representation. The training sample generation module is used to construct the graph model in the following way: each historical search session information contains behavioral sequence information of the historical search term and at least one historical matching document, wherein the behavioral sequence information represents the occurrence order of the historical search term and the at least one historical matching document; each historical search term and each historical matching document in multiple historical search session information are used as a vertex element; in each historical search session information, the adjacency order relationship between the vertex elements corresponding to the historical search session information is obtained according to the behavioral sequence information contained in the historical search session information; the directed connection path between the vertex elements corresponding to the historical search session information is obtained according to the adjacency order relationship; and a directed graph model is constructed based on each historical search session information as the graph model. The training sample generation module is further configured to: combine each historical search term with each historical matching document to obtain a combined data set; for each combined data in the combined data set, when the cosine distance corresponding to the combined data is greater than a first preset distance threshold, label each combined data as a relevant sample; When the cosine distance is less than the second preset distance threshold, each combination of data is labeled as an irrelevant sample; wherein, the first preset distance threshold is greater than the second preset distance threshold; each labeled combination of data is used as a training sample to obtain the training sample set; The push module is used to generate a search results page based on the at least one matching document, and push the search results page to each client for display.

5. The apparatus according to claim 4, characterized in that, The training sample generation module is also used for: Extract multiple historical search session information containing click events from a preset historical search record library; each of the multiple historical search session information contains a historical search term and at least one historical matching document corresponding to the historical search term; Based on the graph model, the search term vector representation of each historical search term and the document vector representation of each historical matching document are calculated. The initial text matching model is trained using the training sample set to obtain the text matching model.

6. The apparatus according to claim 4, characterized in that, The training sample generation module is also used for: Starting from each point element in the set of point elements, random path finding is performed in the directed graph model according to the connection path and recorded as the current path finding path. When the path finding reaches a point element with no other connection path, or when the length of the current path finding path reaches a preset length threshold, a path finding sequence corresponding to each point element is generated according to the current path finding path, thereby obtaining a path finding sequence set. Using a sequence vector transformation algorithm, the vector representation of each point element in each pathfinding sequence is calculated in the pathfinding sequence set, thereby obtaining the search term vector representation of each historical search term and the document vector representation of each historical matching document.

7. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the method according to any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that, It stores executable instructions for implementing the method of any one of claims 1 to 3 when executed by a processor.