Text search method, terminal, and readable storage medium

By obtaining and using the vocabulary to be searched and its associated vocabulary searched in the text library, the problem of not being able to find the target data in traditional methods is solved, and the search efficiency and accuracy are improved.

CN114661852BActive Publication Date: 2024-11-15GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011544265.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-23
Publication Date
2024-11-15
Estimated Expiration
2040-12-23

AI Technical Summary

Technical Problem

Traditional text search methods cannot effectively find the target data in the terminal, especially when the vocabulary to be searched is not in the file name or text, resulting in insufficient search results.

Method used

By obtaining the conjunctions related to the vocabulary to be searched and their semantics and grammar, expand the search scope, use these keywords to search in the text library, including file names and text within the file, and generate missing conjunctions through the word embedding model until it reaches Reservation quantity.

Benefits of technology

It improves the search probability of target data, reduces noise results, and enhances search efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661852B_ABST
    Figure CN114661852B_ABST
Patent Text Reader

Abstract

The present application discloses a text search method, a terminal, and a readable storage medium. The method comprises the steps of obtaining a word to be searched; obtaining associated words that are semantically and / or grammatically related to the word to be searched, wherein the word to be searched and the associated words are keywords of the word to be searched; and using the keywords to search in various texts in a text library and obtaining a text containing at least one keyword. Since the keywords of the word to be searched include associated words that are semantically and / or grammatically related to the word to be searched, by using the keywords of the word to be searched to search in various texts and obtain a text containing at least one keyword, the search range can be expanded and the probability of searching a target text can be increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a text search method, a terminal, and a readable storage medium. Background Art

[0002] As the storage space of terminals continues to expand, more and more data is stored. It is difficult for users to obtain target data from a large amount of data by querying one by one. Since data usually exists in the form of text, it is proposed to filter text containing the searched words in the search bar to push them to users. Here, the target data is obtained by searching the text, thereby increasing the probability of users obtaining the target data from the terminal.

[0003] In a traditional search method, after obtaining a word input by a user, a search is usually performed according to the word to be searched. If the text in the terminal does not contain the word to be searched, the target data cannot be obtained. Summary of the invention

[0004] Based on this, the present application provides a text search method and device, a terminal, and a storage medium, which can increase the probability of searching for target data.

[0005] In a first aspect, a text search method is provided, comprising the following steps:

[0006] Get the words to be searched;

[0007] Acquire associated words that are semantically and / or grammatically related to the word to be searched, wherein the word to be searched and the associated words are both keywords of the word to be searched;

[0008] The keyword is used to search various texts in the text library, and a text containing at least one keyword is obtained.

[0009] In one of the embodiments, the various texts include file names of various files in the terminal, and the step of obtaining various texts in the terminal and searching in various texts using keywords of the words to be searched includes: obtaining various files in the terminal, obtaining file names of various files in the terminal, searching in various file names using keywords of the words to be searched, and obtaining file names containing at least one keyword and corresponding files.

[0010] In one of the embodiments, the various texts include texts in various files in the terminal, and the step of obtaining various texts in the terminal and searching in various texts using keywords of the words to be searched includes: obtaining various files in the terminal, obtaining texts in various files in the terminal, searching in texts in various files using keywords of the words to be searched, and obtaining texts containing at least one keyword and corresponding files.

[0011] In one embodiment, after the step of obtaining the text containing at least one keyword, the following steps are included:

[0012] The text containing at least one keyword is displayed on a display interface, and the keywords that appear are marked.

[0013] In one embodiment, the step of creating a matrix table is also included:

[0014] Acquire an initial matrix table constructed for a specific word; each specific word and its associated words in the initial matrix table have a paired mapping relationship, and the associated words corresponding to the specific word lacking an associated word are empty;

[0015] Counting the number of specific words with associated words in the matrix table;

[0016] When the number is less than a predetermined number, for a specific word in the matrix table that lacks associated words, the word embedding model is used to obtain its corresponding associated words, and the obtained associated words are written into the matrix table until the number of the specific words with associated words reaches the predetermined number;

[0017] The step of obtaining associated words that are semantically and / or grammatically related to the words to be searched includes:

[0018] According to the to-be-searched word, its associated words are obtained from the matrix table.

[0019] In one embodiment, the step of creating the matrix table is performed offline.

[0020] In one embodiment, the step of obtaining associated words of each specific word by using the word embedding model includes:

[0021] Get the corpus;

[0022] Searching for locations where each specific word appears in each document in the corpus, and obtaining context words within a preset window of the specific word at each location;

[0023] The weight of each context word is determined, and the context words with weights greater than the preset weights are output as associated words that are semantically / grammatically related to the specific word.

[0024] In one embodiment, it also includes:

[0025] Obtain documents from at least two terminals;

[0026] Searching for the position of a specific word from each document, and obtaining context words in each different test window of the specific word at each position for different test windows;

[0027] Determine the weight of each context word of each specific word in different test windows, and output the context words with weights greater than the preset weights as associated words that are semantically / grammatically related to the specific words;

[0028] The number of associated words of each specific word in different test windows and the degree of association between each associated word and the specific word in different test windows are compared, and the test window with a degree of association higher than a preset threshold and / or a number of associated words higher than a preset number is used as the preset window.

[0029] In one embodiment, the step of searching each text in the text library using the keyword includes:

[0030] When no text is found using the searched words, the number of searched texts is less than a preset number, or it is detected that the text found using the searched words does not belong to the target text, the associated words are used to search each text in the text library.

[0031] In a second aspect, a terminal is proposed, characterized in that the terminal includes a memory and a processor, wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the method described in any of the above embodiments are implemented.

[0032] In a third aspect, a readable storage medium is proposed, characterized in that a computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0033] The above-mentioned text search method, terminal, and readable storage medium obtain related words that are semantically and / or grammatically related to the word to be searched, and then because the keywords of the word to be searched include the word to be searched and its related words, each keyword of the word to be searched is used to search in each text to obtain a text containing at least one keyword, which can expand the search scope and increase the probability of obtaining target data. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0035] Figure 1 This is a schematic diagram of the structure of a terminal in one embodiment of the present application;

[0036] Figure 2 A flowchart of a text search method according to an embodiment of the present application;

[0037] Figure 3 This is a schematic diagram of the effect of a text search method in a specific embodiment of the present application;

[0038] Figure 4 This is a schematic diagram of the effect of locating the associated paragraph in a specific embodiment of the present application;

[0039] Figure 5 This is a schematic diagram of the effect of a text search method in another specific embodiment of the present application;

[0040] Figure 6 A schematic diagram showing the effect of marking keywords in a file name in one embodiment of the present application;

[0041] Figure 7 This is a schematic diagram showing the effect of displaying keywords in a sentence in a tag file in another embodiment of the present application;

[0042] Figure 8 A schematic diagram of using a word embedding model to train context words in a specific embodiment of the present application;

[0043] Fig. 9 It is a schematic diagram of the structure of a search device in one embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application are clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application. In the absence of conflict, the following embodiments and their technical features can be combined with each other.

[0045] See also Figure 1, which is a schematic diagram of the internal structure of a terminal in an embodiment of the present application. The terminal includes a processor, a memory and a network interface connected by a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire terminal. The memory is used to store data, programs, etc., and at least one computer program is stored on the memory, and the computer program can be executed by the processor to implement the text search method applicable to the terminal provided in the embodiment of the present application. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a text search method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium. The network interface can be an Ethernet card or a wireless network card, etc., for communicating with an external terminal.

[0046] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0047] The terminals described in the present application may include mobile terminals such as mobile phones, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as fixed terminals such as digital TVs and desktop computers.

[0048] The following description will be made by taking a mobile terminal as an example, and those skilled in the art will understand that, in addition to components specifically used for mobile purposes, the construction according to the embodiments of the present application can also be applied to fixed-type terminals.

[0049] In the related art, after obtaining the words input by the user, a search is usually performed according to the words to be searched. If the texts in the terminal do not contain the words to be searched, the target data cannot be searched.

[0050] The embodiment of the present application proposes a text search method that can increase the probability of searching for target data. The target data can be a target file, a target sentence, etc., such as a sentence or a paragraph in a document, an instant message, etc. When the text search method in the embodiment of the present application is used to obtain data buffered or stored in a terminal, it can be executed in an offline manner. The text search method of the present application is described below using a smart phone as an example.

[0051] See also Figure 2, which is a flowchart of a text search method according to an embodiment of the present application, the text search method comprises the following steps:

[0052] Step 202, obtaining the words to be searched;

[0053] Step 204, obtaining associated words that are semantically and / or grammatically related to the word to be searched, and using the word to be searched and the associated words as keywords of the word to be searched;

[0054] Step 206: Use the keyword to search each text in the text library, and obtain text containing at least one keyword.

[0055] The text search method in the embodiment of the present application obtains related words that are semantically and / or grammatically related to the word to be searched, and then because the keywords of the word to be searched include the word to be searched and its related words, each keyword of the word to be searched is used to search in each text to obtain a text containing at least one keyword, which can expand the search scope and increase the probability of obtaining target data.

[0056] The words to be searched are words input by the user into the terminal, and the words to be searched include at least one character or word, such as dog, fox, green, tractor, etc. Input methods include but are not limited to handwriting input, input method input, voice input, etc. The input words can be words, text and / or phrases. The input words can be one or more. When there are multiple words to be searched, it is helpful to expand the search scope.

[0057] In some embodiments, when there are multiple words to be searched, in order to reduce the probability of searching for noise, the associated words of the words to be searched that have the ability to represent may be obtained for search, rather than the associated words of all the words to be searched, which is helpful to reduce the probability of searching for noise. The words to be searched that have the ability to represent refer to terms, etc., for example, Figure 3 As shown in the figure, the user needs to check his train ticket information, so he enters "train ticket of me" in the search bar, and then uses the keyword "train ticket" with representation ability to search, which effectively reduces the search noise.

[0058] In addition, in some embodiments, when there are multiple words to be searched, in order to further reduce the probability of searching for noise, when a keyword of each word to be searched is detected in a text, it is indicated that the text is a valid text, and the text is obtained. Furthermore, when the distance between the keywords of each word to be searched, such as the byte length of the interval, is less than a preset value, and / or when it is detected that the order in which each keyword appears is consistent with the order in which the corresponding words to be searched are input, the text is obtained, which can further reduce the probability of searching for noise. For example, Figure 4 As shown in the figure, two search words "life" and "precious" are entered in the search bar. Through the text search method of this application, only the following words are searched: Figure 5 The paragraph shown contains both the associated word of "life" - "life" and the associated word of "precious" - "precious", and it is further detected that "life" and "precious" are close to each other.

[0059] The text search method of the embodiment of the present application is used to obtain target data, and can be specifically used to obtain target files. The text includes the file name of each file and / or the text in the file. The text can also be an instant message such as an email message, a WeChat message, a text message, etc. The file is a document or a picture, etc., which is not specifically limited here. The document can be editable or non-editable, both within the scope of protection of this application. When the file is a document or a photo containing text, the text of each file may include the text in the document or photo. The document refers to a portable document format document (Portable Document Format, referred to as a PDF document), a presentation (Power Point, referred to as PPT), a word document, a text document (text, referred to as TXT), etc., which is not specifically limited here. The text can be any language, such as Chinese, English, Japanese, Korean, Latin, etc., which is not specifically limited here.

[0060] The text library may refer to a folder of the terminal, which includes a plurality of files, at least one of which contains text.

[0061] In some possible implementations, when the texts include file names of files in a terminal, step 206 may include: obtaining files in the terminal, obtaining file names of the files in the terminal, and then searching in the file names using keywords of the words to be searched to obtain file names containing at least one keyword and corresponding files.

[0062] For example, Figure 3As shown in FIG. 1 , it is a schematic diagram of the effect of searching files in a specific embodiment. In this specific implementation, the user needs to check his train ticket information, so he enters "train ticket" in the search bar. Since there is no file named "train ticket" in the terminal file, the train ticket cannot be obtained by the traditional text search method. However, through the text search method of the present application, because the file name "railway" is a related word of "train ticket", the pdf file named "railway" is searched, which is the train ticket required by the user.

[0063] In some other possible implementations, when the various texts include texts within various files in the terminal, step 206 may include: obtaining various files in the terminal, obtaining the texts within the various files in the terminal, searching the texts within the various files using the keywords of the words to be searched, and obtaining texts containing at least one keyword and the corresponding files.

[0064] For example, Figure 5 As shown, in this specific implementation, the user needs to search for a file. The user does not remember the file name, but the user remembers a sentence or a fragment in the file that roughly describes "... life is precious...", but does not remember the actual expression words in the file, so the user enters "life" and "precious" in the search bar, and through the text search method of the present application, the following is searched. Figure 4 The paragraph shown contains the associated words of "life" - "life" and "dying" and the associated words of "precious" - "precious", such as Figure 5 As shown, the corresponding file finally searched is the pdf document "The Meaning of Life", which is exactly the file the user needs to find.

[0065] In some other possible implementations, when the texts include both the file names of the files in the terminal and the texts in the files, when the texts in the files and / or the file names contain at least one keyword of the searched vocabulary, the corresponding files are obtained.

[0066] In some implementations, when the text search method of the embodiment of the present application is used to obtain a target document, the document may be obtained by an inverted index method, etc. Specifically, the text in each document in the terminal may be obtained, and the inverted index method may be used to search the text in each document using each keyword of the vocabulary to be searched, and the text containing at least one keyword and the corresponding document may be obtained.

[0067] Inverted index is also often called reverse index, embedded file or reverse file. It is an indexing method. In some embodiments, the inverted index is used to store the mapping of the storage location of a keyword in a document or a group of documents under full-text search. The mapping can be in a table form. Through the inverted index method, the target document containing the keyword can be quickly obtained. For example, as shown in Table 1, it is a mapping relationship table between the keywords and documents of each searched word searched by the inverted index method.

[0068] Table 1

[0069] Keywords Document ID containing the keyword houses 221 (document 1 number), 231 (document 2 number), Work 231 green 221, 223 (number of document 3) switch 231 Queen 223 ... ...

[0070] After the step of obtaining the text containing at least one keyword in step 206, the step of displaying the text containing at least one keyword on the display interface and marking the keywords that appear may be included. Specifically, the file name and / or the text in the file containing at least one keyword that is searched and the corresponding file icon may be displayed on the display interface to facilitate user interaction. The marking method may be at least one of bolding the font, underlining, changing the color, changing the font, etc.

[0071] For example, still using the train ticket example, Figure 6 As shown, the file name—“railway of me” and the file icon are displayed on the display interface, but only the keyword “railway” of “ticket” is marked, and other words are not marked.

[0072] For example, still using the example of the meaning of life, Figure 7 As shown, the file name—“railway of me” and the file icon are displayed on the display interface, but only the keyword “railway” of “ticket” is marked, and other words are not marked.

[0073] Specifically, when searching a sentence or paragraph in a file by a keyword, when the keyword is found, the position of the keyword can be further obtained, and then the position can be jumped to and displayed.

[0074] In some possible implementations, when there are multiple texts containing at least one keyword of the vocabulary to be searched, they are sorted according to the relevance to the vocabulary to be searched, and the higher the relevance, the higher the corresponding text is ranked on the display interface, and / or the number of keywords containing the vocabulary to be searched is counted, and the text with the largest number is ranked higher on the display interface. Alternatively, the number of times the keyword of the vocabulary to be searched appears is counted, and the text with more occurrences is ranked higher on the display interface.

[0075] In some possible implementations, the text search method implemented in the present application further includes the step of establishing a correspondence between a predetermined number of words and their associated words. This step can be performed offline in a terminal. The correspondence between a predetermined number of words and their associated words can be established by creating a matrix table, including the following steps:

[0076] Acquire an initial matrix table constructed for a specific word; each specific word and its associated words in the initial matrix table have a paired mapping relationship, and the associated words corresponding to the specific word lacking an associated word are empty;

[0077] Counting the number of specific words with associated words in the matrix table;

[0078] When the number is less than a predetermined number, for a specific word in the matrix table that lacks associated words, the word embedding model is used to obtain its corresponding associated words, and the obtained associated words are written into the matrix table until the number of the specific words with associated words reaches the predetermined number;

[0079] The step of obtaining associated words that are semantically and / or grammatically related to the words to be searched includes:

[0080] According to the to-be-searched word, its associated words are obtained from the matrix table.

[0081] In specific implementation, creating a matrix table includes the following steps: first obtaining a predetermined number of specific words, and obtaining an initial matrix table constructed for the predetermined number of specific words; each specific word in the initial matrix table and its associated words have a pairing mapping relationship, and for a specific word that lacks an associated word, its associated word cell is initialized to empty; then traversing the specific words in the matrix table, counting the associated words of the specific words, and obtaining the associated words of the specific words that lack associated words using a word embedding model, and writing them into the corresponding cells, and then counting; when the count value reaches a predetermined number value, it means that all the specific words have corresponding associated words, and the creation of the matrix table is completed.

[0082] The word embedding model, also known as the Word2Vec model, is a neural network model. In NLP (Natural Language Processing), the most fine-grained is words, which form sentences, and sentences form paragraphs, chapters, and documents. Words are in symbolic form, such as Chinese, English, Latin, etc., so they need to be converted into numerical form, that is, each word is embedded in a mathematical space. This embedding method is called word embedding, and Word2vec is a type of word embedding, which refers to converting a word into a corresponding vector expression to allow the machine to read the data.

[0083] like Figure 8 As shown, the word embedding model in this embodiment includes a logical classifier (i.e., the straight line with an arrow in the figure) and a word vector converter (i.e., the rectangular box in the figure). The words in each text are converted into word vectors by the word vector converter. When a specific word is input into the word embedding model, it will also be converted into a word vector, and then the logical classifier is used to adjust the weights of each context word in the window.

[0084] The method of using a word embedding model to obtain its associated vocabulary specifically converts a specific vocabulary into an array input into the word embedding model, and the word embedding model outputs a plurality of word vectors, and the vocabulary corresponding to these word vectors is the associated vocabulary of the specific vocabulary. The predetermined number of specific vocabulary can be words in the Oxford dictionary.

[0085] In this embodiment, the number of specific words with associated words in the matrix table is first counted. When the number is less than a predetermined value, for the specific words lacking associated words in the matrix table, the word embedding model is used to obtain the corresponding associated words, and the obtained associated words are written into the matrix table. Specifically, the matrix table can be traversed first, and the associated words of the empty words are trained until the number of the specific words with associated words reaches the predetermined value, thereby simplifying the training process and reducing the computing power of the processor.

[0086] The following description further describes the process of creating a specific vocabulary matrix table through a specific example.

[0087] This specific example is to create a matrix table of 273,000 specific words in the Oxford dictionary. Table 2 is the obtained initial matrix. It can be seen from Table 2 that some specific words already have associated words, while some specific words have empty associated words.

[0088] Table 2

[0089] vocabulary Context words fox Quick Brown Jump .. .. government <Empty> .. .. Queen throne princess queen monarch

[0090] Then we start to traverse the above initial matrix, count the specific words with associated words, and use the word embedding model to get the associated words for the specific words without associated words, write them into the cells, and count them again, as shown in Table 3, until the count value reaches 273,000, completing the creation process of the entire matrix.

[0091] Table 3

[0092] Serial number vocabulary Context words 1 airplane Airplane flight tickets roar .. .. .. .. .. .. .. .. .. 100 fox Quick Brown Skip .. .. .. .. 271000 Queen throne princess queen monarch 273000 .. ..

[0093] In some possible implementations, the training process of obtaining the associated words of each specific word using the word embedding model includes the following steps, and the training process can be performed in an offline manner:

[0094] Get the corpus;

[0095] Searching for locations where specific words appear in each document in the corpus, and obtaining context words within a preset window of the specific words at each location;

[0096] The weight of each context word is determined, and the context words with weights greater than the preset weights are output as associated words that are semantically / grammatically related to the specific word.

[0097] This embodiment can improve the semantic / grammatical relevance of the output associated words with the specific words by outputting context words with weights greater than preset weights as associated words that are semantically / grammatically related to the specific words, which is beneficial to reducing search noise.

[0098] When the corpus is updated, the above training process can be re-executed to change the weight of the context words. Corpus refers to a large-scale electronic text library that has been sampled and processed.

[0099] The weight of each context word may be determined according to the frequency of occurrence of each context word, specifically including: when a specific word appears in multiple positions in a document, the frequency of the context word in the window of the specific word at each position may be obtained, and the higher the frequency, the greater the weight is adjusted, and the smaller the frequency, the smaller the weight is adjusted.

[0100] Specifically, it is also possible to identify words in the context that have no ability to distinguish categories from specific words, such as prepositions, conjunctions, etc., and reduce their weights, while increasing the weights of words that have the ability to distinguish categories.

[0101] The window referred to in the embodiment of the present application can be a byte length, for example, with a specific word position as the center, all words within a 10-byte length are considered as context words of the specific word. It can also be the number of words closest to the specific word, for example, with a specific word position as the center, n / 2 words before and after the specific word are considered as context words of the specific word, and n can be set by the user, for example, 10.

[0102] After obtaining the corpus, the documents in the corpus will be preprocessed to standardize the text in the document, including: reading the text; removing punctuation marks, unifying the capitalization, etc. of each sentence in the text, and dividing it into several words, thereby converting the text into a sequence of words, and then building a dictionary to map each word in the dictionary to a unique index, thereby converting the text from a sequence of words to a sequence of indexes. The index can be defined as an ID number, and each word has a unique ID number.

[0103] After preprocessing the documents in the corpus, irrelevant words such as conjunctions, prepositions, and quantifiers can be deleted from the text; then a specific word is input to search for context words within its preset window, thereby improving the relevance and training efficiency of the obtained related words. Moreover, under the premise of the same preset window size, compared with not deleting irrelevant words, this specific embodiment can increase the number of obtained context words.

[0104] In a specific embodiment, the window size may be obtained by following the steps below:

[0105] Obtain documents from at least two terminals;

[0106] Searching for the position of a specific word from each document, and obtaining context words in each different test window of the specific word at each position for different test windows;

[0107] Determine the weight of each context word of each specific word in different test windows, and output the context words with a weight greater than a preset weight as associated words with semantics / grammar related to the specific word;

[0108] The number of associated words of each specific word in different test windows and the degree of association between each associated word and the specific word in different test windows are compared, and the test window with a degree of association higher than a preset threshold and / or a number of associated words higher than a preset number is used as the preset window.

[0109] The inventor selected terminals of 5 different users and tested a total of 500 documents, and found that when the preset window value is within the range of 5-9 bytes in length, it can take into account the training speed, the number of related words, and the correlation between specific words and related words.

[0110] In some possible implementations, in step 206, the step of searching each text in the text library using the keyword includes: searching each text in the text library using associated words of the word to be searched when no text is found using the word to be searched, the number of searched texts is less than a preset number, or it is detected that the text searched using the word to be searched does not belong to the target text.

[0111] First, use the words to be searched to search the text. If the target text, that is, the text required by the user, is found, or a certain amount of text has been searched using the words to be searched, it is not necessary to use the associated words of the words to be searched to search. Otherwise, execute the steps in these implementation modes. In this way, the output of noise text can be reduced and the search volume can be reduced.

[0112] In some possible implementations, the at least one keyword in step 206 refers to any one or more of the words to be searched and all the words associated with the words to be searched. For example, if the word to be searched is "train", and the words associated with train are railway, motor car, and high-speed rail, then train, railway, motor car, and high-speed rail are all keywords of "train", and a text including any one or more of the words train, railway, motor car, and high-speed rail is obtained.

[0113] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0114] It should be noted that, in this article, step codes such as 202 and 204 are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute 204 first and then 202, etc., but these should all be within the scope of protection of this application.

[0115] like Fig. 9 As shown, it is a structural block diagram of a text search device according to an embodiment. The text search device 900 includes:

[0116] A to-be-searched vocabulary acquisition module 910 is used to acquire the to-be-searched vocabulary;

[0117] A related word acquisition module 920 is used to acquire related words that are semantically and / or grammatically related to the word to be searched, and use the word to be searched and the related words as keywords of the word to be searched;

[0118] The search module 930 is used to search various texts in the text library using the keywords of the to-be-searched vocabulary, and obtain texts containing at least one keyword.

[0119] The division of the various modules in the above text search device is only for illustration. In other embodiments, the text search device may be divided into different modules as needed to complete all or part of the functions of the above text search device.

[0120] The specific definition of the text search device can be found in the definition of the text search method above, which will not be repeated here. Each module in the above text search device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0121] The implementation of each module in the text search device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.

[0122] The present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to execute the steps of the method described in any embodiment.

[0123] A computer program product comprising instructions, when running on a computer, enables the computer to execute the method as described in any one of the above embodiments.

[0124] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0125] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0126] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A text search method, characterized in that: The following steps are involved: Get the words to be searched; According to the words to be searched, the associated words are obtained from the matrix table, and the words to be searched and the associated words are used as keywords, wherein the step of creating the matrix table includes: obtaining an initial matrix table constructed for a specific word; each specific word in the initial matrix table and its associated words have a pairing mapping relationship, and the associated words corresponding to the specific words lacking associated words are empty; counting the number of specific words with associated words in the matrix table; when the number is less than a predetermined number value, for the specific words lacking associated words in the matrix table, using a word embedding model to obtain the corresponding associated words, and writing the obtained associated words into the matrix table until the number of the specific words with associated words reaches the predetermined number, wherein the use of the word embedding model to obtain the corresponding associated words includes: obtaining a corpus; searching for the positions where each specific word appears in each document in the corpus, and obtaining the context words within the preset window of the specific word at each position; determining the weight of each context word, and outputting the context words with a weight greater than the preset weight as the associated words with semantics / grammar related to the specific word; wherein the weight of each context word is determined according to the frequency of occurrence of each context word; The keyword is used to search for each text in the text library, and a text containing at least one keyword is obtained; wherein the step of obtaining the preset window includes: obtaining documents in at least two terminals; searching for the position of a specific word from each document, and obtaining context words in each different test window of the specific word at each position for different test windows; determining the weight of each context word of each specific word in different test windows, and outputting the context words with a weight greater than a preset weight as associated words with semantics / grammar related to the specific word; comparing the number of associated words of each specific word in different test windows, and the degree of association between each associated word and the specific word in different test windows, and taking the test window with a degree of association higher than a preset threshold and / or a number of associated words higher than a preset number as the preset window.

2. The method according to claim 1, characterized in that The texts include the file names of the files in the terminal. The steps of obtaining the texts in the terminal and searching the texts using the keywords of the words to be searched include: obtaining the files in the terminal, obtaining the file names of the files in the terminal, searching the file names using the keywords of the words to be searched, and obtaining the file names containing at least one keyword and the corresponding files; Alternatively, the various texts include texts in various files in the terminal, and the step of obtaining various texts in the terminal and searching in various texts using keywords of the words to be searched includes: obtaining various files in the terminal, obtaining texts in various files in the terminal, searching in texts in various files using keywords of the words to be searched, and obtaining texts containing at least one keyword and corresponding files.

3. The method according to claim 1 or 2, characterized in that: After the step of obtaining the text containing at least one keyword, the method further comprises: The text containing at least one keyword is displayed on a display interface, and the keywords that appear are marked.

4. The method according to claim 1, characterized in that: The step of creating the matrix table is performed in an offline manner.

5. The method according to claim 1 or 2, characterized in that: The step of searching each text in the text library using the keyword comprises: When no text is found using the searched words, the number of searched texts is less than a preset number, or it is detected that the text found using the searched words does not belong to the target text, the associated words are used to search each text in the text library.

6. A terminal, characterized in that: The terminal includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.

7. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Quick retrieval method for documents in knowledge base, application server and computer readable storage medium

    CN108038096A

  • Word2vec-based semantic query expansion method and device

    CN108491462A

  • Keyword extraction method and device, storage medium and computer equipment

    CN110826328A

  • Keyword extraction method and electronic device

    US20170139899A1