Information query method and device, electronic equipment and readable storage medium
By obtaining the query words and calculating the word frequency, inverse document frequency and word distance factors of the target keyword, the problem of difficulty in accurately querying information in information retrieval is solved, and more efficient and accurate information retrieval effect is achieved.
Patent Information
- Application Number
- CN202411675356.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-04
AI Technical Summary
In the field of information retrieval, with the explosive growth of network data, it has become a challenge to extract useful information from a large number of documents quickly and accurately. Traditional methods such as keyword-based queries have limitations in dealing with complex query requirements and no effective solutions have been proposed.
By obtaining the query words input by the target object, multiple target keywords corresponding to the query words are determined, and the target word frequency, inverse document frequency and word distance factors of each target keyword are calculated. These factors are combined to determine the sub-query results, and finally the target query results corresponding to the query words are obtained.
By comprehensively considering the target word frequency, inverse document frequency and word distance factors, this method can more accurately evaluate the correlation between keywords and documents, improve the accuracy and efficiency of information retrieval, reduce interference from irrelevant information, and solve the technical problem of difficulty in accurately querying corresponding information.
Smart Images

Figure CN119557402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information query, and in particular to an information query method, device, electronic device and readable storage medium. Background Art
[0002] In the field of information retrieval, with the explosive growth of network data, it has become a challenge to quickly and accurately extract useful information from a large number of documents. Traditional methods, such as keyword-based queries, although popular, have limitations in handling complex query requirements.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide an information query method, device, electronic device and readable storage medium to at least solve the technical problem in the related art that it is difficult to accurately query corresponding information.
[0005] According to one aspect of an embodiment of the present invention, there is provided an information query method, comprising: obtaining a query word input by a target object; determining a plurality of target keywords corresponding to the query word; for each target keyword, determining a plurality of target word frequencies respectively corresponding to each target keyword, and determining an inverse document frequency respectively corresponding to each target keyword, and determining a plurality of word distance factors respectively corresponding to each target keyword, wherein the plurality of target word frequencies are obtained by performing logarithmic smoothing processing on the respectively corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keywords appear in a plurality of target query documents respectively, and the ratio of all words appearing in the corresponding target query documents, the inverse document frequency is obtained based on a first quantity, a second quantity, a third quantity, and a fourth quantity, and the first quantity is a third quantity. The first number is the total number of documents in multiple field-related documents, the second number is the number of documents containing the corresponding target keyword in the multiple field-related documents, the third number is the total number of words in the multiple field-related documents, and the fourth number is the number of times the target keyword appears in the multiple field-related documents. The multiple field-related documents are documents included in the fields related to the corresponding target keywords; based on multiple target word frequencies corresponding to each target keyword, the inverse document frequencies corresponding to each target keyword, and the multiple word distance factors corresponding to each target keyword, sub-query results corresponding to the multiple target keywords are determined; based on the sub-query results corresponding to the multiple target keywords, the target query result corresponding to the query word is determined.
[0006] Optionally, determining multiple target keywords corresponding to the query term includes: determining the correlation between the query term and multiple nodes in the target topology graph, wherein the multiple nodes correspond one-to-one to multiple keywords; and determining multiple target keywords for the query result based on the multiple correlations.
[0007] Optionally, before determining the correlation between the query term and multiple nodes in the target topology map, it also includes: obtaining an initial topology map and updating topology parameters, wherein the updated topology parameters include new keyword information corresponding to the new keyword, and initial keyword information corresponding to the initial keyword, and the initial topology map includes multiple target nodes; based on the initial keyword information corresponding to the initial keyword, the weights of multiple target nodes in the initial topology map are updated, and based on the new keyword information corresponding to the new keyword, new nodes are added to the initial topology map, and the weights of the new nodes are determined to obtain a target topology map, wherein the new nodes correspond to the new keywords.
[0008] Optionally, obtaining an initial topology map includes: obtaining a sample text; extracting a plurality of initial keywords from the sample text; determining initial weight values corresponding to the plurality of initial keywords based on word frequencies and positions corresponding to the plurality of initial keywords; determining associated words corresponding to the plurality of initial keywords; and constructing the initial topology map based on the plurality of initial keywords, the initial weight values corresponding to the plurality of initial keywords, and the associated words, wherein the initial topology map includes a plurality of target nodes, and the plurality of target nodes correspond one-to-one to the plurality of initial keywords.
[0009] Optionally, determining the word distance factor corresponding to each target keyword includes: for each target keyword, determining the first position number of the first appearance of the target keyword in multiple target query documents, the second position number of the last appearance, and the number of occurrences of the target keyword in the multiple target query documents; determining multiple word distance factors corresponding to each target keyword based on the first position number of the first appearance of the target keyword in multiple target query documents, the second position number of the last appearance, and the number of occurrences of the target keyword in the multiple target query documents.
[0010] Optionally, determining the inverse document frequency corresponding to each target keyword includes: for each target keyword, determining the ratio of the first number to the second number to obtain a first ratio, and determining the ratio of the third number to the fourth number to obtain a second ratio; determining the sum of a predetermined coefficient value and the second ratio; and determining the inverse document frequency corresponding to each target keyword based on the logarithmic first ratio and the logarithmic sum.
[0011] Optionally, after determining the target query result corresponding to the query word based on the sub-query results corresponding to the multiple target keywords respectively, it also includes: receiving feedback results from the target object on the target query result; and adjusting the method of calling keywords based on the query word based on the feedback results.
[0012] According to one aspect of an embodiment of the present invention, an information query device is provided, comprising: an acquisition module for acquiring a query word input by a target object; a first determination module for determining a plurality of target keywords corresponding to the query word; a second determination module for determining, for each target keyword, a plurality of target word frequencies respectively corresponding to each target keyword, and determining an inverse document frequency respectively corresponding to each target keyword, and determining a plurality of word distance factors respectively corresponding to each target keyword, wherein the plurality of target word frequencies are obtained by performing logarithmic smoothing processing on the respectively corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keywords appear in a plurality of target query documents respectively, and the ratio of all words appearing in the corresponding target query documents, and the inverse document frequency is obtained based on the first number, the second number, the third number, and the fourth number. , the first number is the total number of documents in multiple field-related documents, the second number is the number of documents containing the corresponding target keyword in the multiple field-related documents, the third number is the total number of words in the multiple field-related documents, and the fourth number is the number of times the target keyword appears in the multiple field-related documents. The multiple field-related documents are documents included in the fields related to the corresponding target keywords; the third determination module is used to determine the sub-query results corresponding to the multiple target keywords based on the multiple target word frequencies corresponding to each target keyword, the inverse document frequencies corresponding to each target keyword, and the multiple word distance factors corresponding to each target keyword; the fourth determination module is used to determine the target query result corresponding to the query word based on the sub-query results corresponding to the multiple target keywords.
[0013] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the information query method as described in any one of the above items.
[0014] According to one aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the above-mentioned information query methods.
[0015] In an embodiment of the present invention, a query word input by a target object is obtained. A plurality of target keywords corresponding to the query word are determined. For each target keyword, a plurality of target word frequencies corresponding to each target keyword are determined, and an inverse document frequency corresponding to each target keyword is determined, and a plurality of word distance factors corresponding to each target keyword are determined, wherein the plurality of target word frequencies are obtained by logarithmic smoothing of the corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keyword appears in a plurality of target query documents, and the ratio of all words appearing in the corresponding target query documents, and the inverse document frequency is obtained according to a first quantity, a second quantity, a third quantity, and a fourth quantity, wherein the first quantity is the total number of documents of a plurality of field-related documents, the second quantity is the number of documents containing the corresponding target keyword in a plurality of field-related documents, the third quantity is the total number of words in a plurality of field-related documents, and the fourth quantity is the number of times the target keyword appears in a plurality of field-related documents, and the plurality of field-related documents are documents included in the field related to the corresponding target keyword. According to the plurality of target word frequencies corresponding to each target keyword, the inverse document frequencies corresponding to each target keyword, and the plurality of word distance factors corresponding to each target keyword, the subquery results corresponding to the plurality of target keywords are determined. According to the sub-query results corresponding to the multiple target keywords, the target query result corresponding to the query word is determined. Since the embodiment of the present invention comprehensively considers the target word frequency, the inverse document frequency, and the word distance factor, the query result is determined together. Since the target word frequency is an improved word frequency, not only the frequency of occurrence of the word in the document is considered, but also the word frequency is logarithmically smoothed to reduce the excessive influence of local high-frequency words on the importance of the document, while considering the distribution range of the term in the document, and adjusting it by introducing the word distance factor. The introduction of the word distance factor helps to evaluate the closeness between the keyword and the document, which can further improve the accuracy of the query result. The inverse document frequency makes it more suitable for specific query scenarios and improves the ability of keywords to distinguish document sets. By integrating the improved word frequency, the inverse document frequency and the word distance factor, the information retrieval system can make a more refined assessment of the relevance between the query word and the document. This method enhances the depth of semantic understanding of the query word, improves the accuracy of the retrieval results, reduces the interference of irrelevant information, and thus solves the technical problem in the related technology that it is difficult to accurately query the corresponding information. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0017] Figure 1 is a flow chart of an information query method according to an embodiment of the present invention;
[0018] Figure 2 is a flow chart of an information query method provided by an optional embodiment of the present invention;
[0019] Figure 3 is a structural block diagram of an information query device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] Example 1
[0023] According to an embodiment of the present invention, an embodiment of an information query method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0024] Figure 1 is a flow chart of an information query method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0025] Step S102, obtaining a query word input by a target object;
[0026] In step S102 provided in the present application, a query word input by a target object is obtained.
[0027] Among them, the target object is involved. In computer science and software development, the target object usually refers to the entity that needs to be operated or interacted in system design. In information retrieval or user interface applications, the target object usually refers to the user, that is, the person who uses the system to query or operate.
[0028] Among them, query words are involved. In the field of information retrieval, query words refer to the text entered by the user into the search box, including keywords, phrases, sentences, etc., which are used to initiate the retrieval process to find the most relevant information based on the query words.
[0029] In this step, the query words entered by the target object are obtained, which describes a basic step of information retrieval. The user (target object) enters the key information (query words) they want to query through the interface, and the system receives these query words and parses their meanings, and then searches for relevant information in the database based on the query words. This process is the starting point of information retrieval and the basis for understanding user needs and providing accurate information.
[0030] By obtaining accurate query terms, the system can understand user needs more accurately, provide search results that are highly relevant to the query terms, and improve user experience and satisfaction. Accurate query terms reduce the scope and time of system searches, improve retrieval efficiency, and enable users to quickly obtain the information they need.
[0031] Step S104, determining a plurality of target keywords corresponding to the query word;
[0032] In step S104 provided in the present application, a plurality of target keywords corresponding to the query term are determined.
[0033] Among them, target keywords are involved. Target keywords are a group of keywords that the system determines to be most relevant to the query words after algorithm analysis and processing. These keywords can usually more accurately express the user's real needs and are used for the next step of deep information retrieval.
[0034] Through this step, multiple target keywords corresponding to the query words are determined. After the user enters the query words, the system first analyzes the query words to identify their core semantics and information needs. Then, the system will use natural language processing technologies such as word segmentation, part-of-speech tagging, semantic analysis, etc. to further parse the query words and extract or generate multiple keywords (target keywords) that are highly relevant to the query words. These keywords may contain synonyms, related concepts, or more specific descriptions of the query words. By determining the target keywords, the system can more deeply understand the user's query intent, so that in the subsequent retrieval process, it can more accurately and comprehensively match relevant information resources.
[0035] Target keywords usually reflect the real needs of users more accurately. Compared with searching directly with query words, they can improve the relevance and accuracy of search results and reduce the interference of irrelevant information. Through semantic analysis of query words, the system can extract or generate multiple related keywords, which will help the system conduct in-depth searches in a wider range of resources, thereby improving the coverage of information.
[0036] Step S106, for each target keyword, determine a plurality of target word frequencies respectively corresponding to each target keyword, determine an inverse document frequency respectively corresponding to each target keyword, and determine a plurality of word distance factors respectively corresponding to each target keyword, wherein the plurality of target word frequencies are obtained by logarithmically smoothing the corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keyword appears in the plurality of target query documents respectively, and the ratio of all words appearing in the corresponding target query documents, the inverse document frequency is obtained according to a first quantity, a second quantity, a third quantity, and a fourth quantity, the first quantity is the total number of documents of the plurality of field-related documents, the second quantity is the number of documents containing the corresponding target keyword in the plurality of field-related documents, the third quantity is the total number of words in the plurality of field-related documents, the fourth quantity is the number of times the target keyword appears in the plurality of field-related documents, and the plurality of field-related documents are documents included in the field related to the corresponding target keyword;
[0037] In step S106 provided in the present application, multiple target word frequencies, inverse document frequencies, and multiple word distance factors corresponding to each target keyword are determined.
[0038] Among them, the target word frequency is involved. The target word frequency refers to the frequency of a target keyword appearing in a document or a group of documents in information retrieval or natural language processing. It is an important indicator for evaluating the relevance between documents and keywords.
[0039] Among them, logarithmic smoothing is involved. Logarithmic smoothing is a mathematical processing method used to prevent the problem of excessive weight when calculating the inverse document frequency (IDF) due to the keywords appearing too frequently in certain documents. By performing logarithmic smoothing on the word frequency or inverse document frequency, the impact of such outliers can be reduced, making the calculation of keyword weights more reasonable and stable.
[0040] Among them, the inverse document frequency (IDF) is involved. The inverse document frequency is a common indicator used in information retrieval and natural language processing to evaluate the importance of keywords in a document collection. The higher the IDF value, the lower the frequency of the keyword in the document collection, and the greater the contribution to the uniqueness and discrimination of the document. In the present invention, the inverse document frequency is calculated based on the total number of documents, the number of documents containing keywords, the total number of words in the document, and the number of times the keyword appears.
[0041] Among them, the word distance factor is involved. The word distance factor refers to the distance between the first and last occurrence of a keyword in a document, which is used to evaluate the distribution of keywords in the entire document. The smaller the word distance factor, the more concentrated the distribution of keywords in the entire document, and the more critical it is to the expression of the document theme.
[0042] Through this step, the target word frequency can be calculated. The initial word frequency is obtained by counting the number of times the target keyword appears in the target query document and the ratio of the number of appearances to the total number of words in the document. Then, the system performs logarithmic smoothing on the initial word frequency to obtain the target word frequency. The target word frequency reflects the importance of the target keyword in each document, but the smoothed word frequency can more accurately reflect the distribution of the keyword and avoid the influence of word frequency outliers on the results. Then, the inverse document frequency is calculated. Based on the total number of documents, the number of documents containing the target keyword, the total number of words in the document, and the number of times the target keyword appears, the system calculates the inverse document frequency of each target keyword. The IDF value reflects the rarity of the target keyword in the document collection and has an important influence on distinguishing the document topic. Then, the word distance factor is calculated. The system also calculates the distance between the first and last occurrence positions of each target keyword in the document to evaluate the distribution of the keyword in the document. A small word distance factor indicates that the keyword distribution is concentrated and is more critical to the expression of the document topic. These steps effectively combine word frequency, inverse document frequency, and word distance factor to more comprehensively and accurately evaluate the relevance of keywords to documents, providing more precise basic data for subsequent keyword-information relevance calculations.
[0043] Through this step, the accuracy of information retrieval is improved. By comprehensively considering the target word frequency, inverse document frequency and word distance factor, the improved TF-IDF algorithm can more accurately evaluate the relevance between keywords and documents, thereby improving the accuracy and relevance of information retrieval. In addition, logarithmic smoothing can reduce the impact of word frequency outliers on keyword weight calculation, making the results more stable and reasonable. The introduction of the word distance factor takes into account the distribution of keywords in the entire document, which can more accurately reflect the contribution of keywords to the document topic and avoid misjudgment when keywords are locally concentrated but their actual contribution is not large.
[0044] Step S108, determining sub-query results corresponding to the plurality of target keywords respectively according to the plurality of target word frequencies respectively corresponding to each target keyword, the inverse document frequencies respectively corresponding to each target keyword, and the plurality of word distance factors respectively corresponding to each target keyword;
[0045] In step S108 provided in the present application, the sub-query result is determined.
[0046] Among them, subquery results are involved. In information retrieval, subquery results refer to the document sets obtained after searching for each target keyword separately. These sets may overlap, but each set contains the documents most relevant to a specific keyword.
[0047] In this step, the process of generating the most relevant document subset (subquery result) for each target keyword from a large number of documents is described. The documents are scored by comprehensively considering the target word frequency, inverse document frequency and word distance factor. The higher the score, the stronger the relevance between the document and the keyword. Then, the system provides the high-scoring document set corresponding to each target keyword as the subquery result to the user.
[0048] By comprehensively considering the target word frequency, inverse document frequency, and word distance factor, the system can more accurately evaluate the relevance of documents and keywords and improve the accuracy of search results. The calculation of target word frequency and inverse document frequency takes into account data sparsity and outliers, and the word distance factor takes into account the distribution of keywords in the document. The combination of the three can more effectively reduce data noise and improve search efficiency. In addition, the system can process multiple target keywords at the same time, generate subquery results for each keyword, and finally provide more comprehensive search services by merging and sorting these results to meet users' complex query needs.
[0049] Step S110 , determining a target query result corresponding to the query word according to the sub-query results corresponding to the plurality of target keywords.
[0050] In step S110 provided in the present application, a target query result is determined.
[0051] Among them, the target query result is involved. The target query result is the document set that is most relevant to the user's query term after comprehensively considering the sub-query results of all target keywords. It is the final output of information retrieval and is designed to meet the user's information needs.
[0052] In this way, the independent search results for multiple target keywords are integrated into a unified set of documents that are most relevant to the user's query intent. Specifically, the information retrieval system first generates corresponding sub-query results for each target keyword, that is, a list of the most relevant documents. Then, the system uses certain strategies, such as union, intersection, weighted average, etc., to integrate these independent sub-query results to generate a final document set, namely the target query result. This set contains the documents that are most relevant to the user's query, regardless of whether these documents are related to all target keywords at the same time or are highly matched to only one or several keywords.
[0053] By integrating multiple sub-query results in this way, the system can more comprehensively cover multiple aspects of the user's query intent, making the target query results more accurate and rich. The system will also intelligently process duplicate documents in multiple sub-query results to avoid providing duplicate information to users, thereby increasing the diversity and value of information. Moreover, the target query results are generated based on the user's query terms, which is closer to the user's actual needs, allowing users to find the information they need faster, improving query efficiency and satisfaction.
[0054] Through the above steps S102-S110, the query word input by the target object is obtained. Multiple target keywords corresponding to the query word are determined. For each target keyword, multiple target word frequencies corresponding to each target keyword are determined, and the inverse document frequency corresponding to each target keyword is determined, and multiple word distance factors corresponding to each target keyword are determined, wherein the multiple target word frequencies are obtained by logarithmic smoothing of the corresponding initial word frequencies, the multiple initial word frequencies are the number of times the corresponding target keywords appear in multiple target query documents, and the ratio of all words appearing in the corresponding target query documents, the inverse document frequency is obtained according to the first number, the second number, the third number, and the fourth number, the first number is the total number of documents in multiple field-related documents, the second number is the number of documents containing the corresponding target keyword in multiple field-related documents, the third number is the total number of words in multiple field-related documents, the fourth number is the number of times the target keyword appears in multiple field-related documents, and the multiple field-related documents are the documents included in the field related to the corresponding target keyword. According to the multiple target word frequencies corresponding to each target keyword, the inverse document frequencies corresponding to each target keyword, and the multiple word distance factors corresponding to each target keyword, the sub-query results corresponding to the multiple target keywords are determined. According to the sub-query results corresponding to the multiple target keywords, the target query results corresponding to the query words are determined. Since the embodiment of the present invention comprehensively considers the target word frequency, the inverse document frequency, and the word distance factor, the query results are determined together. Since the target word frequency is an improved word frequency, not only the frequency of occurrence of the word in the document is considered, but also the word frequency is logarithmically smoothed to reduce the excessive influence of local high-frequency words on the importance of the document, and the distribution range of the terms in the document is considered, and the word distance factor is introduced to adjust. The introduction of the word distance factor helps to evaluate the closeness between the keyword and the document, which can further improve the accuracy of the query result. The inverse document frequency makes it more suitable for specific query scenarios and improves the ability of keywords to distinguish document sets. By integrating the improved word frequency, the inverse document frequency and the word distance factor, the information retrieval system can make a more refined evaluation of the relevance between the query word and the document. This method enhances the depth of semantic understanding of query terms, improves the accuracy of retrieval results, reduces interference from irrelevant information, and thereby solves the technical problem in related technologies that it is difficult to accurately query corresponding information.
[0055] As an optional embodiment, determining multiple target keywords corresponding to the query word includes: determining the correlation between the query word and multiple nodes in the target topology graph, wherein the multiple nodes correspond one-to-one to the multiple keywords; and determining multiple target keywords for the query results based on the multiple correlations.
[0056] In this embodiment, the step of determining a plurality of target keywords corresponding to a query word is described.
[0057] Among them, the target topology graph is involved. In the field of information retrieval, the target topology graph is a graphical model that represents the semantic relationship between keywords, usually composed of nodes and edges. Nodes represent keywords, and edges represent the association between keywords, such as similarity, co-occurrence frequency, etc.
[0058] Among them, relevance is involved. In information retrieval or knowledge graph, relevance refers to the degree of correlation or connection strength between two entities (such as keywords, documents, etc.). In the target topology graph, the relevance between the query term and the node (keyword) reflects the semantic similarity between the query term and the keyword.
[0059] In the steps involved in this embodiment, the system first constructs or updates a target topology graph, in which the nodes represent keywords, and the edges reflect the semantic associations between the keywords. This step is usually based on a large amount of text data, using natural language processing techniques such as word vectors, co-occurrence analysis, topic models, etc., to construct a relationship graph between keywords. The system matches the query word with each node (keyword) in the target topology graph and calculates the association between the query word and the node. Here, the calculation of the association may be based on a variety of methods, such as the word vector similarity between the query word and the node keyword, the co-occurrence frequency of the query word and the node keyword in the document, and the topic similarity between the query word and the node keyword in the topic model. Finally, the system selects multiple nodes (keywords) with the highest association with the query word based on the calculated association, as target keywords, for subsequent information retrieval. These target keywords can usually more accurately reflect the intention of the user's query and improve the accuracy and relevance of the retrieval results.
[0060] In this way, the keyword with the highest correlation with the query word can be found in the target topology map. The system can understand the semantics of the query word more accurately, select the most relevant keyword for retrieval, and improve the quality and satisfaction of the retrieval results. Moreover, the target topology map contains not only the query word, but also multiple keywords related to the query word. Therefore, using the target keyword for retrieval can expand the retrieval scope, improve information coverage, and help users discover more valuable information.
[0061] As an optional embodiment, before determining the correlation between the query term and multiple nodes in the target topology map, it also includes: obtaining an initial topology map and updating topology parameters, wherein the updated topology parameters include new keyword information corresponding to the new keywords, and initial keyword information corresponding to the initial keywords, and the initial topology map includes multiple target nodes; based on the initial keyword information corresponding to the initial keywords, the weights of multiple target nodes in the initial topology map are updated, and based on the new keyword information corresponding to the new keywords, new nodes are added to the initial topology map, and the weights of the new nodes are determined to obtain a target topology map, wherein the new nodes correspond to the new keywords.
[0062] In this embodiment, the steps of obtaining a target topology map are described.
[0063] Among them, the initial topology graph is involved. The initial topology graph is the initial graphical model used to represent the semantic association between keywords in the information retrieval system. It consists of nodes and edges, where nodes represent keywords and edges represent the connection strength or semantic similarity between keywords.
[0064] Among them, it involves updating topological parameters, which refers to the process of adjusting the weights of nodes in the graph or adding new nodes based on new data or information on the basis of the initial topological graph. This includes the newly added keyword information corresponding to the newly added keywords, and the initial keyword information corresponding to the initial keywords.
[0065] Among them, target nodes are involved. Target nodes refer to nodes that already exist in the initial topology map. They represent a series of keywords currently known to the system.
[0066] Among them, weight is involved. In a topological graph or knowledge graph, weight is usually used to represent the importance of a node or edge in the graph or the strength of the connection. In the field of information retrieval, node weight may reflect the popularity, importance, and relevance of a keyword to the query term, etc.
[0067] Among them, new nodes are involved. New nodes refer to nodes newly added to the graph based on newly collected keyword information when the topology graph is updated. They represent newly discovered or newly added keywords in the system.
[0068] Through the steps in this embodiment, an initial topological map is first obtained, which contains known keywords and their associations. This map may be constructed based on historical data, domain knowledge or a pre-trained model. Then the update topological parameters are determined, that is, the system collects new keyword information, including the latest information of newly added keywords and initial keywords, such as their frequency of occurrence in the text, co-occurrence relationship, topic distribution, etc. Then the target node weight is adjusted, that is, based on the initial keyword information, the system adjusts the weight of the target node in the initial topological map, which may involve recalculating the similarity between keywords or adjusting the popularity index of keywords. After that, the system adds new nodes to the initial topological map based on the newly added keyword information, representing the newly discovered keywords, and calculates the weights of these newly added nodes. Through the above steps, the system obtains a topological map containing updated node weights and newly added nodes, that is, the target topological map. This map can more accurately reflect the semantic association between keywords and the importance of keywords.
[0069] Through this embodiment, the target topology map can more accurately reflect the semantic relationship between keywords, and when it is used for keyword recommendation or information retrieval, it can more accurately locate the information required by the user. Moreover, by continuously updating and expanding the topology map, the system can reflect changes in the information field in real time, adapt to the emergence of new words and changes in the importance of keywords, and maintain the timeliness and effectiveness of the retrieval system. The system automatically optimizes the topology map, and the user does not need to manually update the keyword list, which reduces the user's input burden and improves the user experience.
[0070] As an optional embodiment, obtaining an initial topology map includes: obtaining a sample text; extracting multiple initial keywords from the sample text; determining initial weight values corresponding to the multiple initial keywords based on the word frequencies and positions corresponding to the multiple initial keywords; determining associated words corresponding to the multiple initial keywords; and constructing an initial topology map based on the multiple initial keywords, the initial weight values and associated words corresponding to the multiple initial keywords, wherein the initial topology map includes multiple target nodes, and the multiple target nodes correspond one-to-one to the multiple initial keywords.
[0071] In this embodiment, the steps of constructing an initial topology map are described.
[0072] Among them, sample text is involved. Sample text is a representative text collection used to build or train models. It can come from a specific field or topic and is used to extract keywords and build relationships between keywords.
[0073] Among them, initial keywords are involved. Initial keywords are a series of keywords identified and extracted from sample texts and used to construct the initial topology graph. They may be words with high frequency and semantic key in the sample texts.
[0074] Among them, the initial weight value is involved. The initial weight value refers to the value representing the importance assigned to each initial keyword node when constructing the initial topology graph. The initial weight value can be calculated based on information such as word frequency, position, and co-occurrence frequency.
[0075] Among them, related words are involved. Related words refer to words that are semantically closely related to the initial keywords and may appear in the same sentence, paragraph or text. The identification of related words helps to build edges between keywords and reflect the semantic association between keywords.
[0076] In the steps involved in this embodiment, sample text is obtained, and the system collects representative texts in a specific field as the data basis for constructing a topological map. After that, the initial keywords are extracted, and key words are identified and extracted from the sample text. These words may have a high word frequency or have an important impact on the text theme. Then the initial weight value is calculated, and the initial weight value of each keyword is calculated based on the word frequency and position information of the initial keywords in the sample text. The higher the word frequency, the greater the weight value; at the same time, the position of the keyword in the text will also affect the weight. For example, the keyword in the title may have a higher weight than the keyword at the end of the text. Then determine the associated words, identify a series of words that are semantically closely related to each initial keyword, and these associated words may appear in the same sentence or paragraph with the keyword, representing the degree of association between the keywords. Thus, based on the initial keywords, the initial weight value and the associated words, the system constructs an initial topological map, each node in the map represents an initial keyword, and the edge represents the association between the keywords. The weight of the edge is determined by the correlation and co-occurrence frequency between the keywords.
[0077] In this way, by calculating the initial weight values, the system can more accurately identify and extract key words in the sample text, avoiding the noise and bias that may exist in general keyword extraction technology. Determining related words and constructing a topological graph can intuitively display the semantic connection between keywords, providing a basis for subsequent information retrieval and knowledge graph construction. Based on the initial topological graph, the system can more efficiently perform keyword recommendations and information retrieval, provide results that are more relevant to the user's query intent, and improve the accuracy and satisfaction of retrieval.
[0078] As an optional embodiment, determining the word distance factor corresponding to each target keyword includes: for each target keyword, determining the first position number of the target keyword when it first appears in multiple target query documents, the second position number of the target keyword when it last appears, and the number of times the target keyword appears in multiple target query documents; determining multiple word distance factors corresponding to each target keyword based on the first position number of the target keyword when it first appears in multiple target query documents, the second position number of the target keyword when it last appears, and the number of times the target keyword appears in multiple target query documents.
[0079] In this embodiment, the step of determining the word distance factor is explained.
[0080] Among them, the word distance factor is involved. The word distance factor is an indicator to measure the distribution concentration of a keyword in a document. It is usually calculated based on the first and last positions of the keyword and the total number of times the keyword appears in the document.
[0081] Among them, the first position number is involved. In the document, the position where the keyword first appears can be represented by a number, which is called the first position number. The smaller the number, the closer the keyword is to the beginning of the document, which may reflect the importance of the keyword to the topic of the document.
[0082] Among them, the second position number is involved. Compared with the first position number, the position where the keyword appears for the last time is represented by a number, which is called the second position number. The larger the number, the closer the keyword is to the end of the document, which may also reflect the importance of the keyword in the document structure.
[0083] Through the steps in this embodiment, the word distance factor is determined for each target keyword to reflect the distribution characteristics of the keyword in the document. For each target keyword, the system will search in multiple target query documents, record the first position number of the first appearance of the keyword, the second position number of the last appearance, and the total number of times the keyword appears in each document. The word distance factor is calculated using the recorded position number and the number of keyword appearances. The calculation formula of the word distance factor may take into account the concentration of the keyword position and the distribution of the keyword occurrence frequency. The word distance factor reflects the distribution pattern of the keyword in the document, which helps to further evaluate the relevance of the keyword to the document. If the word distance factor is small, it means that the distribution of the keyword in the entire document is relatively concentrated, which may indicate that the keyword is closely related to the document theme; conversely, if the word distance factor is large, it means that the keyword distribution is relatively scattered and may have a low contribution to the document theme.
[0084] In this way, the accuracy of information retrieval can be improved. By calculating the word distance factor, the system can more accurately evaluate the relevance of keywords and documents, avoiding the problems that may exist in simple retrieval based only on word frequency, such as ignoring the distribution of keywords in the document. In addition, the word distance factor can be used to adjust the ranking of keywords in the query results, so that keywords with more concentrated distribution and more relevant to the topic are ranked higher, thereby improving the efficiency of users in obtaining information. Furthermore, the calculation of the word distance factor provides detailed information on the distribution of keywords in the document, which is conducive to more in-depth text analysis.
[0085] As an optional embodiment, determining the inverse document frequency corresponding to each target keyword includes: for each target keyword, determining the ratio of the first quantity to the second quantity to obtain the first ratio, and determining the ratio of the third quantity to the fourth quantity to obtain the second ratio; determining the sum of the predetermined coefficient value and the second ratio; and determining the inverse document frequency corresponding to each target keyword based on the logarithmic first ratio and the logarithmic sum.
[0086] In this embodiment, the step of determining the inverse document frequency is described.
[0087] Here, a predetermined coefficient value is involved, which may be a constant preset by the system and used to adjust the calculation formula of the inverse document frequency or introduce additional control factors.
[0088] The steps involved in this embodiment are variants of the inverse document frequency calculation method, which not only considers the frequency of occurrence of keywords in a document set, but also introduces additional factors for adjustment. That is, for each target keyword, the ratio of the number of documents containing the keyword (first number) to the total number of document sets (second number) is calculated to obtain a first ratio, which usually directly corresponds to the ratio of n / N in IDF calculation, where n is the number of documents containing the keyword and N is the total number of documents in the document set. Then the ratio of the third number to the fourth number (second ratio) is calculated. Although it is not directly used in traditional IDF calculation, additional control variables or statistical indicators may be introduced here, such as the frequency of occurrence of keywords in a specific type of document, or the average position information of keywords in the document, etc. A predetermined coefficient value (a system-set constant) is added to the second ratio, and then the sum is logarithmized. The introduction of this predetermined coefficient value may be used for smoothing calculation to avoid the problem of excessive IDF value when the frequency of occurrence of a certain word in a document set is extremely low. Finally, the system determines the inverse document frequency corresponding to each target keyword based on the logarithmic first ratio and the sum of the logarithmic predetermined coefficient value and the second ratio.
[0089] In this way, the recognition of rare words is enhanced. By introducing the predetermined coefficient value and the adjustment of the second ratio, the calculated inverse document frequency IDF can better reflect the uniqueness and importance of rare words in the document collection. In addition, the logarithmic operation helps to smooth the calculation results and prevent the IDF value from becoming abnormally high due to the low frequency of certain words in the document collection, thereby affecting the accuracy of subsequent information retrieval or text analysis. This method introduces additional ratio calculations (second ratios) and predetermined coefficient values, which provides greater flexibility for inverse document frequency calculations and can be adjusted according to different application requirements and statistical characteristics.
[0090] As an optional embodiment, after determining the target query result corresponding to the query word based on the sub-query results corresponding to multiple target keywords, it also includes: receiving feedback results from the target object on the target query result; and adjusting the method of calling keywords based on the query word based on the feedback results.
[0091] In this embodiment, the steps of adjusting the method of calling keywords according to the feedback results are described.
[0092] Among them, feedback results are involved. The feedback results are the target object's evaluation or response to the target query results provided by the system. They can be positive (such as satisfaction, high relevance) or negative (such as dissatisfaction, low relevance), and are used to guide system optimization.
[0093] This also involves the way in which query words call keywords. The way in which query words call keywords refers to the process of how the system uses query words to generate and select target keywords, including keyword extraction algorithms, weight allocation strategies, keyword combination methods, etc.
[0094] Through the steps involved in this embodiment, user feedback can be used to optimize the way in which query words call keywords to improve the accuracy of query results. That is, the system first generates multiple target keywords based on the user's query words, and uses these keywords to perform multiple sub-queries to obtain multiple sub-query results. The system integrates the sub-query results to form a target query result, which is the query result finally presented to the user. Next, the system will collect feedback from the target object (user) on the target query result, which may include the user's satisfaction with the query result, whether the required information is found, whether more relevant information is needed, etc. Finally, based on the results of user feedback, the system will adjust the way in which query words call keywords, including optimizing the keyword extraction algorithm, adjusting the keyword weight calculation strategy, improving the keyword combination and retrieval logic, etc., so as to provide a query result that better meets the user's needs in the next query.
[0095] In this way, the query accuracy can be improved. That is, through user feedback, the system can more accurately understand the real intention of the user's query, thereby adjusting the keyword extraction and calling strategy to improve the accuracy and relevance of the query results. In addition, the use of user feedback helps to reduce invalid queries in the process of obtaining information, save user time, improve information acquisition efficiency, and thus improve the overall user experience. The system can also adjust and optimize itself according to user feedback, realize adaptive learning, continuously improve information retrieval capabilities, and adapt to different user query habits and needs.
[0096] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.
[0097] In related technologies, there are even more difficulties when searching for dual-carbon related content. At present, domestic researchers have conducted relevant research on information query and text indexing, but lack research on the collection and query methods of dual-carbon field information, and the current main information query methods lack analysis of keywords and core themes in the information, making it difficult to obtain dual-carbon information related to the field of concern in a timely manner, and unable to guide the development of carbon-related work.
[0098] In view of this, an optional implementation of the present invention provides an information query method, which can solve the current problem that it is impossible to quickly and accurately query the most relevant dual-carbon field information based on keywords.
[0099] The optional implementation mode of the present invention is implemented by adopting the following technical solutions:
[0100] (1) Dual carbon information entry module
[0101] Users can store all the dual-carbon field information they are concerned about in the dual-carbon information entry module in the form of file import, and can subsequently import it repeatedly or delete the existing files;
[0102] (2) Keyword extraction module
[0103] The system extracts keywords from the carbon-dioxide information imported by the user based on the Text Rank algorithm to form a carbon-dioxide information keyword set. The keyword set will be updated after the system iterates the extraction algorithm or the user changes the imported file;
[0104] (3) Keyword storage module
[0105] After each update of the keyword set, the system will deduplicate the keywords in the set and store them in the keyword storage module;
[0106] (4) Keyword dictionary module
[0107] The system will query all the carbon neutrality information associated with each keyword in the keyword storage module based on the carbon neutrality information-keyword correspondence in the keyword extraction algorithm, form a keyword-carbon neutrality information mapping set, and store it in the keyword dictionary module;
[0108] (5) Carbon Neutrality Information Query Module
[0109] The system will query all the carbon neutrality information associated with the keyword entered by the user in the keyword dictionary module and store it in the carbon neutrality information query module;
[0110] (6) Relevance Calculation Module
[0111] The system calculates the relevance between the query keyword and all the carbon neutrality information associated with it based on the improved TF-IDF algorithm and sends the calculation result to the relevance sorting module;
[0112] (7) Relevance Sorting Module
[0113] Based on the relevance calculation result, perform relevance sorting and output all the carbon neutrality information associated with the keyword from largest to smallest.
[0114] This system realizes the rapid and accurate query of the most relevant carbon neutrality information for the keyword through 7 main functional modules, including information entry, keyword extraction, keyword-information mapping extraction, keyword-information relevance calculation, keyword-information relevance sorting, and keyword-information output.
[0115] Figure 2 It is the flowchart of the information query method provided by the optional embodiment of the present invention. As Figure 2 shown, the method provided by the optional embodiment of the present invention includes the following steps:
[0116] Step 1, Information Entry: Import all the information in the carbon neutrality field involved into a file to form a carbon neutrality information set and store it in the carbon neutrality information entry module;
[0117] Step 2, Word Segmentation: Use the word segmentation tool jieba to segment the given Chinese text and convert the text into a sequence of words;
[0118] Step 3, Stop Word Removal: Before extracting keywords from news texts, perform stop word processing to remove some meaningless high-frequency words, such as "de, shi, le, er, he", etc.;
[0119] Step 4, Represent the Text as a Graph: Represent each word in the text as a node in the graph, and if two words appear in the text simultaneously, connect an edge between them;
[0120] Step 5, Initial Weight Assignment: Assign an initial weight value to each node, and the initial value is set to 1;
[0121] Step 6: Iterate and calculate the weight of each node until convergence (that is, the difference between the weight values calculated twice before and after a node is less than the given threshold). The PageRank algorithm iteration formula is as follows:
[0122]
[0123] Among them, PR(V i ) is the importance of word i, ln(V j ) is the word set pointing to word i, Out(V j ) is the word set pointed to by word j, and d is the damping coefficient. When the number of web pages pointed to by i is 0, the rightmost term of the above formula is 0, and the damping coefficient avoids PR(V i ) is 0;
[0124] Step 7: Extract keywords, and extract the first three keywords in descending order of node weight values. All keyword sets extracted from dual-carbon information are deduplicated and stored in the keyword storage module;
[0125] Step 8, keyword matching, based on the corresponding relationship in keyword extraction, query all dual-carbon information associated with each keyword in the keyword storage module to form a keyword-dual-carbon information mapping set, and store it in the keyword dictionary module;
[0126] Step 9: Dual-carbon information query: after inputting keywords, all dual-carbon information associated with the keywords are searched in the keyword dictionary module and stored in the dual-carbon information query module;
[0127] Step 10: Improve the word frequency calculation method to calculate the improved word frequency TF(w,i)′ of each dual-carbon information i associated with the keyword w. The calculation formula is as follows:
[0128]
[0129] Among them, TF(w,i) is the initial word frequency, cout(w) represents the number of times word w appears in text i, |D i | represents the number of all words in text i.
[0130] TF(w,i)′=log(1+TF(w,i))
[0131] Step 11: Improve the inverse document frequency calculation method to calculate the improved inverse document frequency IDF(w,i)′ of each dual-carbon information i associated with the keyword w. The calculation formula is as follows:
[0132]
[0133] Where N is the total number of texts, DF(w) is the number of texts containing word w; M is the total number of words in the text, and KF(w) is the number of occurrences of word w in the text.
[0134] Step 12: Calculate the word distance factor, and calculate the word distance factor PS(w,i) of each dual-carbon information i associated with the keyword w. The calculation formula is as follows:
[0135]
[0136] Among them, first(p w,i ) represents the position number of the first occurrence of word w in text i, last(p w,i ) represents the position number of the last occurrence of word w in text i, and len(i) represents the total number of words in text i.
[0137] Step 13, calculate the improved TF-IDF(w,i)′, i.e., the relevance, and calculate the improved word frequency-inverse document frequency of each dual-carbon information i associated with the keyword w. The calculation formula is as follows:
[0138] TF-IDF(w,i)′=TF(w,i)′×IDF(w,i)′×PS(w,i)
[0139] Step 14: sorting by correlation degree: sorting by the calculated correlation degree from large to small, and outputting the dual-carbon information associated with the keyword.
[0140] Through the above optional implementation, at least the following beneficial effects can be achieved:
[0141] (1) The optional implementation mode of the present invention extracts a keyword set for information in the field of carbon dioxide, and calculates the relevance between each carbon dioxide information and the keyword, so as to quickly input the keyword to query the most relevant carbon dioxide information, thus filling the gap in the field of carbon dioxide in the field of information query;
[0142] (2) Dual-carbon information focuses on the fields of carbon peak and carbon neutrality. Its text professional vocabulary and noise vocabulary types are relatively single, and the distribution positions are relatively concentrated. Keyword extraction for this type of text needs to reduce the influence of common words on intra-class differentiation, and at the same time, the influence of keyword position factors needs to be considered. The current mainstream keyword extraction method is difficult to consider the above two points at the same time. The present invention optimizes the extraction method based on the characteristics of dual-carbon information text, and is also an effective attempt to extract keywords for this type of text in the field of information query;
[0143] (3) By optimizing the traditional TF-IDF algorithm and using logarithmic smoothing for TF and IDF, the problem of insufficient inter-class distinction in the traditional TF-IDF algorithm is solved. In order to avoid the influence of the final algorithm result on the increase of TF value when a certain keyword appears frequently in a local area, the word distance factor is introduced for adjustment to more accurately reflect the distribution range of the keyword. The improved TF-IDF algorithm comprehensively considers the inter-class distribution, intra-class distribution and distribution range of keywords, and improves the accuracy and reliability of word weights.
[0144] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.
[0146] Example 2
[0147] According to an embodiment of the present invention, a device for implementing the above information query method is also provided. Figure 3 is a structural block diagram of an information query device according to an embodiment of the present invention. Figure 3 As shown, the device includes: an acquisition module 302, a first determination module 304, a second determination module 306, a third determination module 308 and a fourth determination module 310. The device is described in detail below.
[0148] The acquisition module 302 is used to acquire the query word input by the target object; the first determination module 304 is connected to the acquisition module 302 and is used to determine multiple target keywords corresponding to the query word; the second determination module 306 is connected to the first determination module 304 and is used to determine, for each target keyword, multiple target word frequencies corresponding to each target keyword, and determine the inverse document frequency corresponding to each target keyword, and determine multiple word distance factors corresponding to each target keyword, wherein the multiple target word frequencies are obtained by performing logarithmic smoothing on the corresponding initial word frequencies, the multiple initial word frequencies are the number of times the corresponding target keywords appear in the multiple target query documents, and the ratio of all words appearing in the corresponding target query documents, and the inverse document frequency is obtained according to the first number, the second number, the third number, and the fourth number, and the first number is The total number of documents of multiple field-related documents, the second number is the number of documents containing the corresponding target keyword in the multiple field-related documents, the third number is the total number of words in the multiple field-related documents, and the fourth number is the number of times the target keyword appears in the multiple field-related documents. The multiple field-related documents are documents included in the fields related to the corresponding target keywords; the third determination module 308 is connected to the above-mentioned second determination module 306, and is used to determine the sub-query results corresponding to the multiple target keywords respectively according to the multiple target word frequencies corresponding to each target keyword respectively, the inverse document frequencies corresponding to each target keyword respectively, and the multiple word distance factors corresponding to each target keyword respectively; the fourth determination module 310 is connected to the above-mentioned third determination module 308, and is used to determine the target query result corresponding to the query word according to the sub-query results corresponding to the multiple target keywords respectively.
[0149] It should be noted here that the above-mentioned acquisition module 302, first determination module 304, second determination module 306, third determination module 308 and fourth determination module 310 correspond to steps S102 to S110 in implementing the information query method, and the instances and application scenarios implemented by the multiple modules are the same as the corresponding steps, but are not limited to the contents disclosed in the above-mentioned embodiment 1.
[0150] Example 3
[0151] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any one of the above-mentioned information query methods.
[0152] Example 4
[0153] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned information query methods.
[0154] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0155] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0156] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0159] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0160] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An information query method, characterized in that: include: Get the query word entered by the target object; Determining a plurality of target keywords corresponding to the query word; For each target keyword, determine a plurality of target word frequencies respectively corresponding to each target keyword, determine an inverse document frequency respectively corresponding to each target keyword, and determine a plurality of word distance factors respectively corresponding to each target keyword, wherein the plurality of target word frequencies are obtained by logarithmically smoothing the corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keyword appears in a plurality of target query documents respectively, and the ratio of all words appearing in the corresponding target query document, the inverse document frequency is obtained according to a first quantity, a second quantity, a third quantity, and a fourth quantity, the first quantity is the total number of documents of a plurality of field-related documents, the second quantity is the number of documents containing the corresponding target keyword in the plurality of field-related documents, the third quantity is the total number of words in the plurality of field-related documents, the fourth quantity is the number of times the target keyword appears in the plurality of field-related documents, and the plurality of field-related documents are documents included in the field related to the corresponding target keyword; Determine sub-query results corresponding to each target keyword according to multiple target word frequencies corresponding to each target keyword, inverse document frequencies corresponding to each target keyword, and multiple word distance factors corresponding to each target keyword; According to the sub-query results respectively corresponding to the multiple target keywords, a target query result corresponding to the query word is determined.
2. The method according to claim 1, characterized in that Determining a plurality of target keywords corresponding to the query term includes: Determine the correlation between the query word and a plurality of nodes in the target topology graph, wherein the plurality of nodes correspond to a plurality of keywords one by one; Based on the multiple relevances, multiple target keywords for query results are determined.
3. The method according to claim 2, characterized in that Before determining the correlation between the query word and the plurality of nodes in the target topology graph, the method further includes: Acquire an initial topology map and update topology parameters, wherein the update topology parameters include newly added keyword information corresponding to the newly added keyword and initial keyword information corresponding to the initial keyword, and the initial topology map includes multiple target nodes; Based on the initial keyword information corresponding to the initial keyword, the weights of multiple target nodes in the initial topology map are updated, and based on the new keyword information corresponding to the new keyword, new nodes are added to the initial topology map, and the weights of the new nodes are determined to obtain a target topology map, wherein the new nodes correspond to the new keywords.
4. The method according to claim 3, characterized in that Get the initial topology map, including: Get sample text; Extracting a plurality of initial keywords from the sample text; Determining initial weight values corresponding to the multiple initial keywords respectively according to the word frequencies and positions respectively corresponding to the multiple initial keywords; Determining associated words corresponding to the multiple initial keywords respectively; The initial topology graph is constructed based on the multiple initial keywords, the initial weight values and associated words respectively corresponding to the multiple initial keywords, wherein the initial topology graph includes multiple target nodes, and the multiple target nodes correspond to the multiple initial keywords one by one.
5. The method according to claim 1, characterized in that: Determine the word distance factor corresponding to each target keyword, including: For each target keyword, determine a first position number of the first occurrence of the target keyword in the plurality of target query documents, a second position number of the last occurrence of the target keyword, and the number of occurrences of the target keyword in the plurality of target query documents; Based on the first position number of the first appearance of the target keyword in multiple target query documents, the second position number of the last appearance, and the number of appearances of the target keyword in the multiple target query documents, multiple word distance factors corresponding to each target keyword are determined.
6. The method according to claim 1, characterized in that Determine the inverse document frequency corresponding to each target keyword, including: For each target keyword, determining a ratio of the first number to the second number to obtain a first ratio, and determining a ratio of the third number to the fourth number to obtain a second ratio; determining a sum of a predetermined coefficient value and the second ratio; According to the logarithmic first ratio and the logarithmic sum, the inverse document frequency corresponding to each target keyword is determined.
7. The method according to any one of claims 1 to 6, characterized in that After determining the target query result corresponding to the query word according to the sub-query results corresponding to the multiple target keywords, the method further includes: Receiving feedback from the target object on the target query result; According to the feedback result, the method of calling keywords according to the query words is adjusted.
8. An information query device, characterized in that: include: An acquisition module is used to acquire the query words input by the target object; A first determination module, used to determine a plurality of target keywords corresponding to the query word; A second determination module is used to determine, for each target keyword, a plurality of target word frequencies respectively corresponding to each target keyword, and determine an inverse document frequency respectively corresponding to each target keyword, and determine a plurality of word distance factors respectively corresponding to each target keyword, wherein the plurality of target word frequencies are obtained by logarithmically smoothing the corresponding initial word frequencies, the plurality of initial word frequencies are the number of times the corresponding target keywords appear in a plurality of target query documents respectively, and the ratio of all words appearing in the corresponding target query documents, the inverse document frequency is obtained according to a first quantity, a second quantity, a third quantity, and a fourth quantity, the first quantity being the total number of documents of a plurality of field-related documents, the second quantity being the number of documents containing the corresponding target keyword in the plurality of field-related documents, the third quantity being the total number of words in the plurality of field-related documents, the fourth quantity being the number of times the target keyword appears in the plurality of field-related documents, and the plurality of field-related documents being documents included in fields related to the corresponding target keyword; A third determination module is used to determine sub-query results corresponding to each target keyword according to multiple target word frequencies corresponding to each target keyword, inverse document frequencies corresponding to each target keyword, and multiple word distance factors corresponding to each target keyword; The fourth determining module is used to determine the target query result corresponding to the query word according to the sub-query results respectively corresponding to the multiple target keywords.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the information query method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the information query method as claimed in any one of claims 1 to 7.
Citation Information
Cited By
Periodical keyword determination method and device, medium and product
CN120407817A
Internet information service method and system based on cloud computing
CN120434270A