Textual recall methods, apparatuses, computing devices, and machine-readable storage media
By determining the number of keywords based on the target text length and keyword order in the text recall method, and combining vector mapping and corpus database similarity ranking, the problem of inaccurate text recall results is solved, achieving high accuracy and high efficiency in text recall.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING TOPSEC NETWORK SECURITY TECH
- Filing Date
- 2023-12-20
- Publication Date
- 2026-06-05
Smart Images

Figure CN117786045B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically to a text retrieval method, apparatus, computing device, and machine-readable storage medium. Background Technology
[0002] With the rapid development of information technology, text retrieval can quickly and accurately find the data that users need from massive amounts of text data. Specifically, when a user provides initial input text, key information such as keywords and key phrases are extracted from the initial input text. Based on the extracted key information, text data in the database is matched and retrieved to obtain the data that the user needs as the text retrieval result.
[0003] In real-world text retrieval scenarios, different keywords have varying degrees of importance within an input text. However, text retrieval often treats all obtained key information as equally important for analysis, leading to inaccurate results. Furthermore, the large amount of key information extracted from the input text can result in the mistaken extraction and analysis of less important information, further complicating the analysis of key information in the input text and leading to inaccurate text retrieval results. Summary of the Invention
[0004] The purpose of this invention is to provide a text recall method, apparatus, computing device, and machine-readable storage medium. The text recall method is used to solve the problem of inaccurate text recall results.
[0005] To achieve the above objectives, firstly, this application provides a text recall method, which includes:
[0006] Based on the target text and its length, a first number of keywords is determined, wherein the first number is positively correlated with the length of the target text.
[0007] Based on the order in which each keyword appears in the target text, the first number of keywords are combined to obtain the key text;
[0008] Vectorize the keywords and key texts separately to obtain keyword vectors and key text vectors;
[0009] The key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text;
[0010] Vector recall is performed on the target text based on vector mapping to generate text recall results for the target text.
[0011] In the embodiments of this application, vector retrieval of target text is performed based on vector mapping to generate text retrieval results for the target text, including:
[0012] Obtain the vector and text length of each corpus in the corpus database;
[0013] Based on the text length of each corpus, the text length of the target text, the vector of each corpus, and the vector mapping, the similarity between the target text and each corpus in the corpus database is determined.
[0014] All similarities are sorted, and the corpus corresponding to the second largest similarity is determined as the text recall result.
[0015] In embodiments of this application, the text recall method further includes:
[0016] Based on the knowledge set of the target knowledge domain, multiple corpora to be stored are identified;
[0017] Each corpus to be stored is vectorized and normalized to obtain a normalized corpus vector for each corpus.
[0018] Update the corpus database based on all normalized corpus vectors.
[0019] In the embodiments of this application, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text, including:
[0020] The weight of each keyword is determined based on the order in which each keyword appears in the target text, and the weight of a keyword is positively correlated with the order in which it appears in the target text.
[0021] Based on the weight of each keyword, a weighted sum of all keyword vectors is obtained to get the keyword vector sum;
[0022] The vector mapping corresponding to the target text is obtained by weighted summation of the key text vector and the keyword vector.
[0023] In embodiments of this application, the text recall method further includes:
[0024] Obtain the initial text and the stop word set, wherein the stop word set includes at least one stop word;
[0025] Remove stop words from the initial text to obtain the target text.
[0026] In embodiments of this application, the text recall method further includes:
[0027] The initial text and text recall results are input into a preset model, and the preset model is updated. The preset model is used to generate text recall results corresponding to the input text.
[0028] In the embodiments of this application, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text, including:
[0029] Normalize the keyword vector and the key text vector respectively to obtain normalized keyword vector and normalized key text vector;
[0030] The normalized key text vector is weighted and summed with all the normalized keyword vectors to obtain the vector mapping corresponding to the target text.
[0031] Secondly, this application provides a text recall device, which includes:
[0032] The keyword determination module is used to determine a first number of keywords based on the target text and the length of the target text, wherein the first number is positively correlated with the length of the target text;
[0033] The text acquisition module is used to combine a first number of keywords based on the order in which each keyword appears in the target text to obtain the key text;
[0034] The vectorization module is used to vectorize keywords to obtain keyword vectors and to vectorize key text to obtain key text vectors.
[0035] The vector summation module is used to perform a weighted summation of the key text vector and all keyword vectors to obtain the vector mapping corresponding to the target text;
[0036] The result acquisition module is used to perform vector recall on the target text based on the vector mapping and generate the text recall results of the target text.
[0037] Thirdly, this application provides a computing device, comprising:
[0038] The memory is configured to store instructions; and
[0039] The processor is configured to retrieve instructions from memory and, when executing instructions, to implement the text recall method described above.
[0040] Fourthly, this application provides a machine-readable storage medium storing instructions that cause a machine to execute the text recall method described above.
[0041] This application provides a text recall method, which includes: determining a first number of keywords based on the target text and its length; combining the first number of keywords according to their order of appearance in the target text to obtain key text; vectorizing the keywords and key text to obtain keyword vectors and key text vectors respectively; performing a weighted summation of the key text vectors and all keyword vectors to obtain a vector mapping corresponding to the target text; and performing vector recall on the target text based on the vector mapping to generate text recall results for the target text. By limiting the number of keywords and determining the vector mapping corresponding to the target text based on the importance of each keyword, text recall using vector mapping can achieve highly accurate text recall results. Furthermore, by limiting the number of keywords, text recall results can be quickly obtained from massive amounts of text data, thereby improving the real-time performance of the text recall results. Attached Figure Description
[0042] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0043] Figure 1 A flowchart of a first type of text recall method provided in an embodiment of this application is shown;
[0044] Figure 2 A second flowchart of the text recall method provided in this application embodiment is shown;
[0045] Figure 3 A schematic diagram of the structure of the text recall device provided in an embodiment of this application is shown. Detailed Implementation
[0046] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the scope of the present invention.
[0047] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0048] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0049] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0050] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.
[0051] Example 1
[0052] Please see Figure 1 , Figure 1 A flowchart of a first type of text recall method provided in an embodiment of this application is shown. Figure 1 Text recall methods in the text include:
[0053] S110, Based on the target text and the length of the target text, determine a first number of keywords, wherein the first number is positively correlated with the length of the target text.
[0054] When performing text retrieval on target text, keyword extraction is performed to obtain the keywords in the target text. Too few or too many extracted keywords will affect the text retrieval results. In this embodiment, the number of keywords is determined based on the text length of the target text, thereby determining a first number of keywords. The first number is positively correlated with the text length of the target text, and the first number is:
[0055] N = [log2(L)] Formula (1)
[0056] Where N is the first quantity, i.e. the number of keywords, and L is the length of the target text.
[0057] S120: Based on the order in which each keyword appears in the target text, combine the first number of keywords to obtain the key text.
[0058] The order in which each keyword appears in the target text is determined, as this order often influences text retrieval results. Based on the order of each keyword's appearance in the target text, a first set of keywords is combined to obtain the key text. The key text consists of multiple keywords; analyzing the key text allows for more accurate text retrieval results.
[0059] S130, vectorize the keywords and key texts respectively to obtain keyword vectors and key text vectors.
[0060] Each keyword is vectorized individually to obtain a first set of keyword vectors. Simultaneously, key text is vectorized to obtain key text vectors. By analyzing both keyword and key text vectors, corpus similar to the target text is obtained, leading to text recall results for the target text.
[0061] S140, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text.
[0062] In real-world text retrieval scenarios, multiple keywords obtained may have varying degrees of importance within the target text. Summing all keywords with equal importance as a first set would lead to inaccurate text retrieval results. This embodiment determines the weight of each keyword based on its importance to the target text. Based on each keyword's weight, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text. This vector mapping considers both the importance of each keyword within the target text and the order of the keywords.
[0063] In the embodiments of this application, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text, including:
[0064] The weight of each keyword is determined based on the order in which each keyword appears in the target text, and the weight of a keyword is positively correlated with the order in which it appears in the target text.
[0065] Based on the weight of each keyword, a weighted sum of all keyword vectors is obtained to get the keyword vector sum;
[0066] The vector mapping corresponding to the target text is obtained by weighted summation of the key text vector and the keyword vector.
[0067] The weight of each keyword is determined based on its order of appearance in the target text. For example, the weight of the first keyword appearing in the target text is set to 0.5, the weight of the second keyword to 0.25, and the weight of the third keyword to 0.125. The keyword weight decreases as its order of appearance decreases, ensuring a positive correlation between the keyword weight and its order of appearance. Based on the weight of each keyword, all keyword vectors are weighted and summed to obtain a keyword vector sum that considers both the importance of each keyword in the target text and its order of appearance.
[0068] The weights of key text vectors are determined based on their importance, and the weights of keyword vector sums are determined based on their importance. The weight values for both key text vectors and keyword vector sums are set according to actual needs and are not limited here. For ease of understanding, in the embodiments of this application, the weights of both key text vectors and keyword vector sums are one. The vector mapping corresponding to the target text is obtained by summing the key text vectors and keyword vector sums.
[0069]
[0070] in, Let n be the vector mapping corresponding to the target text, where n is the first quantity. Let n be the vector of the nth keyword in the first number of keywords. This is the key text vector.
[0071] In the embodiments of this application, the key text vector is weighted and summed with all keyword vectors to obtain the vector mapping corresponding to the target text, including:
[0072] Normalize the keyword vector and the key text vector respectively to obtain normalized keyword vector and normalized key text vector;
[0073] The normalized key text vector is weighted and summed with all the normalized keyword vectors to obtain the vector mapping corresponding to the target text.
[0074] Each keyword vector is normalized individually to obtain a first number of normalized keyword vectors. Simultaneously, the key text vectors are normalized to obtain normalized key text vectors. By normalizing both keyword and key text vectors separately, duplicate calls to keywords and key text are avoided during text retrieval.
[0075] S150, Perform vector recall on the target text based on the vector mapping, and generate text recall results for the target text.
[0076] Vector recall is performed on target text based on vector mapping. Specifically, based on the vector mapping corresponding to the target text and the vectors of each corpus in the corpus database, at least one corpus similar to the target text is identified. Based on the identified at least one corpus similar to the target text, text recall results for the target text are generated. By limiting the number of keywords and considering the importance of each keyword, the vector mapping corresponding to the target text is obtained. Text recall using vector mapping can achieve highly accurate text recall results. Furthermore, because the number of keywords is limited, text recall results can be quickly obtained from massive amounts of text data, thus improving the real-time performance of the text recall results.
[0077] In the embodiments of this application, vector retrieval of target text is performed based on vector mapping to generate text retrieval results for the target text, including:
[0078] Obtain the vector and text length of each corpus in the corpus database;
[0079] Based on the text length of each corpus, the text length of the target text, the vector of each corpus, and the vector mapping, the similarity between the target text and each corpus in the corpus database is determined.
[0080] All similarities are sorted, and the corpus corresponding to the second largest similarity is determined as the text recall result.
[0081] Since a corpus is a collection of multiple text resources, when performing text retrieval, it is necessary to obtain at least one corpus that is similar to the target text. The vector and length of each corpus in the database are obtained separately, and the similarity between the target text and the corpus is determined based on the vector mapping corresponding to the target text and the vector of each corpus.
[0082] The similarity between the target text and the length of the corpus text affects the similarity between them. Based on the text length of each corpus text, the text length of the target text, the vector of each corpus text, and the vector mapping, the similarity between the target text and each corpus text in the corpus database is determined. For ease of understanding, the embodiments of this application calculate... and The cosine similarity, where L s L represents the length of the target text. c The length of the corpus text. Let n be the vector mapping corresponding to the target text, where n is the first quantity. Let n be the vector of the nth keyword in the first number of keywords. For key text vectors, is the vector of the corpus.
[0083] All similarities are sorted, and the corpus corresponding to the largest similarity (the second largest number) is determined as the text recall result. The value of the second largest number is set according to actual needs and is not limited here. For ease of understanding, in the embodiment of this application, the second largest number is 3. Assuming that the corpus database includes 5 corpora, the similarity between the target text and each corpus in the corpus database is determined to be 0.2, 0.2, 0.5, 0.5, and 0.8, respectively. The corpus corresponding to one similarity of 0.8 and the corpus corresponding to two similarities of 0.5 are determined as the corpus corresponding to the largest similarity, and the corpus corresponding to the three largest similarities are determined as the text recall result.
[0084] Assuming there are N keywords and M corpora, if the first batch of keywords are identified as having equal importance for text retrieval, the cosine similarity between each keyword and the corpus must be calculated sequentially, resulting in a time complexity of N*M for the text retrieval results. In this embodiment, only the cosine similarity between the vector and its mapping in each corpus needs to be determined; the cosine similarity between each keyword and the corpus is not required, thus reducing the time complexity of the text retrieval results to N+M. This reduction in time complexity decreases the time consumption of text retrieval, thereby improving the real-time performance of the retrieved results.
[0085] In embodiments of this application, the text recall method further includes:
[0086] Based on the knowledge set of the target knowledge domain, multiple corpora to be stored are identified;
[0087] Each corpus to be stored is vectorized and normalized to obtain a normalized corpus vector for each corpus.
[0088] Update the corpus database based on all normalized corpus vectors.
[0089] When retrieving file recall results for target text, a corpus database of the target knowledge domain needs to be pre-constructed. This involves acquiring a knowledge set for the target knowledge domain, which includes professional knowledge corresponding to multiple target knowledge domains (details omitted here). The type of target knowledge domain is set according to actual needs and is not limited here. Based on the knowledge set of the target knowledge domain, the knowledge set is segmented to determine multiple corpora to be stored. Each corpus to be stored is vectorized and normalized to obtain a normalized corpus vector for each corpus. Vectorization and normalization of each corpus to be stored avoids repeated retrieval of corpora during text recall. The corpus database is updated based on all normalized corpus vectors. When retrieving target text from the target knowledge domain, the text recall results are obtained based on the corpus in the target knowledge domain corpus database.
[0090] In embodiments of this application, the text recall method further includes:
[0091] Obtain the initial text and the stop word set, wherein the stop word set includes at least one stop word;
[0092] Remove stop words from the initial text to obtain the target text.
[0093] The process involves obtaining the initial text and a stop word set. This can be done by obtaining a stop word set for each individual initial text or for each knowledge domain; details are omitted here. Each stop word set includes at least one stop word, which is a word that needs to be pre-filtered during text retrieval. Stop words are typically meaningless words; for example, a stop word could be the name of the target knowledge domain in the initial text. Since each corpus in the database belongs to the target knowledge domain, the stop words in the initial text are cleaned to obtain the target text. By cleaning the text of stop words, we prevent stop words from being mistakenly identified as keywords, thus avoiding their impact on text retrieval and achieving highly accurate text retrieval results.
[0094] Please see Figure 2 , Figure 2 A second flowchart of the text recall method provided in the embodiments of this application is shown.
[0095] In embodiments of this application, the text recall method further includes:
[0096] S160, input the initial text and text recall results into the preset model and update the preset model, wherein the preset model is used to generate the text recall results corresponding to the input text.
[0097] The target text is the text after stop word cleaning of the initial text. Vector recall is performed on the target text based on vector mapping to generate the text recall result for the target text, which is the text recall result for the initial text. When performing text recall on user-input text, it is necessary to determine the similarity between the massive corpus and the input text. A pre-set model is used to generate the input text for recognition, generating the corresponding text recall result. The initial text and text recall result are input into the pre-set model for training or backpropagation to adjust the weights and update the pre-set model. When performing text recall on text from different knowledge domains, the text can be directly input into the updated pre-set model, which can output highly accurate and real-time text recall results.
[0098] This application provides a text recall method, which includes: determining a first number of keywords based on the target text and its length; combining the first number of keywords according to their order of appearance in the target text to obtain key text; vectorizing the keywords and key text to obtain keyword vectors and key text vectors respectively; performing a weighted summation of the key text vectors and all keyword vectors to obtain a vector mapping corresponding to the target text; and performing vector recall on the target text based on the vector mapping to generate text recall results for the target text. By limiting the number of keywords and determining the vector mapping corresponding to the target text based on the importance of each keyword, text recall using vector mapping can achieve highly accurate text recall results. Furthermore, by limiting the number of keywords, text recall results can be quickly obtained from massive amounts of text data, thereby improving the real-time performance of the text recall results.
[0099] Example 2
[0100] Please see Figure 3 , Figure 3 A schematic diagram of the structure of the text recall device provided in an embodiment of this application is shown. Figure 3 The text recall device 200 in the middle includes:
[0101] Keyword determination module 210 is used to determine a first number of keywords based on the target text and the text length of the target text, wherein the first number is positively correlated with the text length of the target text;
[0102] The text acquisition module 220 is used to combine a first number of keywords according to the order in which each keyword appears in the target text to obtain the key text;
[0103] The vector generation module 230 is used to vectorize keywords to obtain keyword vectors and to vectorize key text to obtain key text vectors.
[0104] The vector summation module 240 is used to perform a weighted summation of the key text vector and all keyword vectors to obtain the vector mapping corresponding to the target text;
[0105] The resulting module 250 is used to perform vector recall on the target text based on the vector mapping and generate the text recall results of the target text.
[0106] In the embodiments of this application, the result-obtaining module 250 includes:
[0107] The corpus acquisition submodule is used to obtain the vector of each corpus in the corpus database and the text length of each corpus;
[0108] The similarity determination submodule is used to determine the similarity between the target text and each corpus in the corpus database based on the text length of each corpus, the text length of the target text, the vector of each corpus, and the vector mapping.
[0109] The text recall submodule is used to sort all similarities and determine the corpus corresponding to the second largest similarity as the text recall result.
[0110] In embodiments of this application, the text recall device 200 further includes:
[0111] The corpus determination module is used to determine multiple corpora to be stored based on the knowledge set of the target knowledge domain;
[0112] The corpus vectorization module is used to vectorize and normalize each corpus to be stored, respectively, to obtain the normalized corpus vector for each corpus;
[0113] The database update module is used to update the corpus database based on all normalized corpus vectors.
[0114] In embodiments of this application, the vector summation module 240 includes:
[0115] The weight determination submodule is used to determine the weight of each keyword based on the order in which each keyword appears in the target text. The weight of a keyword is positively correlated with the order in which it appears in the target text.
[0116] The keyword summation submodule is used to perform a weighted summation of all keyword vectors based on the weight of each keyword, so as to obtain the keyword vector sum;
[0117] The summation submodule is used to perform a weighted summation of the key text vector and the keyword vector to obtain the vector mapping corresponding to the target text.
[0118] In embodiments of this application, the text recall device 200 further includes:
[0119] The initial text acquisition module is used to acquire the initial text and the stop word set, wherein the stop word set includes at least one stop word;
[0120] The stop word cleaning module is used to clean stop words from the initial text to obtain the target text.
[0121] In embodiments of this application, the text recall device 200 further includes:
[0122] The model update module is used to input the initial text and text recall results into the preset model and update the preset model. The preset model is used to generate the text recall results corresponding to the input text.
[0123] In embodiments of this application, the vector summation module 240 includes:
[0124] The normalization submodule is used to normalize the keyword vector and the key text vector respectively, to obtain normalized keyword vector and normalized key text vector;
[0125] The vector acquisition submodule is used to perform a weighted summation of the normalized key text vector and all normalized keyword vectors to obtain the vector mapping corresponding to the target text.
[0126] The text recall device 200 is used to execute the corresponding steps in the text recall method described above. The specific implementation of each function will not be described in detail here. In addition, the optional examples in Embodiment 1 are also applicable to the text recall device 200 in Embodiment 2.
[0127] This application embodiment also provides a computing device, including:
[0128] The memory is configured to store instructions; and
[0129] The processor is configured to retrieve instructions from memory and, when executing instructions, to implement the text recall method described above.
[0130] In this embodiment, the keyword determination module 210, text acquisition module 220, vector acquisition module 230, vector summation module 240, and result acquisition module 250 are all stored in the memory as program units, and the processor executes the above program units stored in the memory to realize the corresponding functions.
[0131] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; adjusting kernel parameters can address the problem of inaccurate text recall results.
[0132] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0133] This application also provides a machine-readable storage medium storing instructions that cause a machine to execute the text recall method described above.
[0134] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0135] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0136] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0137] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0138] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0139] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0140] Machine-readable storage media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0141] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0142] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A text recall method, characterized in that, The text recall method includes: Based on the target text and its length, a first number of keywords is determined, wherein the first number is positively correlated with the length of the target text. Based on the order in which each keyword appears in the target text, the first number of keywords are combined to obtain the key text; The keywords and key texts are vectorized respectively to obtain keyword vectors and key text vectors; The key text vector is weighted and summed with all the keyword vectors to obtain the vector mapping corresponding to the target text; Based on the vector mapping, vector recall is performed on the target text to generate text recall results for the target text.
2. The text recall method according to claim 1, characterized in that, The step of performing vector recall on the target text based on the vector mapping to generate text recall results for the target text includes: Obtain the vector and text length of each corpus in the corpus database; Based on the text length of each corpus, the text length of the target text, the vector of each corpus, and the vector mapping, the similarity between the target text and each corpus in the corpus database is determined respectively. All the similarities are sorted, and the corpus corresponding to the second largest similarity is determined as the text recall result.
3. The text recall method according to claim 2, characterized in that, The text recall method also includes: Based on the knowledge set of the target knowledge domain, multiple corpora to be stored are identified; Each of the corpora to be stored is vectorized and normalized to obtain a normalized corpus vector for each corpus. The corpus database is updated based on all the normalized corpus vectors.
4. The text recall method according to claim 1, characterized in that, The step of weighted summing of the key text vector with all the keyword vectors to obtain the vector mapping corresponding to the target text includes: The weight of each keyword is determined based on the order in which each keyword appears in the target text, wherein the weight of the keyword is positively correlated with the order in which the keyword appears in the target text; Based on the weight of each keyword, a weighted sum of all keyword vectors is obtained to obtain the keyword vector sum; The vector mapping corresponding to the target text is obtained by weighted summing of the key text vector and the keyword vector.
5. The text recall method according to claim 1, characterized in that, The text recall method also includes: Obtain an initial text and a stop word set, wherein the stop word set includes at least one stop word; The stop words in the initial text are removed to obtain the target text.
6. The text recall method according to claim 5, characterized in that, The text recall method also includes: The initial text and the text recall results are input into a preset model, and the preset model is updated. The preset model is used to generate the text recall results corresponding to the input text.
7. The text recall method according to claim 1, characterized in that, The step of weighted summing of the key text vector with all the keyword vectors to obtain the vector mapping corresponding to the target text includes: The keyword vector and the key text vector are normalized respectively to obtain normalized keyword vector and normalized key text vector; The normalized key text vector is weighted and summed with all the normalized keyword vectors to obtain the vector mapping corresponding to the target text.
8. A text recall device, characterized in that, The text recall device includes: The keyword determination module is used to determine a first number of keywords based on the target text and the text length of the target text, wherein the first number is positively correlated with the text length of the target text; The text acquisition module is used to combine the first number of keywords according to the order in which each keyword appears in the target text to obtain the key text; The vector generation module is used to vectorize the keywords to obtain keyword vectors and to vectorize the key text to obtain key text vectors. The vector summation module is used to perform a weighted summation of the key text vector and all the keyword vectors to obtain the vector mapping corresponding to the target text; The result acquisition module is used to perform vector retrieval of the target text based on the vector mapping and generate the text retrieval result of the target text.
9. A computing device, characterized in that, include: The memory is configured to store instructions; as well as A processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the text retrieval method according to any one of claims 1 to 7.
10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores instructions for causing the machine to perform the text retrieval method according to any one of claims 1 to 7.