Document query method and device, electronic equipment and readable storage medium
By combining the intent weight and statistical weight of word segmentation in the query terms, the recommended score of candidate documents is determined, which solves the problem of low document query accuracy in existing technologies and achieves higher query accuracy.
Patent Information
- Application Number
- CN202111393697.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-11-23
AI Technical Summary
Existing technologies recommend documents based solely on word segmentation statistics of the query terms, resulting in low accuracy.
By combining the intent weight and statistical weight of word segmentation in the query terms, the recommended score of the candidate documents is determined, and the target document is selected as the query result.
It improves the accuracy of document retrieval by combining the intent weight and statistical weight of word segmentation to reflect the query intent and improve the accuracy of the recommended scores of candidate documents.
Smart Images

Figure CN114328855B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, in particular to the technical field of artificial intelligence such as natural language processing, knowledge graph, and deep learning. A document query method and device, an electronic device, and a readable storage medium are provided. BACKGROUND
[0002] In the prior art, when a document is queried according to a query word, only the document used for recommendation is determined according to the statistical result of each word in the query word in the document. Since the statistical result of the word in the document can only reflect limited recommendation information, the accuracy of the document queried by the prior art is low. SUMMARY
[0003] According to a first aspect of the present disclosure, a document query method is provided, including: obtaining a query word, and splitting the query word to obtain at least one word; obtaining an intention weight of the at least one word according to the query word; obtaining a plurality of candidate documents according to the at least one word, and obtaining a statistical weight corresponding to each candidate document of the at least one word; determining a recommendation score of each candidate document according to the intention weight of the at least one word and the statistical weight corresponding to each candidate document of the at least one word; selecting at least one target document from the plurality of candidate documents according to the recommendation score, and taking the at least one target document as a document query result of the query word.
[0004] According to a second aspect of the present disclosure, a document query device is provided, including: an obtaining unit configured to obtain a query word, and split the query word to obtain at least one word; a first processing unit configured to obtain an intention weight of the at least one word according to the query word; a second processing unit configured to obtain a plurality of candidate documents according to the at least one word, and obtain a statistical weight corresponding to each candidate document of the at least one word; a determining unit configured to determine a recommendation score of each candidate document according to the intention weight of the at least one word and the statistical weight corresponding to each candidate document of the at least one word; and a recommendation unit configured to select at least one target document from the plurality of candidate documents according to the recommendation score, and take the at least one target document as a document query result of the query word.
[0005] According to a third aspect of the present disclosure, an electronic device is provided, including: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.
[0006] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform the method as described above.
[0007] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method as described above.
[0008] From the above technical solutions, it can be seen that the present disclosure can improve the accuracy of document query by combining the statistical weight and the intention weight of the segmented words in the query word.
[0009] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0010] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:
[0011] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure;
[0012] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure;
[0013] Figure 3 is a block diagram of an electronic device for implementing the document query method of the embodiments of the present disclosure. DETAILED DESCRIPTION
[0014] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and mechanisms.
[0015] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. As Figure 1 shown, the document query method of the present embodiment specifically includes the following steps:
[0016] S101, acquiring a query word and segmenting the query word to obtain at least one segmented word;
[0017] S102, acquiring an intention weight of the at least one segmented word according to the query word;
[0018] S103, obtaining a plurality of candidate documents according to the at least one segmented word, and obtaining a statistical weight corresponding to each candidate document of the at least one segmented word;
[0019] S104, determining a recommendation score of each candidate document according to the intention weight of the at least one segmented word and the statistical weight corresponding to each candidate document of the at least one segmented word;
[0020] S105, selecting at least one target document from the plurality of candidate documents according to the recommendation score, and taking the at least one target document as a document query result of the query word.
[0021] The document query method of the embodiment, after segmenting the query word to obtain at least one segmented word, first obtains an intention weight of the at least one segmented word and a statistical weight corresponding to each candidate document of the at least one segmented word, then determines a recommendation score of each candidate document according to the intention weight and the statistical weight of the at least one segmented word, and finally selects at least one target document according to the recommendation score of each candidate document, and takes the at least one target document as a document query result of the query word. The embodiment combines the statistical weight and the intention weight of the segmented word in the query word to perform document query, which can improve the accuracy of document query.
[0022] When performing S101 to obtain a query word, the embodiment can take a text input in real time by an input end as the query word, or take a text selected by the input end on a network as the query word.
[0023] After performing S101 to obtain a query word, the embodiment segments the obtained query word to obtain at least one segmented word contained in the query word. The embodiment uses the prior art to segment the query word to obtain the segmented word, and the specific process is not described here.
[0024] After performing S101 to segment the obtained query word to obtain at least one segmented word, the embodiment performs a step of obtaining an intention weight of the at least one segmented word and a step of obtaining a statistical weight corresponding to each candidate document of the at least one segmented word.
[0025] The intention weight obtained by the embodiment is used to represent the correlation degree between the query intention of the query word and different segmented words in the query word. The greater the intention weight of the segmented word, the more relevant the query intention of the query word to the segmented word, and vice versa. The smaller the intention weight of the segmented word, the less relevant the query intention of the query word to the segmented word.
[0026] The statistical weight obtained by the embodiment is used to represent the statistical result of different segmented words in the query word corresponding to different candidate documents. The statistical result of the segmented word corresponding to the candidate document can be the number of occurrences of the segmented word in the candidate document, the inverse document frequency of the segmented word corresponding to the candidate document, etc.
[0027] The embodiment does not limit the order of obtaining the intention weight and the statistical weight of the at least one word segment, and can be executed simultaneously or sequentially. In the following, the intention weight of the at least one word segment is obtained first, and then the statistical weight of the at least one word segment is obtained as an example for description.
[0028] Specifically, when the intention weight of the at least one word segment is obtained according to the query word in S102, the optional implementation manner that can be adopted by the embodiment is as follows: the query word is input into an intention weight obtaining model, which is obtained by pre-training in the embodiment; and the output result output by the intention weight obtaining model for the at least one word segment in the input query word is taken as the intention weight of the at least one word segment.
[0029] That is, the intention weight of different word segments in the query word can be obtained by the intention weight obtaining model obtained by pre-training in the embodiment. Since the intention weight obtaining model can calculate the intention weight of each word segment obtained after cutting the input query word, the accuracy of the embodiment in obtaining the intention weight of the word segment can be improved.
[0030] In the embodiment, the intention weight obtaining model used in S102 can be obtained by training in the following manner: training data is obtained, the training data obtained contains a plurality of sample query words and the intention weight annotation result of at least one word segment in the plurality of sample query words, the intention weight annotation result of the word segment is used to represent the real correlation degree between the query intention of the sample query word and the word segment; the plurality of sample query words are input into a neural network model respectively to obtain the intention weight prediction result output by the neural network model for at least one word segment in each sample query word, the intention weight prediction result of the word segment is used to represent the predicted correlation degree between the query intention of the sample query word and the word segment; the loss function value is calculated according to the intention weight annotation result and the intention weight prediction result of the at least one word segment; the parameters of the neural network model are adjusted using the calculated loss function value until the neural network model converges, and the intention weight obtaining model is obtained.
[0031] In addition, when the intention weight of the at least one word segment is obtained according to the query word in S102, the following manner can also be used: the semantic information of the query word and the semantic information of the at least one word segment are obtained; for each word segment, the similarity between the semantic information of the word segment and the semantic information of the query word is calculated; and the calculated similarity is taken as the intention weight of the at least one word segment.
[0032] That is, the intention weight of each word segment can also be obtained according to the similarity between the semantic information of the query word as a whole and the semantic information of each word segment in the embodiment, so that the steps of the embodiment in obtaining the intention weight of the word segment are simplified.
[0033] After the implementation of S102 obtains the intention weight of at least one word segmentation, the embodiment performs S103 to obtain a plurality of candidate documents according to the at least one word segmentation, and obtains the statistical weight of the at least one word segmentation corresponding to each candidate document.
[0034] When the implementation of S103 obtains a plurality of candidate documents according to the at least one word segmentation, an optional implementation manner that can be adopted by the embodiment is: determining a document list corresponding to the at least one word segmentation according to the correspondence between the word and the document list, the correspondence between the word and the document list in the embodiment being pre-generated; and taking the document contained in the determined document list as the plurality of candidate documents.
[0035] When the implementation of S103 obtains the statistical weight of the at least one word segmentation corresponding to each candidate document, the embodiment can take the statistical result of a preset type of the word segmentation in different candidate documents as the statistical weight of the word segmentation corresponding to each candidate document.
[0036] For example, the embodiment can take the number of occurrences of the word segmentation in each candidate document as the statistical weight of the word segmentation corresponding to each candidate document; and the embodiment can also take the inverse document frequency of the word segmentation corresponding to the candidate document as the statistical weight of the word segmentation corresponding to each candidate document.
[0037] After the implementation of S103 obtains the statistical weight of the at least one word segmentation corresponding to each candidate document, the embodiment performs S104 to determine the recommended score of each candidate document according to the intention weight of the at least one word segmentation and the statistical weight of the at least one word segmentation corresponding to each candidate document.
[0038] Specifically, when the implementation of S104 determines the recommended score of each candidate document according to the intention weight of the at least one word segmentation and the statistical weight of the at least one word segmentation corresponding to each candidate document, an optional implementation manner that can be adopted by the embodiment is: for each candidate document, obtaining the maximum weight of each word segmentation corresponding to the candidate document according to the statistical weight of each word segmentation corresponding to the candidate document and the intention weight of each word segmentation, for example, taking the product between the statistical weight and the intention weight of the word segmentation as the maximum weight of the word segmentation; and determining the recommended score of the candidate document according to the maximum weight of all word segmentations contained in the query.
[0039] That is, the embodiment determines the recommended score of each candidate document by combining the statistical weight and the intention weight of each word segmentation, and since the intention weight of the word segmentation can reflect the query intention corresponding to the word segmentation, the recommended score determined by the embodiment also contains the information of the query intention, thereby improving the accuracy of the determined recommended score.
[0040] For example, if the segmented query word obtains segment 1 and segment 2, if the candidate documents obtained according to segment 1 and segment 2 are candidate document 1, candidate document 2 and candidate document 3, if the statistical weight of segment 1 corresponding to candidate document 1 is weight 1, the statistical weight of segment 2 corresponding to candidate document 1 is weight 2, if the intention weight of segment 1 is weight 3, and the intention weight of segment 2 is weight 4, the embodiment obtains the maximum weight 1 of segment 1 corresponding to candidate document 1 according to weight 1 and weight 3, obtains the maximum weight 2 of segment 2 corresponding to candidate document 1 according to weight 2 and weight 4, and then determines the recommendation score of candidate document 1 according to the maximum weight 1 of segment 1 and the maximum weight 2 of segment 2.
[0041] In the embodiment, when the maximum weight of each segment is determined according to the query word, the cumulative result of the maximum weight of each segment can be directly used as the recommendation score of the candidate document.
[0042] To further improve the accuracy of determining the recommendation score of the candidate document, when the recommendation score of the candidate document is determined according to the maximum weight of all segments contained in the query word, the optional implementation manner of the embodiment can be: obtaining the document coefficient of the candidate document according to the number of document words of the candidate document, for example, using the ratio between the number of document words of the candidate document and the average number of words as the document coefficient; determining the recommendation score of the candidate document according to the maximum weight of all segments contained in the query word and the obtained document coefficient.
[0043] Specifically, when S103 is performed, the recommendation score of the candidate document can be determined by the following calculation formula:
[0044]
[0045] In the formula, Score(doc) represents the recommendation score of the candidate document; n represents that there are n segments in the query word; Weight(term i ) final Weight(term
[0046] In addition, when S103 is performed, the maximum weight of each segment can be obtained by the following calculation formula:
[0047] Weight(term final = Weight(term origin × Weight(term intent
[0048] In the formula, Weight(term finalWeight(term) represents the maximum weight of the term. origin Weight(term) represents the statistical weight of the term corresponding to a certain candidate document. intent Weight(term) represents the intention weight of the term.
[0049] After the embodiment determines the recommendation score of each candidate document in S104, it selects at least one target document from the plurality of candidate documents according to the recommendation score in S105, and takes the selected at least one target document as the document query result of the query word.
[0050] In the embodiment, when at least one target document is selected from the plurality of candidate documents according to the recommendation score in S105, the candidate documents can be sorted in descending order of the recommendation score, and the candidate documents ranked in the top N positions are taken as the target documents, where N is a positive integer greater than or equal to 1.
[0051] After the embodiment obtains the document query result of the query word in S105, it can return the selected at least one target document to the input end for the input end to view, download, etc. the returned target document.
[0052] Figure 2 is a schematic diagram according to the second embodiment of the disclosure. As shown in Figure 2 the document query device 200 of the embodiment includes:
[0053] The acquisition unit 201 is configured to acquire a query word and split the query word to obtain at least one term.
[0054] The first processing unit 202 is configured to acquire the intention weight of the at least one term according to the query word.
[0055] The second processing unit 203 is configured to obtain a plurality of candidate documents according to the at least one term, and acquire the statistical weight of the at least one term corresponding to each candidate document.
[0056] The determination unit 204 is configured to determine the recommendation score of each candidate document according to the intention weight of the at least one term and the statistical weight of the at least one term corresponding to each candidate document.
[0057] The recommendation unit 205 is configured to select at least one target document from the plurality of candidate documents according to the recommendation score, and take the at least one target document as the document query result of the query word.
[0058] When acquiring the query word (query), the acquisition unit 201 can take the text input by the input end in real time as the query word, or take the text selected by the input end on the network as the query word.
[0059] The acquisition unit 201, after acquiring the query word, splits the acquired query word to obtain at least one wordpiece contained in the query word; the acquisition unit 201 splits the query word to obtain the wordpiece using the prior art, and the specific process is not described here.
[0060] After the acquisition unit 201 splits the acquired query word to obtain at least one wordpiece, the first processing unit 202 is used to acquire the intention weight of the at least one wordpiece, and the second processing unit 203 is used to acquire the statistical weight of the at least one wordpiece corresponding to each candidate document.
[0061] The execution order of the first processing unit 202 and the second processing unit 203 is not limited in this embodiment, and they can be executed simultaneously or sequentially; in the following, the first processing unit 202 is used to acquire the intention weight of the at least one wordpiece, and then the second processing unit 203 is used to acquire the statistical weight of the at least one wordpiece is taken as an example to describe.
[0062] Specifically, when the first processing unit 202 acquires the intention weight of the at least one wordpiece according to the query word, an optional implementation manner that can be adopted is: inputting the query word into an intention weight acquisition model; taking the output result output by the intention weight acquisition model for the at least one wordpiece in the input query word as the intention weight of the at least one wordpiece.
[0063] That is, the first processing unit 202 can acquire the intention weight of different wordpieces in the query word through the intention weight acquisition model obtained by pre-training, and since the intention weight acquisition model can calculate the intention weight of each wordpiece obtained after splitting the input query word, the accuracy of this embodiment in acquiring the intention weight of the wordpiece can be improved.
[0064] The intention weight acquisition model used by the first processing unit 202 can be obtained by training in the following manner: acquiring training data, the acquired training data containing a plurality of sample query words and intention weight annotation results of at least one wordpiece in the plurality of sample query words; inputting the plurality of sample query words into a neural network model to obtain intention weight prediction results output by the neural network model for the at least one wordpiece in each sample query word; calculating a loss function value according to the intention weight annotation results and the intention weight prediction results of the at least one wordpiece; adjusting the parameters of the neural network model using the calculated loss function value until the neural network model converges to obtain the intention weight acquisition model.
[0065] In addition, the first processing unit 202 can also use the following method to obtain the intention weight of the at least one segmented word according to the query word: obtaining semantic information of the query word and semantic information of the at least one segmented word; calculating, for each segmented word, a similarity between the semantic information of the segmented word and the semantic information of the query word; and taking the calculated similarity as the intention weight of the at least one segmented word.
[0066] That is, the first processing unit 202 can also obtain the intention weight of each segmented word according to the similarity between the semantic information of the query word as a whole and the semantic information of each segmented word, thereby simplifying the step of obtaining the intention weight of the segmented word in the embodiment.
[0067] After the first processing unit 202 obtains the intention weight of the at least one segmented word, the second processing unit 203 obtains a plurality of candidate documents according to the at least one segmented word and obtains a statistical weight corresponding to each candidate document for the at least one segmented word.
[0068] When the second processing unit 203 obtains the plurality of candidate documents according to the at least one segmented word, an optional implementation manner that can be used is: determining a document list corresponding to the at least one segmented word according to the correspondence between the words and the document list; and taking the documents contained in the determined document list as the plurality of candidate documents.
[0069] When the second processing unit 203 obtains the statistical weight corresponding to each candidate document for the at least one segmented word, the second processing unit 203 can take, for each segmented word, a statistical result of a preset type of the segmented word in different candidate documents as the statistical weight corresponding to each candidate document for the segmented word.
[0070] After the second processing unit 203 obtains the statistical weight corresponding to each candidate document for the at least one segmented word, the determining unit 204 determines a recommendation score of each candidate document according to the intention weight of the at least one segmented word and the statistical weight corresponding to each candidate document for the at least one segmented word.
[0071] Specifically, when the determining unit 204 determines the recommendation score of each candidate document according to the intention weight of the at least one segmented word and the statistical weight corresponding to each candidate document for the at least one segmented word, an optional implementation manner that can be used is: for each candidate document, obtaining a maximum weight corresponding to the candidate document for each segmented word according to the statistical weight corresponding to the candidate document for each segmented word and the intention weight of each segmented word; and determining the recommendation score of the candidate document according to the maximum weight of all the segmented words contained in the query word.
[0072] That is, the determining unit 204 determines the recommended score of each candidate document by combining the statistical weight and the intention weight of each word segmentation, and since the intention weight of the word segmentation can reflect the query intention corresponding to the word segmentation, the recommended score determined by the determining unit 204 also contains the information of the query intention, thereby improving the accuracy of the determined recommended score.
[0073] In the implementation, the determining unit 204 can directly use the cumulative result of the maximum weights of the word segmentations as the recommended score of the candidate document when determining the recommended score of the candidate document according to the maximum weights of the word segmentations contained in the query words.
[0074] To further improve the accuracy in determining the recommended score of the candidate document, the determining unit 204 can use the following optional implementation when determining the recommended score of the candidate document according to the maximum weights of all the word segmentations contained in the query words: obtaining a document coefficient of the candidate document according to the number of words in the document; and determining the recommended score of the candidate document according to the maximum weights of all the word segmentations contained in the query words and the obtained document coefficient.
[0075] After the determining unit 204 determines the recommended score of each candidate document, the recommending unit 205 selects at least one target document from the plurality of candidate documents according to the recommended score, and takes the selected at least one target document as the document query result of the query words.
[0076] In the implementation, the recommending unit 205 can sort the candidate documents in descending order of the recommended score, and take the candidate documents ranked in the top N positions as the target documents, where N is a positive integer greater than or equal to 1.
[0077] After obtaining the document query result of the query words, the recommending unit 205 can return the selected at least one target document to the input end, so that the input end can view, download, or perform other operations on the returned target document.
[0078] In the technical solution of the present disclosure, the acquisition, storage and application of the user personal information comply with the relevant laws and regulations and do not violate public order and good customs.
[0079] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.
[0080] As Figure 3The diagram shown is a block diagram of an electronic device for a document retrieval method according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0081] like Figure 3 As shown, device 300 includes a computing unit 301, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 302 or a computer program loaded from storage unit 308 into random access memory (RAM) 303. RAM 303 may also store various programs and data required for the operation of device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via bus 304. Input / output (I / O) interface 305 is also connected to bus 304.
[0082] Multiple components in device 300 are connected to I / O interface 305, including: input unit 306, such as keyboard, mouse, etc.; output unit 307, such as various types of monitors, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0083] The computing unit 301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as document query methods. For example, in some embodiments, the document query method may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as storage unit 308.
[0084] In some embodiments, portions or all of the computer program can be loaded onto the apparatus 300 via the ROM 302 and / or the communications unit 309. When the computer program is loaded onto the RAM 303 and executed by the computer unit 301, one or more steps of the document query method described above can be performed. Alternatively, in other embodiments, the computer unit 301 can be configured, by any suitable means (for example, by means of firmware), to perform the document query method.
[0085] Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, specially designed application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0086] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, special purpose computer, or other programmable document query device to produce a machine, such that the program code, when executed by the processor or controller, causes the machine to perform the functions / acts specified in the flowcharts and / or block diagrams. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0087] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0088] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0089] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0090] The computer system can include clients and servers. This relationship can be. The servers are typically remote from the clients with the interactions typically occurring over the network. The relationship between client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are a host product in the cloud computing service system to solve the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS"). The servers can also be servers of a distributed system, or servers combined with a blockchain.
[0091] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, the steps described in the present disclosure can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.
[0092] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A document retrieval method, comprising: Obtain the query term and segment the query term to obtain at least one word; Based on the query term, obtain the intent weight of the at least one word segmentation; Multiple candidate documents are obtained based on the at least one word segmentation, and the statistical weight of the at least one word segmentation corresponding to each candidate document is obtained; The recommended score for each candidate document is determined based on the intent weight of the at least one word segment and the statistical weight of the at least one word segment corresponding to each candidate document. Based on the recommended score, at least one target document is selected from the plurality of candidate documents, and the at least one target document is used as the document query result of the query term; The step of obtaining the statistical weights of the at least one word segmentation corresponding to each candidate document includes: For each word segment, the number of times the word appears in different candidate documents is obtained, which is used as the statistical weight of the word for each candidate document; The step of determining the recommendation score for each candidate document based on the intent weight of the at least one word segment and the statistical weight of the at least one word segment corresponding to each candidate document includes: For each candidate document, the final weight of each word corresponding to the candidate document is obtained based on the statistical weight of each word corresponding to the candidate document and the intent weight of each word. Based on the number of words in the candidate document, the document coefficient of the candidate document is obtained, wherein the document coefficient is the ratio between the number of words in the candidate document and the average number of words; The recommended score for the candidate document is determined based on the final weights of all word segments contained in the query term and the document coefficient.
2. The method according to claim 1, wherein, The step of obtaining the intent weight of the at least one word segment based on the query term includes: Input the query terms into the intent weight to obtain the model; The intent weight is the output of the intent weight acquisition model for at least one segment of the input query term, and is used as the intent weight of the at least one segment.
3. The method according to claim 1, wherein, The step of obtaining the intent weight of the at least one word segment based on the query term includes: Obtain the semantic information of the query term and the semantic information of the at least one word segmentation; For each word segment, calculate the similarity between the semantic information of the word segment and the semantic information of the query word; The calculated similarity is used as the intent weight of the at least one word segmentation.
4. The method according to any one of claims 1-3, wherein, The step of obtaining multiple candidate documents based on the at least one word segmentation includes: Based on the correspondence between words and document lists, determine the document list corresponding to the at least one word segmentation; The documents included in the document list are used as the plurality of candidate documents.
5. A document retrieval device, comprising: The acquisition unit is used to acquire query terms and segment the query terms to obtain at least one word segment; The first processing unit is configured to obtain the intent weight of the at least one word segment based on the query term; The second processing unit is used to obtain multiple candidate documents based on the at least one word segmentation, and to obtain the statistical weight of the at least one word segmentation corresponding to each candidate document; The determining unit is configured to determine the recommendation score of each candidate document based on the intent weight of the at least one word segment and the statistical weight of the at least one word segment corresponding to each candidate document. The recommendation unit is used to select at least one target document from the plurality of candidate documents based on the recommendation score, and to use the at least one target document as the document query result of the query term; Specifically, when the second processing unit obtains the statistical weights of the at least one word segment corresponding to each candidate document, it performs the following: For each word segment, the number of times the word appears in different candidate documents is obtained, which is used as the statistical weight of the word for each candidate document; When determining the recommendation score for each candidate document based on the intent weight of the at least one word and the statistical weight of the at least one word corresponding to each candidate document, the determining unit specifically performs the following: For each candidate document, the final weight of each word corresponding to the candidate document is obtained based on the statistical weight of each word corresponding to the candidate document and the intent weight of each word. Based on the number of words in the candidate document, the document coefficient of the candidate document is obtained, wherein the document coefficient is the ratio between the number of words in the candidate document and the average number of words; The recommended score for the candidate document is determined based on the final weights of all word segments contained in the query term and the document coefficient.
6. The apparatus according to claim 5, wherein, When the first processing unit obtains the intent weight of the at least one word segment based on the query term, it specifically performs the following: Input the query terms into the intent weight to obtain the model; The intent weight is the output of the intent weight acquisition model for at least one segment of the input query term, and is used as the intent weight of the at least one segment.
7. The apparatus according to claim 5, wherein, When the first processing unit obtains the intent weight of the at least one word segment based on the query term, it specifically performs the following: Obtain the semantic information of the query term and the semantic information of the at least one word segmentation; For each word segment, calculate the similarity between the semantic information of the word segment and the semantic information of the query word; The calculated similarity is used as the intent weight of the at least one word segmentation.
8. The apparatus according to any one of claims 5-7, wherein, When the second processing unit obtains multiple candidate documents based on the at least one word segmentation, it specifically performs the following: Based on the correspondence between words and document lists, determine the document list corresponding to the at least one word segmentation; The documents included in the document list are used as the plurality of candidate documents.
9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.
11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-4.
Citation Information
Patent Citations
Query intention determination method and device, search method and search engine
CN111324805A
Information retrieval method and system oriented to user-defined user intention model
CN113505290A