Information retrieval method and device
By constructing an information retrieval method of graph structure, using graph structure to capture entity words and their association relationships in the document, the shortcomings of traditional information retrieval systems in complex and multiple entity-related queries are solved, and more accurate and targeted information retrieval results are achieved.
Patent Information
- Application Number
- CN202411934990.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-25
AI Technical Summary
Traditional information retrieval systems show significant shortcomings in handling complex and multiple entity-related queries, making it difficult to provide accurate and targeted search results.
By constructing an information retrieval method of graph structure, the graph is used to capture entity words and their association relationships in the document, and calculate the correlation between candidate entity words and documents to determine the information retrieval results that are most relevant to the query text.
Improve the accuracy and pertinence of information retrieval results, ensuring that more accurate retrieval results can be provided during complex and multiple entity-related queries.
Smart Images

Figure CN119848201A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present application relate to the field of artificial intelligence technology, and in particular, to an information retrieval method and device. Background Art
[0002] Information retrieval (IR) focuses on finding information related to user queries from a large number of documents or data sets. Traditional information retrieval systems mainly rely on keyword matching and text similarity-based algorithms to provide information retrieval results. However, this approach has significant shortcomings in many aspects, such as complex and multi-entity related queries (such as queries involving multiple entities). Summary of the invention
[0003] One or more embodiments of the present application provide the following technical solutions:
[0004] The present application provides an information retrieval method, the method comprising:
[0005] Acquiring a query text for triggering information retrieval, and performing named entity recognition on the query text to identify entity words from the query text, and determining the entity words identified from the query text as retrieval entity words;
[0006] Based on the graph, the relevance of each candidate entity word relative to the search entity word is calculated; wherein each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an associated relationship;
[0007] Determine a preset number of candidate entity words with the highest relevance to the search entity word as associated entity words, and calculate the relevance of each candidate document to the query text according to the relevance of the associated entity words to the search entity word;
[0008] A preset number of candidate documents with the highest relevance to the query text are determined as relevant documents, and the relevant documents are determined as information retrieval results corresponding to the query text.
[0009] The present application also provides an information retrieval device, the device comprising:
[0010] A word acquisition module, which acquires a query text for triggering information retrieval, and performs named entity recognition on the query text to identify entity words from the query text, and determines the entity words identified from the query text as retrieval entity words;
[0011] A word association calculation module calculates the association of each candidate entity word with respect to the search entity word based on a graph; wherein each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an association relationship;
[0012] A document relevance calculation module is configured to determine a preset number of candidate entity words with the highest relevance to the search entity word as associated entity words, and calculate the relevance of each candidate document to the query text according to the relevance of the associated entity words to the search entity word;
[0013] The associated document determination module determines a preset number of candidate documents with the highest degree of association with the query text as associated documents, and determines the associated documents as information retrieval results corresponding to the query text.
[0014] The present application also provides an electronic device, comprising:
[0015] processor;
[0016] a memory for storing processor-executable instructions;
[0017] The processor implements the steps of any of the above methods by running the executable instructions.
[0018] The present application also provides a computer-readable storage medium having computer instructions stored thereon, which implement the steps of any of the above methods when executed by a processor.
[0019] In the above technical scheme, a graph for information retrieval can be pre-constructed, in which each node represents each candidate entity word, and each edge is used to indicate that the candidate entity words represented by the connected nodes have an association relationship; subsequently, when a query text for triggering information retrieval is obtained, named entity recognition can be first performed on the query text to identify the retrieval entity words from the query text, and then the association degree of each candidate entity word with respect to the retrieval entity word can be calculated based on the constructed graph, and then several candidate entity words with the highest association degree with respect to the retrieval entity word can be determined as associated entity words, and based on the association degree of the associated entity word with respect to the retrieval entity word, the association degree of each candidate document with respect to the query text is calculated, and finally several candidate documents with the highest association degree with respect to the query text can be determined as associated documents, and the associated documents are determined as the information retrieval results corresponding to the query text.
[0020] In the above method, a graph is combined to realize information retrieval. Since the graph can be used to capture entity words in the searchable documents and the association between entity words, when retrieving documents based on entity words contained in the query text, it can ensure that the information retrieval results are more accurate and more targeted than the original query. In addition, the graph can be constructed in advance so that the constructed graph can be directly used in the subsequent information retrieval process, thereby improving the efficiency of information retrieval combined with the graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The following is a description of the accompanying drawings required for describing the exemplary embodiments, wherein:
[0022] Figure 1 It is a schematic diagram of a system shown in an exemplary embodiment of the present application.
[0023] Figure 2 It is a schematic diagram of an information retrieval process shown in an exemplary embodiment of the present application.
[0024] Figure 3 It is a flowchart of a graph construction method shown in an exemplary embodiment of the present application.
[0025] Figure 4A It is a schematic diagram of a diagram shown in an exemplary embodiment of the present application.
[0026] Figure 4B It is a schematic diagram of another diagram shown in an exemplary embodiment of the present application.
[0027] Figure 4C It is a schematic diagram of another diagram shown in an exemplary embodiment of the present application.
[0028] Figure 5 It is a flowchart of an information retrieval method shown in an exemplary embodiment of the present application.
[0029] Figure 6 It is a structural schematic diagram of a device shown in an exemplary embodiment of the present application.
[0030] Figure 7 It is a block diagram of an information retrieval device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0031] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description relates to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present application. On the contrary, they are only examples consistent with some aspects of one or more embodiments of the present application.
[0032] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this application. In some other embodiments, the steps included in the method may be more or less than those described in this application. In addition, a single step described in this application may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this application may also be combined into a single step for description in other embodiments.
[0033] With the development of the Internet and the explosive growth of data volume, the demand for information retrieval is increasing, and the application of information retrieval is becoming more and more extensive.
[0034] For example, users can actively initiate real-time information retrieval to obtain the information they need at the moment.
[0035] For another example, an intelligent dialogue system can use the RAG (Retrieve and Generate) approach, combining information retrieval and model generation, to provide services to users.
[0036] Intelligent dialogue systems provide services to users by simulating the way humans communicate. Specifically, an intelligent dialogue system is an interactive system developed using artificial intelligence technology. It aims to understand and answer questions raised by users in natural language and generate concise and clear answers. Intelligent dialogue systems are usually based on large language models, which understand and answer questions raised by users and generate corresponding answers.
[0037] A large language model is a deep learning model trained with a large amount of text data. It can be used to generate natural language text or understand the meaning of natural language text. Large language models can handle a variety of natural language tasks, such as text classification, named entity recognition (NER), question answering, dialogue, etc., and are an important path to artificial intelligence.
[0038] In the field of natural language processing, large-scale text data sets are usually referred to as corpuses. Corpuses can contain various types of text data, such as literary works, academic papers, legal documents, news reports, daily conversations, emails, online forum posts, etc. By learning the text data in the corpus, large language models can acquire and understand the laws and patterns of natural language, thereby achieving effective processing and generation of human language.
[0039] Large language models usually use the Transformer architecture, that is, large language models are usually deep learning models based on the Transformer architecture. Deep learning models based on the Transformer architecture are a type of neural network model that uses the Transformer architecture. This model performs well in fields such as natural language processing.
[0040] Transformer is a neural network model used for sequence-to-sequence modeling. Transformer does not need to rely on recursive structures, can parallelize training and reasoning, and speed up model processing. In deep learning models based on the Transformer architecture, a multi-layer Transformer encoder is usually used to extract features from the input sequence, and a Transformer decoder is used to convert the extracted features into an output sequence. At the same time, such models usually also use a self-attention mechanism to capture long-distance dependencies in the input sequence, and use residual connections and regularization methods to accelerate training and improve model performance.
[0041] A pre-trained model is a large language model that is pre-trained on large-scale unlabeled text data. A pre-trained model is a general model that is not designed and optimized for a specific task. In order to adapt the pre-trained model to specific application scenarios and task requirements, fine-tuning is required to improve the performance of the model on specific tasks. The large language model that is finally put into use is usually a model that is further fine-tuned on the basis of the pre-trained model and is a supervised learning model based on labeled text data. Pre-training and fine-tuning are complementary processes. Pre-training enables the model to have a wide range of language understanding capabilities, while fine-tuning makes the model more professional and accurate in specific tasks.
[0042] That is, the training process of a large language model can be divided into two stages: pre-training and fine-tuning. In the pre-training stage, unsupervised learning (e.g., self-supervised learning) can be used to perform pre-training on large-scale, unlabeled text data sets (e.g., online encyclopedias, online articles, books, etc.). Specifically, the missing part or the next word can be predicted based on the context, and statistical laws and language structures such as semantics and syntax can be learned. The prediction loss can be minimized through back-propagation and optimization algorithms (e.g., gradient descent), and model parameters can be iteratively updated to gradually improve the model's ability to understand language. In the fine-tuning stage, you can select corresponding supervised learning tasks (such as text classification, named entity recognition, question-answering system, dialogue system, etc.) according to specific application scenarios and task requirements, and prepare task-specific text datasets, so that you can use the pre-trained model as the starting point for fine-tuning, and use supervised learning to fine-tune on the task-specific text dataset. Specifically, you can perform the task based on the text dataset, and minimize the loss used to measure the performance of the model when processing specific tasks through back propagation and optimization algorithms (such as gradient descent), iteratively update model parameters, and gradually improve the performance of the model on specific tasks. In practical applications, fine-tuning can flexibly choose supervised learning, unsupervised learning, or semi-supervised learning methods according to specific application scenarios and the type of available data.
[0043] It should be noted that the pre-trained large language model is usually called the base model of the large language model, and the fine-tuned large language model is called the service model of the large language. The language understanding ability learned by the large language model in the pre-training and fine-tuning stages enables the large language model to understand, analyze and integrate text information, perform logical inference, knowledge reasoning or problem solving when faced with complex problems or tasks. This ability is usually called the reasoning ability of the large language model.
[0044] Large language models usually perform specific tasks under the guidance of prompt text (which can be called prompt). Prompt text is an initial text or text fragment provided to the large language model, which is intended to stimulate the model to produce corresponding output. Through the prompt text, you can clearly tell the large language model what task you expect it to perform, such as: answering a question, simulating a conversation, writing an article, translating text, etc. At the same time, the prompt text can provide the large language model with the necessary background information and context, so that the large language model can understand the logic, style, theme or position that should be followed when generating content. In addition, the prompt text can also stimulate the large language model to show its inherent knowledge reserves or specific language capabilities, such as: explaining complex concepts, citing regulations, imitating the writing style of a specific writer, etc.
[0045] Intelligent dialogue systems mainly rely on the knowledge acquired by the large language model during the training process by learning static corpus. Due to the limitations of this knowledge, the system may have hallucination problems when answering complex or specific questions. The hallucination problem refers to the fact that the content generated by the large language model looks very reasonable and coherent, and sometimes even imitates human emotions and thinking, creating an illusion of "understanding" the input content, but in fact, this content is inaccurate or misleading. In other words, this reliance on static corpus limits the adaptability and response accuracy of the intelligent dialogue system.
[0046] In order to improve the adaptability and response accuracy of the intelligent dialogue system, the RAG (Retrieval-Augmented Generation) method can be used to combine information retrieval and model generation, so that when answering questions raised by users, the intelligent dialogue system no longer relies solely on the knowledge acquired by the large language model through learning static corpus during the training process, but can first perform information retrieval in a large document collection based on the question, and then understand and answer the question based on the retrieved relevant documents, and generate the corresponding answer. In other words, the document collection can be combined with the large language model, and relevant information can be retrieved from the document collection in real time during the model generation process to assist the model in making more accurate and comprehensive answers or decisions. Since the retrieved information and the context of the question are taken into account during the model generation process, it can be ensured that the generated content not only meets actual needs, but is also accurate, reliable, coherent, and natural.
[0047] For information retrieval, traditional information retrieval systems mainly rely on keyword matching and text similarity-based algorithms to provide information retrieval results. However, this approach has significant shortcomings in many aspects such as complex and multiple entity-related queries.
[0048] In order to cope with complex queries and multi-entity related queries in the information retrieval process, graphs can be used to implement information retrieval.
[0049] Graphs are data stored and managed in a graphical structure. In a graph, data is stored using nodes, edges, and properties. This storage method is very suitable for expressing complex relationships between entities. In a graph, nodes represent entities, such as people, places, events, etc. Each node can have multiple attributes to describe the specific information of the entity. Edges are used to represent the relationship between nodes, such as "know", "belong to", "located in", etc. Edges can also contain attributes to describe the characteristics of the relationship, such as the strength of the relationship, the establishment time, etc. Attributes are data fields attached to nodes or edges to store specific information, such as a person's name, age, or the start date of a relationship.
[0050] By combining graphs to implement information retrieval, graphs can be used to capture entities and their relationships. For complex queries or queries involving multiple entities and their interactions, more accurate and context-relevant information retrieval results can be provided.
[0051] One or more embodiments of the present application provide a technical solution for implementing information retrieval. In the technical solution, a graph for information retrieval can be pre-constructed, in which each node in the graph represents each candidate entity word, and each edge is used to indicate that the candidate entity words represented by the connected nodes have an association relationship; subsequently, when a query text for triggering information retrieval is obtained, named entity recognition can be first performed on the query text to identify the retrieval entity words from the query text, and then the association degree of each candidate entity word with respect to the retrieval entity word can be calculated based on the constructed graph, and then several candidate entity words with the highest association degree with respect to the retrieval entity word can be determined as associated entity words, and based on the association degree of the associated entity word with respect to the retrieval entity word, the association degree of each candidate document with respect to the query text is calculated, and finally several candidate documents with the highest association degree with respect to the query text can be determined as associated documents, and the associated documents are determined as information retrieval results corresponding to the query text.
[0052] In the above method, a graph is combined to realize information retrieval. Since the graph can be used to capture entity words in the searchable documents and the association between entity words, when retrieving documents based on entity words contained in the query text, it can ensure that the information retrieval results are more accurate and more targeted than the original query. In addition, the graph can be constructed in advance so that the constructed graph can be directly used in the subsequent information retrieval process, thereby improving the efficiency of information retrieval combined with the graph.
[0053] Please refer to Figure 1 , Figure 1 It is a schematic diagram of a system shown in an exemplary embodiment of the present application.
[0054] like Figure 1 As shown, the above system may include a server, and at least one client accessing the server through any type of wired or wireless network.
[0055] Among them, the above-mentioned server can correspond to a server including an independent physical host, or it can be a server cluster composed of multiple independent physical hosts; or it can correspond to a virtual server, cloud server, etc. carried by a host cluster.
[0056] The above-mentioned client may correspond to terminal devices such as smart phones, tablet computers, laptops, desktop computers, PCs (Personal Computers), PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), smart car devices or game consoles.
[0057] like Figure 1 The system shown may be an information retrieval system. A user may use the information retrieval service provided by the information retrieval system through the client; the client and the server may implement user-oriented information retrieval services through data interaction between each other.
[0058] For example, the client can output a specific user interface to the user, so that the user can perform operations such as inputting query text (which can be called Query) and selecting the information retrieval scope (such as a document collection in a specific field) in the user interface to initiate a query to the information retrieval system and use the information retrieval service provided by the information retrieval system. The client can send the query text input by the user to the server, and the server performs information retrieval in the document collection carried on the server based on the query text, obtains the corresponding information retrieval result (such as the retrieved document), and outputs the information retrieval result to the user, that is, returns the information retrieval result to the client, and the client displays the information retrieval result to the user through the user interface for the user to view, thereby realizing a user-oriented information retrieval service.
[0059] Specifically, the server may be equipped with an information retrieval component, which specifically performs information retrieval operations in the document collection carried on the server based on the query text. In addition, the server may also be equipped with a graph corresponding to the document collection, so that the information retrieval component can use the graph to perform information retrieval.
[0060] Continue to refer Figure 1 ,like Figure 1 The system shown may also be an intelligent dialogue system that can provide information retrieval related services. Users can use the intelligent dialogue service provided by the intelligent dialogue system through the client; the client and the server can implement user-oriented intelligent dialogue services through data interaction between each other.
[0061] For example, the client can output a corresponding user interface to the user, so that the user can ask questions to the intelligent dialogue system by performing operations such as inputting query text (which can be called Query or Question) and uploading documents for auxiliary query in the user interface, and use the intelligent dialogue service provided by the intelligent dialogue system. The client can send the query text input by the user to the server, and the server will perform reasoning on the query text, generate the corresponding answer text (which can be called Answer), and output the answer text to the user, that is, return the answer text to the client, and the client will display the answer text to the user through the user interface for the user to view, thereby realizing a user-oriented intelligent dialogue service.
[0062] Specifically, the server may be equipped with a large language model, and the intelligent dialogue system may be based on the large language model, wherein the large language model understands and answers the query text input by the user and generates an answer text corresponding to the query text.
[0063] At this time, the above-mentioned large language model can refer to the service model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using an unsupervised learning method to obtain the basic model of the large language model; further, the dialogue task can be used as a supervised learning task during fine-tuning, and a text dataset specific to the dialogue task can be prepared, so that the basic model of the large language model can be used as the starting point for fine-tuning, and a supervised learning method can be used to fine-tune on a text dataset specific to the dialogue task to obtain the service model of the large language model.
[0064] In order to improve the adaptability and response accuracy of the intelligent dialogue system, the server can also be equipped with a document collection and an information retrieval component. In the reasoning process of the service model of the large language model, the information retrieval component performs information retrieval in the document collection based on the query text, so as to assist the service model of the large language model to generate an answer text corresponding to the query text input by the user through the retrieved relevant documents. In addition, the server can also be equipped with a graph corresponding to the document collection, so that the information retrieval component can use the graph to perform information retrieval.
[0065] In actual applications, the server may also be equipped with other functional components or functional subsystems such as a prompt generation component. These components or subsystems can work together with the large language model installed on the server to jointly generate an answer text corresponding to the query text input by the user.
[0066] Please refer to Figure 2 , Figure 2 It is a schematic diagram of an information retrieval process shown in an exemplary embodiment of the present application.
[0067] like Figure 2 As shown, in the above information retrieval process, in order to improve the efficiency of information retrieval combined with graphs, a graph that is convenient for information retrieval can be pre-constructed, and the constructed graph can be directly used in the subsequent information retrieval process. Among them, each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an association relationship. It should be noted that the construction of the graph can be completed in an offline manner, while the information retrieval using the constructed graph is completed in an online manner.
[0068] When constructing a graph, first, candidate documents can be obtained, and named entity recognition can be performed on each candidate document to identify entity words from each candidate document. Then, based on the entity words identified from these candidate documents, subject-predicate-object triples can be extracted from each candidate document, and the entity words in each subject-predicate-object triple can be determined as entity words with an associated relationship. Then, the entity words identified from these candidate documents and the entity words in these subject-predicate-object triples can be determined as candidate entity words. In addition, the similarity between each target candidate entity word and each other candidate entity word among these candidate entity words can be calculated, and several candidate entity words with the highest similarity can be determined as candidate entity words with an associated relationship with the target candidate entity word. Finally, a graph can be constructed based on these candidate entity words and their associated relationships.
[0069] In addition, statistics of some specific information may be performed on the candidate documents, for example, the number of times each candidate entity word appears in each candidate document may be counted, and the corresponding relationship between the candidate entity word, the candidate document and the number of times the candidate entity word appears in the candidate document may be stored.
[0070] When using the constructed graph for information retrieval, first, a query text for triggering information retrieval can be obtained, and named entity recognition can be performed on the query text to identify entity words from the query text, and the entity words identified from the query text are determined as retrieval entity words. In addition, the similarity between the entity words identified from the query text and each candidate entity word can be calculated, and several candidate entity words with the highest similarity can also be determined as retrieval entity words. Then, based on the constructed graph, the association degree of each candidate entity word relative to each retrieval entity word can be calculated, and several candidate entity words with the highest association degree relative to each retrieval entity word can be determined as associated entity words. Then, the association degree of each candidate document relative to the query text can be calculated based on the association degree of each associated entity word relative to each retrieval entity word. Finally, several candidate documents with the highest association degree relative to the query text can be determined as associated documents, and these associated documents are determined as information retrieval results corresponding to the query text.
[0071] The information retrieval method provided by this application is described in detail below from two aspects: graph construction and use.
[0072] 1. Graph Construction
[0073] First of all, it should be noted that in the constructed graph, a node can represent an entity word (which can be called a candidate entity word), where an entity word refers to a word used to represent a specific or abstract entity; an edge can connect two nodes, and this edge is used to indicate that the candidate entity words represented by the two connected nodes are associated with each other. For example, suppose an edge in the graph connects node A and node B, node A represents candidate entity word A, and node B represents candidate entity word B, then this edge is used to indicate that candidate entity word A and candidate entity word B are associated with each other.
[0074] Please refer to Figure 3 , Figure 3 It is a flowchart of a graph construction method shown in an exemplary embodiment of the present application.
[0075] like Figure 3 As shown, the above graph construction method may include the following steps:
[0076] Step 302: Obtain candidate documents, and perform named entity recognition on the candidate documents to identify entity words from the candidate documents.
[0077] In this embodiment, one or more documents (which may be referred to as candidate documents) for constructing a graph may be obtained. It should be noted that, when a graph is constructed based on these candidate documents, the graph should be used in these candidate documents for information retrieval later, otherwise there may be inconsistencies in document information, resulting in failure of information retrieval. For example, assuming that these candidate documents are derived from a corpus, after a graph is constructed based on these candidate documents, if the graph is to be used for information retrieval, the corpus needs to be set as the information retrieval scope, that is, information retrieval is performed in the candidate documents contained in the corpus.
[0078] When the above-mentioned candidate documents are obtained, named entity recognition can be performed on each candidate document to identify a named entity (Named Entity) from each candidate document; since the named entity itself belongs to entity words, the named entity identified by named entity recognition can be directly determined as an entity word.
[0079] In some embodiments, a large language model may be used to perform named entity recognition on the candidate documents. Specifically, each candidate document may be input into the large language model, and the large language model may perform named entity recognition on each candidate document.
[0080] At this time, the above-mentioned large language model can refer to the service model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using an unsupervised learning method to obtain the basic model of the large language model; further, the named entity recognition task can be used as a supervised learning task during fine-tuning training, and a text dataset specific to the named entity recognition task can be prepared, so that the basic model of the large language model can be used as the starting point for fine-tuning, and a supervised learning method can be used to perform fine-tuning training on a text dataset specific to the named entity recognition task to obtain the service model of the large language model.
[0081] Step 304: Based on the entity words identified from the candidate document, subject-predicate-object triples are extracted from the candidate document, and the entity words in the subject-predicate-object triples are determined as entity words with an associated relationship.
[0082] In this embodiment, when the entity words are identified from the candidate documents, subject-verb-object triples may be further extracted from each candidate document based on the entity words.
[0083] The Subject-Predicate-Object Triple is a commonly used concept in natural language processing, information extraction, knowledge graphs, and other fields, and is used to represent the basic semantic structure in a sentence. A typical Subject-Predicate-Object Triple consists of three parts: Subject (S), Predicate (P), and Object (O). The subject is the entity that performs the action or is described; the predicate represents the action or state of the subject, usually composed of verbs; and the object is the entity that receives the action.
[0084] For a subject-predicate-object triple, the subject and the object are both entities, and the predicate can usually be regarded as the relationship between the two entities. Therefore, when the subject-predicate-object triples are extracted from the candidate documents, the entity words (usually the subject and the object) in each subject-predicate-object triple can be determined as entity words with an associated relationship.
[0085] Take the sentence "Xiao Ming ate an apple" as an example. In the subject-predicate-object triple extracted from this sentence, the subject is "Xiao Ming", the predicate is "ate", and the object is "apple". In this case, "Xiao Ming" and "apple" can be determined as two entity words, and the two entity words are determined as two entity words with an associated relationship.
[0086] In practical applications, OpenIE (Open Information Extraction) technology can be used to extract subject-verb-object triples from the above candidate documents. OpenIE is an information extraction technology that aims to automatically extract factual statements from unlabeled texts and represent them in the form of structured triples (usually subject-verb-object).
[0087] In some embodiments, a large language model may be used to extract subject-verb-object triples from each candidate document based on the entity words identified from the candidate documents. Specifically, the entity words identified from the candidate documents and each candidate document may be input into the large language model, and the large language model extracts subject-verb-object triples from each candidate document based on the entity words identified from the candidate documents.
[0088] At this time, the above-mentioned large language model can refer to the service model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using an unsupervised learning method to obtain a basic model of the large language model; further, the triple extraction task can be used as a supervised learning task during fine-tuning training, and a text dataset specific to the triple extraction task can be prepared, so that the basic model of the large language model can be used as the starting point for fine-tuning, and a supervised learning method can be used to perform fine-tuning training on a text dataset specific to the triple extraction task to obtain a service model of the large language model.
[0089] It should be noted that extracting subject-predicate-object triples from these candidate documents based on the entity words identified from the above candidate documents can ensure that the extracted information is as comprehensive as possible and reduce information omissions. This is because these entity words are essentially named entities with specific meanings. Named entities are usually the most important information carriers in sentences. They can quickly locate the core content in the text and help accurately determine the subject and object in the sentence. The relationship between named entities is usually the most critical part of the sentence. Constructing subject-predicate-object triples based on named entities can make information extraction more focused and targeted, avoid inaccurate information extraction caused by ambiguity or incorrect parsing, and better capture the relationship between entities to ensure the integrity of information extraction. In addition, for sentences containing multiple clauses or complex structures, it is difficult to directly extract subject-predicate-object triples, but named entities can provide a reliable starting point to help parse complex sentence structures, thereby more comprehensively understanding the meaning of sentences and correctly extracting information.
[0090] In some embodiments, in order to improve the processing efficiency and accuracy of the candidate documents, the original candidate documents may be cleaned first, and then the cleaned candidate documents may be processed by named entity recognition, subject-verb-object triple extraction, etc. The cleaning operation may specifically include deduplication, long text segmentation, and removal of irrelevant words.
[0091] Step 306: Determine the entity words identified from the candidate document and the entity words in the subject-verb-object triples as candidate entity words, and construct a graph based on the candidate entity words and their association relationships.
[0092] In this embodiment, the entity words identified from the candidate documents and the entity words in the subject-verb-object triples extracted from the candidate documents can be determined as candidate entity words, and based on the entity words with associated relationships among the entity words, it can be further determined whether the candidate entity words have associated relationships with each other. In this way, a graph can be constructed based on the candidate entity words and their associated relationships. Specifically, a node in the graph can represent a candidate entity word, and an edge in the graph can be used to indicate that the candidate entity words represented by the two nodes connected by the edge have an associated relationship.
[0093] It should be noted that the entity words identified from the candidate documents may have duplicate parts with the entity words in the subject-verb-object triples extracted from the candidate documents. Therefore, when determining these entity words as the candidate entity words, these entity words may be deduplicated so that the determined candidate entity words are different from each other and each of the candidate entity words is unique.
[0094] For example, assuming that the entity words identified from the candidate documents include entity word A and entity word B, and the entity words in the subject-predicate-object triples extracted from these candidate documents include entity word A, entity word B and entity word C, then entity word A, entity word B and entity word C can be determined as candidate entity word A, candidate entity word B and candidate entity word C respectively; further assuming that entity word A and entity word B belong to the same subject-predicate-object triple, and entity word A and entity word C belong to the same subject-predicate-object triple, that is, entity word A and entity word B are entity words with an associated relationship, and entity word A and entity word C are entity words with an associated relationship, then it can be determined that candidate entity word A and candidate entity word B have an associated relationship, and candidate entity word A and candidate entity word C have an associated relationship. In this case, the constructed graph can be as follows: Figure 4A As shown, node A, node B and node C represent candidate entity word A, candidate entity word B and candidate entity word C respectively, node A and node B are connected by an edge, and node A and node C are also connected by an edge.
[0095] In some embodiments, in order to construct a richer graph and make the relationship between different entity words clearer, other entity words similar to each named entity can be found, and a graph can be constructed based on similar entity words at the same time. Specifically, the above-mentioned candidate entity words can be used as target candidate entity words, and the similarity between the target candidate entity word and each other candidate entity word is calculated, and the preset number (i.e., Top K) of candidate entity words with the highest similarity are determined as candidate entity words that have an association relationship with the target candidate entity word.
[0096] In some embodiments, the word embedding technology can be used to calculate the similarity of different entity words. Specifically, when calculating the similarity between the above-mentioned target candidate entity word (assuming it is candidate entity word A) and any other candidate entity word (assuming it is candidate entity word B), the candidate entity word A and the candidate entity word B can be embedded respectively to obtain the embedding vectors corresponding to the candidate entity word A and the candidate entity word B respectively, so that the similarity of the embedding vector corresponding to the candidate entity word A and the embedding vector corresponding to the candidate entity word B can be calculated as the similarity between the candidate entity word A and the candidate entity word B.
[0097] In practical applications, the K nearest neighbor algorithm can be used to conveniently determine the Top K candidate entity words with the highest similarity to the above target candidate entity words.
[0098] Continue as Figure 4A Taking the example shown in the figure as an example, assuming that the two candidate entity words with the highest similarity to candidate entity word A are candidate entity word D and candidate entity word E, where the similarity between candidate entity word A and candidate entity word D is 90%, and the similarity between candidate entity word A and candidate entity word E is 88%, it can be determined that candidate entity word A and candidate entity word D have an association relationship, and candidate entity word A and candidate entity word E have an association relationship. In this case, the constructed graph can be as follows Figure 4B As shown, nodes A, B, C, D and E represent candidate entity word A, candidate entity word B, candidate entity word C, candidate entity word D and candidate entity word E respectively. Node A and node B are connected by an edge, node A and node C are connected by an edge, node A and node D are connected by an edge, and node A and node E are also connected by an edge.
[0099] In some embodiments, in order to make the relationship between different entity words more specific and clear, corresponding weights can also be set for each edge in the constructed graph. In the graph, if the nodes representing candidate entity words belonging to the same subject-verb-object triple are called first-class nodes, and the nodes representing similar candidate entity words are called second-class nodes, the weight of the edge connecting the first-class nodes can be a preset value, and the weight of the edge connecting the second-class nodes can be the similarity of the candidate entity words represented by the second-class nodes.
[0100] Continue as Figure 4A and Figure 4BTaking the example shown as an example, since candidate entity word A and candidate entity word B belong to the same subject-predicate-object triple, and candidate entity word A and candidate entity word C belong to the same subject-predicate-object triple, the weight of the edge connecting node A and node B can be set to 1, and the weight of the edge connecting node A and node C can also be set to 1. Since the similarity between candidate entity word A and candidate entity word D is 90%, and the similarity between candidate entity word A and candidate entity word E is 88%, the weight of the edge connecting node A and node D can be set to 0.9, and the weight of the edge connecting node A and node E can be set to 0.88. In this case, the constructed graph can be as follows Figure 4C shown.
[0101] It should be noted that the edges in the above graph can usually be undirected edges. However, in some special cases, in order to better represent the relationship between candidate entity words, the edges in the graph can also be directed edges, which is not limited in this application.
[0102] In addition, the construction logic of the above graph can be flexibly adjusted according to actual needs. For example, according to actual needs, a portion of candidate entity words that are more critical in the application scenario can be selected, and by adjusting the number of other candidate entity words similar to the candidate entity word, the in-degree (i.e., the number of edges connecting the node) of the node representing the candidate entity word in the constructed graph can be adjusted.
[0103] In some embodiments, in order to further improve the efficiency of information retrieval, statistics of some specific information may be performed on the candidate documents. For example, the number of times each candidate entity word appears in each candidate document may be counted, and the corresponding relationship between the candidate entity word (specifically, the unique identifier of the candidate entity word), the candidate document (specifically, the unique identifier of the candidate document), and the number of times the candidate entity word appears in the candidate document may be stored, as shown in Table 1 below:
[0104] Table 1
[0105] Candidate entity words Candidate Documents Occurrence Candidate entity word A Candidate document 1 18 Candidate entity word B Candidate document 1 26 Candidate entity word A Candidate Document 2 12 …… …… ……
[0106] 2. Use of images
[0107] Please refer to Figure 5 , Figure 5 It is a flowchart of an information retrieval method shown in an exemplary embodiment of the present application.
[0108] like Figure 5 As shown, the above information retrieval method may include the following steps:
[0109] Step 502: Acquire a query text for triggering information retrieval, perform named entity recognition on the query text to identify entity words from the query text, and determine the entity words identified from the query text as retrieval entity words.
[0110] In this embodiment, a query text for triggering information retrieval can be obtained. When the query text is obtained, named entity recognition can be performed on the query text to identify entity words from the query text. It should be noted that the entity words identified from the query text can be used as retrieval entity words for subsequent information retrieval.
[0111] In some embodiments, a large language model may be used to perform named entity recognition on the query text. Specifically, the query text may be input into the large language model, and the large language model may perform named entity recognition on the query text.
[0112] At this time, the large language model can refer to the service model of the large language model. It should be noted that in order to ensure the consistency of the identified named entities and facilitate the implementation of information retrieval, the large language model and the large language model used for named entity recognition for the candidate documents can be the same large language model.
[0113] In some embodiments, although the named entities identified from the above query text can reflect the main intent of the query, they may not be sufficient to fully cover the deep meaning of the query. Therefore, in order to expand the semantic scope of the query and thus improve the accuracy of information retrieval, other entity words similar to each named entity can be found, and similar entity words can also be determined as retrieval entity words. Specifically, for an entity word identified from the query text, the similarity between this entity word and each candidate entity word can be calculated, and a preset number (i.e., Top K) of candidate entity words with the highest similarity can also be identified as retrieval entity words.
[0114] In some embodiments, when calculating the similarity between any entity word (assuming it is entity word A) and any candidate entity word (assuming it is candidate entity word B) identified from the above query text, the entity word A and the candidate entity word B can be embedded respectively to obtain embedding vectors corresponding to the entity word A and the candidate entity word B respectively, so that the similarity between the embedding vector corresponding to the entity word A and the embedding vector corresponding to the candidate entity word B can be calculated as the similarity between the entity word A and the candidate entity word B.
[0115] In practical applications, the K nearest neighbor algorithm can be used to conveniently determine the Top K candidate entity words with the highest similarity to each entity word identified from the query text.
[0116] Step 504: Based on the graph, calculate the relevance of each candidate entity word relative to the search entity word.
[0117] In this embodiment, since the constructed graph nodes can reflect the association relationship between different candidate entity words, based on the graph, the above-mentioned search entity words can be found in the graph first, and then the association degree of each candidate entity word with respect to each search entity word can be calculated.
[0118] In some embodiments, based on a random walk algorithm, in the graph, the nodes representing the retrieval entity words are respectively used as the starting nodes, the possibility metrics of walking from the starting node to each other node are calculated, and the relevance of the candidate entity words represented by each other node relative to each retrieval entity word is determined based on the possibility metrics. Specifically, for a retrieval entity word, based on a random walk algorithm, in the graph, the node representing the retrieval entity word is used as the starting node, the possibility metrics of walking from the starting node to each other node are calculated, and the relevance of the candidate entity words represented by each other node relative to the retrieval entity word is determined based on the possibility metrics.
[0119] The random walk algorithm is a probability-based algorithm that is widely used in many fields such as graph theory, statistical physics, and computer science. It describes a process of moving on a graph or other structure, where each move is chosen randomly. Depending on the application, random walks can be used to explore graphs, simulate physical processes, analyze network characteristics, etc.
[0120] In the random walk algorithm, for a given graph, starting from a certain starting node, the adjacent nodes are randomly selected as the next destination according to certain rules (usually uniform distribution or weighted probability distribution). Among them, for each node in an undirected graph, if it is connected to N edges and the edges have no weights, the probability of moving from this node to any of its neighboring nodes is 1 / N; for each node in a directed graph, if it has M outgoing edges and the edges have no weights, the probability of moving from this node to any of its neighboring nodes is 1 / M. If the edges in the graph have weights, the transition probability can be adjusted according to the weights of the edges, for example, the normalized weights can be used as the transition probability.
[0121] The stop condition of the random walk algorithm can be set to stop after a fixed number of steps, or it can stop when the walk passes through all possible nodes, or other specific conditions can be used to decide when to stop.
[0122] Through the random walk algorithm, we can get the probability distribution of each node in the graph in a stable state, which indicates the possibility of staying at each node starting from the starting node.
[0123] In practical applications, the random walk algorithm may specifically be a PageRank algorithm or a PersonalizedPageRank algorithm.
[0124] Step 506: Determine a preset number of candidate entity words with the highest association with the search entity words as associated entity words, and calculate the association of each candidate document with respect to the query text based on the association of the associated entity words with respect to the search entity words.
[0125] In this embodiment, a preset number (i.e., TopK) of candidate entity words with the highest degree of association with the above-mentioned search entity word can be determined as associated entity words. Specifically, for a search entity word, the TopK candidate entity words with the highest degree of association with the search entity word can be determined as associated entity words of the search entity word.
[0126] When the associated entity words of each search entity word are determined, the relevance of each candidate document to the query text can be calculated based on the relevance of each associated entity word to each search entity word. For example, the sum of the relevance of the associated entity words appearing in each candidate document to each search entity word can be used as the relevance of the candidate document to the query text.
[0127] In some embodiments, for each candidate document, not only the relevance of the associated entity words appearing in the candidate document to the retrieval entity words will affect the relevance of the candidate document to the query text, but also the number of times the associated entity words appear in the candidate document will actually affect the relevance of the candidate document to the query text. Therefore, the relevance of the candidate document to the query text can be calculated based on the relevance of each associated entity word to each retrieval entity word and the number of times each associated entity word appears in the candidate document.
[0128] In some embodiments, each candidate document may be determined as a target document in turn, and the relevance of each associated entity word relative to the search entity word is calculated first, and the product of the number of times the associated entity word appears in the target candidate document is used as the relevance of the associated word relative to the query text. Subsequently, the sum of the relevance of each associated entity word relative to the query text may be calculated as the relevance of the target document relative to the query text.
[0129] For example, suppose there are candidate document 1, search entity word A, search entity word B, candidate entity word C and candidate entity word D, where the relevance of candidate entity word C to search entity word A is 0.9, the relevance of candidate entity word C to search entity word B is 0.88, candidate entity word C appears 15 times in candidate document 1, the relevance of candidate entity word D to search entity word A is 0.95, the relevance of candidate entity word D to search entity word B is 0.55, and candidate entity word D appears 10 times in candidate document 1, then the following formula can be used:
[0130] The relevance of candidate entity word C to the query text is (0.9+0.88) / 2*15=13.35 (where (0.9+0.88) / 2 is the average relevance of candidate entity word C to all searched entity words);
[0131] The relevance of the candidate entity word D to the query text is (0.95+0.55) / 2*10=7.5 (where (0.95+0.55) / 2 is the average relevance of the candidate entity word D to all searched entity words);
[0132] The relevance of candidate document 1 to the query text is 13.35+7.5=20.85.
[0133] Step 508: Determine a preset number of candidate documents with the highest relevance to the query text as relevant documents, and determine the relevant documents as information retrieval results corresponding to the query text.
[0134] In this embodiment, when the relevance of each candidate document to the query text is calculated, a preset number (i.e., Top K) of candidate documents with the highest relevance to the query text can be determined as relevant documents, so that these relevant documents can be determined as information retrieval results corresponding to the query text. Specifically, these candidate documents can be sorted in descending order of relevance to the query text, and according to the sorting result, the top K candidate documents can be determined as relevant documents.
[0135] Alternatively, the above ranking results may be directly used as the information retrieval results corresponding to the above query text, and this application does not impose any special restrictions on this.
[0136] As mentioned above, the intelligent dialogue system can adopt the RAG method, combining information retrieval and model generation, to provide services to users. In this case, the query text and the information retrieval results can be input into the large language model, and the large language model can perform reasoning based on the query text and the information retrieval results to generate an answer text corresponding to the query text. For example, based on the query text and the information retrieval results, a prompt text can be constructed to stimulate the large language model to use the information retrieval results and the context in the query text to perform a dialogue task, and the prompt text can be input into the large language model, and the large language model can perform reasoning based on the query text and the information retrieval results under the guidance of the prompt text to generate a corresponding answer text.
[0137] At this time, the above-mentioned large language model may refer to a serving model of the large language model, and the serving model of the large language model is obtained by fine-tuning based on the dialogue task.
[0138] It should be noted that the large language model used to perform dialogue tasks can be the same large language model as the aforementioned large language model used for named entity recognition and the large language model used for subject-verb-object triple extraction, or can be different large language models, and this application does not impose any special restrictions on this.
[0139] In the above technical scheme, a graph for information retrieval can be pre-constructed, in which each node represents each candidate entity word, and each edge is used to indicate that the candidate entity words represented by the connected nodes have an association relationship; subsequently, when a query text for triggering information retrieval is obtained, named entity recognition can be first performed on the query text to identify the retrieval entity words from the query text, and then the association degree of each candidate entity word with respect to the retrieval entity word can be calculated based on the constructed graph, and then several candidate entity words with the highest association degree with respect to the retrieval entity word can be determined as associated entity words, and based on the association degree of the associated entity word with respect to the retrieval entity word, the association degree of each candidate document with respect to the query text is calculated, and finally several candidate documents with the highest association degree with respect to the query text can be determined as associated documents, and the associated documents are determined as the information retrieval results corresponding to the query text.
[0140] In the above method, a graph is combined to realize information retrieval. Since the graph can be used to capture entity words in the searchable documents and the association between entity words, when retrieving documents based on entity words contained in the query text, it can ensure that the information retrieval results are more accurate and more targeted than the original query. In addition, the graph can be constructed in advance so that the constructed graph can be directly used in the subsequent information retrieval process, thereby improving the efficiency of information retrieval combined with the graph.
[0141] Corresponding to the aforementioned method embodiments, the present application also provides device embodiments.
[0142] Please refer to Figure 6 , Figure 6 It is a structural diagram of a device shown in an exemplary embodiment of the present application. At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, and of course may also include other required hardware. One or more embodiments of the present application can be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of the present application do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic module, but can also be hardware or logic devices.
[0143] Please refer to Figure 7 , Figure 7 It is a block diagram of an information retrieval device shown in an exemplary embodiment of the present application.
[0144] The above information retrieval device can be applied to Figure 6 The device shown is used to implement the technical solution of the present application. The device includes:
[0145] The word acquisition module 702 acquires a query text for triggering information retrieval, and performs named entity recognition on the query text to identify entity words from the query text, and determines the entity words identified from the query text as retrieval entity words;
[0146] The word association calculation module 704 calculates the association of each candidate entity word with respect to the search entity word based on the graph; wherein each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an association relationship;
[0147] The document relevance calculation module 706 determines a preset number of candidate entity words with the highest relevance to the search entity word as associated entity words, and calculates the relevance of each candidate document to the query text according to the relevance of the associated entity words to the search entity word;
[0148] The associated document determination module 708 determines a preset number of candidate documents with the highest degree of association with the query text as associated documents, and determines the associated documents as information retrieval results corresponding to the query text.
[0149] In some embodiments, the apparatus further comprises:
[0150] The model generation module inputs the query text and the information retrieval result into a large language model, and the large language model performs reasoning based on the query text and the information retrieval result to generate an answer text corresponding to the query text.
[0151] In some embodiments, the apparatus further comprises a graph construction module, configured to:
[0152] Acquire the candidate document, and perform named entity recognition on the candidate document to identify entity words from the candidate document;
[0153] Based on the entity words identified from the candidate document, extracting subject-predicate-object triples from the candidate document, and determining the entity words in the subject-predicate-object triples as entity words with an associated relationship;
[0154] The entity words identified from the candidate documents and the entity words in the subject-verb-object triples are determined as candidate entity words, and the graph is constructed according to the candidate entity words and their association relationships.
[0155] In some embodiments, the graph construction module is further configured to:
[0156] The similarity between each target candidate entity word and each other candidate entity word in the candidate entity words is calculated, and a preset number of candidate entity words with the highest similarity are determined as candidate entity words that have an association relationship with the target candidate entity word.
[0157] In some embodiments, each edge in the graph is set with a corresponding weight; wherein the weight of the edge connecting the first type of nodes is a preset value, and the weight of the edge connecting the second type of nodes is the similarity of the candidate entity words represented by the second type of nodes; the candidate entity words represented by the first type of nodes are candidate entity words belonging to the same subject-predicate-object triple; and the candidate entity words represented by the second type of nodes are similar candidate entity words.
[0158] In some embodiments, performing named entity recognition on the candidate document includes:
[0159] Inputting the candidate document into a large language model, and allowing the large language model to perform named entity recognition on the candidate document;
[0160] The performing named entity recognition on the query text includes:
[0161] The query text is input into the large language model, and the large language model performs named entity recognition on the query text.
[0162] In some embodiments, extracting subject-verb-object triples from the candidate document based on the entity words identified from the candidate document includes:
[0163] The entity words identified from the candidate document and the candidate document are input into a large language model, and the large language model extracts subject-verb-object triples from the candidate document based on the entity words identified from the candidate document.
[0164] In some embodiments, the graph construction module is further configured to:
[0165] The number of times each candidate entity word appears in each candidate document is counted, and the corresponding relationship between the candidate entity word, the candidate document, and the number of times the candidate entity word appears in the candidate document is stored.
[0166] In some embodiments, the word acquisition module is further used to:
[0167] The similarity between the entity word identified from the query text and each candidate entity word is calculated, and a preset number of candidate entity words with the highest similarity are determined as retrieval entity words.
[0168] In some embodiments, calculating the similarity of different entity words includes:
[0169] Perform embedding processing on each entity word to obtain the embedding vector corresponding to each entity word;
[0170] The similarity of the embedding vectors corresponding to different entity words is calculated as the similarity of different entity words.
[0171] In some embodiments, the step of calculating the relevance of each candidate entity word relative to the search entity word based on the graph includes:
[0172] Based on the random walk algorithm, in the graph, the node representing the retrieved entity word is taken as the starting node, the possibility measure of walking from the starting node to other nodes is calculated, and the association degree of the candidate entity words represented by other nodes with respect to the retrieved entity word is determined according to the possibility measure.
[0173] In some embodiments, the calculating the relevance of each candidate document to the query text according to the relevance of the associated entity word to the search entity word includes:
[0174] The relevance of each candidate document to the query text is calculated according to the relevance of the associated entity word to the search entity word and the number of times the associated entity word appears in each candidate document.
[0175] In some embodiments, the calculating the relevance of each candidate document to the query text according to the relevance of the associated entity word to the search entity word and the number of times the associated entity word appears in each candidate document includes:
[0176] Determine each candidate document as a target document in turn, and calculate the relevance of each associated entity word relative to the search entity word, and multiply the product of the number of times the associated entity word appears in the target candidate document as the relevance of the associated word relative to the query text;
[0177] The sum of the relevance of each associated entity word with respect to the query text is calculated as the relevance of the target document with respect to the query text.
[0178] For the device embodiment, it basically corresponds to the method embodiment, so the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the technical solution of the present application.
[0179] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0180] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0181] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0182] Computer-readable media include permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0183] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0184] The above specific embodiments of the present application are described. Other embodiments are within the scope of the present application. In some cases, the actions or steps recorded in the present application can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0185] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings. The term "and / or" refers to and includes any or all possible combinations of one or more associated listed items.
[0186] The description of the terms "one embodiment", "some embodiments", "example", "specific example" or "an implementation method" etc. used in one or more embodiments of the present application means that the specific features or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present application. The schematic description of these terms is not necessarily for the same embodiment. Moreover, the specific features or characteristics described can be combined in a suitable manner in one or more embodiments of the present application. In addition, different embodiments and specific features or characteristics in different embodiments can be combined without contradicting each other.
[0187] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determination".
[0188] The above description is merely a preferred embodiment of one or more embodiments of the present application and is not intended to limit one or more embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application shall be included in the scope of protection of one or more embodiments of the present application.
[0189] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
Claims
1. An information retrieval method, the method comprising: Acquiring a query text for triggering information retrieval, and performing named entity recognition on the query text to identify entity words from the query text, and determining the entity words identified from the query text as retrieval entity words; Based on the graph, the relevance of each candidate entity word relative to the search entity word is calculated; wherein each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an associated relationship; Determine a preset number of candidate entity words with the highest relevance to the search entity word as associated entity words, and calculate the relevance of each candidate document to the query text according to the relevance of the associated entity words to the search entity word; A preset number of candidate documents with the highest relevance to the query text are determined as relevant documents, and the relevant documents are determined as information retrieval results corresponding to the query text.
2. The method according to claim 1, further comprising: The query text and the information retrieval result are input into a large language model, and the large language model performs reasoning based on the query text and the information retrieval result to generate an answer text corresponding to the query text.
3. The method according to claim 1, further comprising: Acquire the candidate document, and perform named entity recognition on the candidate document to identify entity words from the candidate document; Based on the entity words identified from the candidate document, extracting subject-predicate-object triples from the candidate document, and determining the entity words in the subject-predicate-object triples as entity words with an associated relationship; The entity words identified from the candidate documents and the entity words in the subject-verb-object triples are determined as candidate entity words, and the graph is constructed according to the candidate entity words and their association relationships.
4. The method according to claim 3, further comprising: The similarity between each target candidate entity word and each other candidate entity word in the candidate entity words is calculated, and a preset number of candidate entity words with the highest similarity are determined as candidate entity words that have an association relationship with the target candidate entity word.
5. According to the method of claim 4, each edge in the graph is set with a corresponding weight; wherein, The weight of the edge connecting the first type of nodes is a preset value, and the weight of the edge connecting the second type of nodes is the similarity of the candidate entity words represented by the second type of nodes; the candidate entity words represented by the first type of nodes are candidate entity words belonging to the same subject-predicate-object triple; The candidate entity words represented by the second type of nodes are similar candidate entity words.
6. According to the method of claim 3, the performing named entity recognition on the candidate document comprises: Inputting the candidate document into a large language model, and allowing the large language model to perform named entity recognition on the candidate document; The performing named entity recognition on the query text includes: The query text is input into the large language model, and the large language model performs named entity recognition on the query text.
7. The method according to claim 3, wherein extracting subject-verb-object triples from the candidate document based on entity words identified from the candidate document comprises: The entity words identified from the candidate document and the candidate document are input into a large language model, and the large language model extracts subject-verb-object triples from the candidate document based on the entity words identified from the candidate document.
8. The method according to claim 3, further comprising: The number of times each candidate entity word appears in each candidate document is counted, and the corresponding relationship between the candidate entity word, the candidate document, and the number of times the candidate entity word appears in the candidate document is stored.
9. The method according to claim 4, further comprising: The similarity between the entity word identified from the query text and each candidate entity word is calculated, and a preset number of candidate entity words with the highest similarity are determined as retrieval entity words.
10. The method according to claim 9, calculating the similarity of different entity words, comprising: Perform embedding processing on each entity word to obtain the embedding vector corresponding to each entity word; The similarity of the embedding vectors corresponding to different entity words is calculated as the similarity of different entity words.
11. According to the method of claim 1, the step of calculating the relevance of each candidate entity word relative to the search entity word based on the graph comprises: Based on the random walk algorithm, in the graph, the node representing the retrieved entity word is taken as the starting node, the possibility measure of walking from the starting node to other nodes is calculated, and the association degree of the candidate entity words represented by other nodes with respect to the retrieved entity word is determined according to the possibility measure.
12. The method according to claim 1, wherein the step of calculating the relevance of each candidate document to the query text based on the relevance of the associated entity word to the search entity word comprises: The relevance of each candidate document to the query text is calculated according to the relevance of the associated entity word to the search entity word and the number of times the associated entity word appears in each candidate document.
13. The method according to claim 12, wherein the step of calculating the relevance of each candidate document to the query text based on the relevance of the associated entity word to the search entity word and the number of times the associated entity word appears in each candidate document comprises: Determine each candidate document as a target document in turn, and calculate the relevance of each associated entity word relative to the search entity word, and multiply the product of the number of times the associated entity word appears in the target candidate document as the relevance of the associated word relative to the query text; The sum of the relevance of each associated entity word with respect to the query text is calculated as the relevance of the target document with respect to the query text.
14. An information retrieval device, comprising: A word acquisition module, which acquires a query text for triggering information retrieval, and performs named entity recognition on the query text to identify entity words from the query text, and determines the entity words identified from the query text as retrieval entity words; A word association calculation module calculates the association of each candidate entity word with respect to the search entity word based on a graph; wherein each node in the graph represents each candidate entity word, and the candidate entity words represented by the nodes connected by each edge in the graph have an association relationship; A document relevance calculation module is configured to determine a preset number of candidate entity words with the highest relevance to the search entity word as associated entity words, and calculate the relevance of each candidate document to the query text according to the relevance of the associated entity words to the search entity word; The associated document determination module determines a preset number of candidate documents with the highest degree of association with the query text as associated documents, and determines the associated documents as information retrieval results corresponding to the query text.
15. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 13 by running the executable instructions.
16. A computer-readable storage medium having computer instructions stored thereon, wherein the instructions are executed by a processor to implement the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Material retrieval method and device, electronic equipment and storage medium
CN110750627A
Information retrieval method, question and answer processing method and information retrieval device and system
CN116186220A
Information processing system, information processing method, and information processing program
JP2023051423A
Method For Information Retrieval
US20080195601A1
Information recommendation method and apparatus, electronic device, and readable storage medium
US20210397980A1
Cited By
Text retrieval method, medium, computer equipment and program product
CN120429430A