Resource searching method and device, electronic equipment and storage medium
By splitting and combining the syllables of pinyin strings and matching pre-stored indexes, the problem of inaccurate search for pinyin input is solved, and the accuracy and user experience of search results are improved.
Patent Information
- Application Number
- CN202411286195.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-20
AI Technical Summary
In application scenarios of specific types of terminals, the search method of pinyin letters entered by the user is limited by accuracy, and cannot accurately represent the user's search intention, resulting in inaccurate search results and poor user experience.
By obtaining pinyin strings, splitting them into syllables, and combining them into multiple combination sequences as matching information, matching indexes from pre-stored resources, improving the accuracy of search results.
Improve the flexibility and accuracy of resource retrieval, ensure that the search results are in line with the user's true intentions, and improve the user experience.
Smart Images

Figure CN119166863A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of resource retrieval technology, and in particular to a resource search method, device, electronic equipment and storage medium. Background Art
[0002] For all kinds of websites, resource search is an important function. Users can enter the information they want to search in the search box provided by the terminal. The website can search according to the information entered by the user in the terminal, obtain the corresponding search results and feedback to the user.
[0003] At present, in the application scenarios of certain types of terminals (for example, TV terminals), due to the limitations of the input methods of certain types of terminals, websites mainly rely on the pinyin letters entered by users for search. However, due to the limitations of the accuracy of the information entered by users, the information entered by users cannot represent the user's true search intention. Only using the information entered by users for search may result in the inability to search for the resources that the user actually wants to search, resulting in a low user experience. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a resource search method, device, electronic device and storage medium to improve the accuracy of search results. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a resource search method is provided, the method comprising:
[0006] Get the string representing the pinyin as the string to be processed;
[0007] Splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined;
[0008] Combining adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed;
[0009] From the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched is determined as the search result of the string to be processed; wherein each pre-recorded candidate resource corresponds to at least one index.
[0010] In some embodiments, the combining of adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched includes:
[0011] If each syllable to be combined obtained by splitting represents the pinyin first letter of a syllable, the adjacent syllables to be combined are combined to obtain all the first letter combination sequences corresponding to the character string to be processed as the information to be matched; wherein, a combination sequence contains multiple first letter combinations, and an first letter combination sequence contains the pinyin first letters of all syllables in the character string to be processed.
[0012] In some embodiments, the combining of adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched includes:
[0013] If each syllable to be combined obtained by splitting represents the full pinyin of a syllable, the full pinyin of the adjacent syllables to be combined are combined to obtain all the full pinyin combination sequences corresponding to the character string to be processed as the information to be matched; wherein a full pinyin combination sequence contains multiple full pinyin combinations, and a full pinyin combination sequence contains the full pinyin of all syllables in the character string to be processed;
[0014] And / or, if each syllable to be combined obtained by splitting represents the full pinyin spelling of a syllable, the pinyin first letters of adjacent syllables to be combined are combined to obtain all first letter combination sequences corresponding to the character string to be processed as the information to be matched.
[0015] In some embodiments, determining, from the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched as the search result of the string to be processed includes:
[0016] For any information to be matched, if there is an index that includes all the combinations in the information to be matched, the candidate resource to which the index belongs in the pre-stored candidate resources is determined as the first candidate resource corresponding to the information to be matched;
[0017] For each candidate resource, if the candidate resource is the first candidate resource corresponding to each information to be matched, the candidate resource is determined as the search result of the character string to be processed.
[0018] In some embodiments, before splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined, the method further includes:
[0019] Obtain all subsequences contained in the character string to be processed as the first subsequence;
[0020] Determine the first subsequence to be used currently in descending order of the number of characters contained;
[0021] Determine whether there is a candidate resource with a corresponding index consistent with the first subsequence to be currently used in the pre-recorded candidate resources;
[0022] If so, the candidate resource whose corresponding index is consistent with the first subsequence to be used is determined as the second candidate resource;
[0023] If not, return to the step of determining the first subsequence to be used in descending order of the number of characters contained;
[0024] The step of splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined includes:
[0025] If the number of the determined second candidate resources is not greater than a preset threshold, the character string to be processed is split according to syllables to obtain all syllables included in the character string to be processed as syllables to be combined.
[0026] In some embodiments, the obtaining, as the first subsequence, all subsequences contained in the character string to be processed includes:
[0027] Determine the i-th character in the string to be processed in order from front to back, and determine the j-th character in the string to be processed in order from back to front; wherein the value range of i is 1 to N, N represents the total number of characters contained in the string to be processed; the value range of j is i to N;
[0028] A sequence consisting of all characters between the ith character and the jth character is obtained as a first subsequence.
[0029] In some embodiments, before obtaining all subsequences contained in the to-be-processed string as the first subsequence, the method further includes:
[0030] Searching for a candidate resource whose corresponding index is consistent with the character string to be processed from pre-recorded candidate resources;
[0031] The step of obtaining all subsequences contained in the character string to be processed as the first subsequence includes:
[0032] If the number of candidate resources obtained through the search is less than a preset threshold, all subsequences contained in the character string to be processed are obtained as the first subsequence.
[0033] In some embodiments, the index corresponding to the pre-recorded candidate resource is established by at least one of the following methods:
[0034] For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the full pinyin of each Chinese character in the identification information of the candidate resource, and obtain the full pinyin of the identification information of the candidate resource as the index corresponding to the candidate resource;
[0035] For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the pinyin initials of each Chinese character in the identification information of the candidate resource, and obtain the pinyin initials of the identification information of the candidate resource as the index corresponding to the candidate resource;
[0036] For any candidate resource, perform word segmentation processing on the identification information of the candidate resource according to a preset granularity to obtain multiple word segments corresponding to the identification information of the candidate resource, and use the full pinyin of each word segment as the index corresponding to the candidate resource;
[0037] For any candidate resource, the identification information of the candidate resource is segmented according to a preset granularity to obtain multiple segmented words corresponding to the identification information of the candidate resource, and the first pinyin letter of each segmented word is used as the index corresponding to the candidate resource.
[0038] In some embodiments, the character string to be processed is: received through a search window of a terminal.
[0039] In a second aspect of the present invention, a resource search device is provided, the device comprising:
[0040] A module for obtaining a character string to be processed, used for obtaining a character string representing pinyin as a character string to be processed;
[0041] A splitting module, used for splitting the character string to be processed according to syllables, and obtaining all syllables contained in the character string to be processed as syllables to be combined;
[0042] A combination module, used for combining adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed;
[0043] The recall module is used to determine, from the pre-stored candidate resources, the candidate resources whose corresponding indexes match the information to be matched as the search result of the string to be processed; wherein each pre-recorded candidate resource corresponds to at least one index.
[0044] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0045] Memory, used to store computer programs;
[0046] The processor is used to implement any of the resource search methods described above when executing a program stored in the memory.
[0047] In another aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the resource search methods described above is implemented.
[0048] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the resource search methods described above.
[0049] An embodiment of the present invention provides a resource search method, which includes: obtaining a character string representing pinyin as a character string to be processed; splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined; combining adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed; from pre-stored alternative resources, determining an alternative resource whose corresponding index matches the information to be matched as the search result of the character string to be processed; wherein each pre-recorded alternative resource corresponds to at least one index.
[0050] Based on the above processing, the string to be processed can be split into syllables, and adjacent syllables can be combined to generate a variety of possible combination sequences (i.e., information to be matched), wherein a combination sequence contains multiple combinations, and each combination contains at least one syllable. In other words, a longer string to be processed can be split into multiple smaller units (i.e., combinations), and the multiple smaller units can be used to search for resources. That is, searching using each information to be matched obtained by splitting and combining the string to be processed can improve the flexibility of resource retrieval and avoid the inability to search for resources required by the user due to the accuracy limitation of the string to be processed. And since each combination sequence contains all the syllables in the string to be processed, one information to be matched can represent the complete information of each syllable of the string to be processed, and then, when matching the information to be matched with the corresponding index of the pre-recorded candidate resources, it can ensure that the search results obtained meet the user's real search intention and improve the accuracy of the search results. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0052] Figure 1A first flow chart of a resource search method provided by an embodiment of the present invention;
[0053] Figure 2 A second flow chart of the resource search method provided by an embodiment of the present invention;
[0054] Figure 3 A third flow chart of the resource search method provided by an embodiment of the present invention;
[0055] Figure 4 A fourth flow chart of the resource search method provided by an embodiment of the present invention;
[0056] Figure 5 A fifth flow chart of the resource search method provided by an embodiment of the present invention;
[0057] Figure 6 A flowchart of sorting searched candidate resources provided by an embodiment of the present invention;
[0058] Figure 7 A schematic diagram of a resource search process provided by an embodiment of the present invention;
[0059] Figure 8 A structural diagram of a resource search device provided by an embodiment of the present invention;
[0060] Fig. 9 A structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0062] For all kinds of websites, resource search is an important function. Users can enter the information they want to search in the search box provided by the terminal. The website can search according to the information entered by the user in the terminal, obtain the corresponding search results and feedback to the user.
[0063] At present, in the application scenarios of specific types of terminals, due to the limitations of the input methods of specific types of terminals, websites mainly rely on the pinyin letters entered by users for search. For example, the specific type of terminal may be a TV (television) terminal. For example, when a user wants to search for "news channel", the user needs to enter the pinyin initials "xwpd" or the full pinyin "xinwenpindao" of "news channel" to search for resources.
[0064] However, due to the accuracy limitation of the information input by the user, the information input by the user may not represent the user's true search intention. Searching using only the information input by the user may result in failure to search for the resources that the user actually wants to search for, resulting in a poor user experience.
[0065] In order to solve the above problem, an embodiment of the present invention provides a resource search method, which can be applied to any electronic device for searching resources, such as a server, a search device, etc. A user can input information about a resource to be obtained in a terminal of a specific type, and the electronic device can communicate with the terminal of the specific type to obtain the information input by the user.
[0066] See also Figure 1 , Figure 1 A first flow chart of a resource search method provided by an embodiment of the present invention, the method may include the following steps:
[0067] S101: Obtain a character string representing pinyin as a character string to be processed.
[0068] S102: Split the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined.
[0069] S103: Combine adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched.
[0070] Among them, a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed.
[0071] S104: Determine, from the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched as a search result of the character string to be processed.
[0072] Each pre-recorded candidate resource corresponds to at least one index.
[0073] Based on the above processing, the string to be processed can be split into syllables, and adjacent syllables can be combined to generate a variety of possible combination sequences (i.e., information to be matched), wherein a combination sequence contains multiple combinations, and each combination contains at least one syllable. In other words, a longer string to be processed can be split into multiple smaller units (i.e., combinations), and the multiple smaller units can be used to search for resources. That is, searching using each information to be matched obtained by splitting and combining the string to be processed can improve the flexibility of resource retrieval and avoid the inability to search for resources required by the user due to the accuracy limitation of the string to be processed. And since each combination sequence contains all the syllables in the string to be processed, one information to be matched can represent the complete information of each syllable of the string to be processed, and then, when matching the information to be matched with the corresponding index of the pre-recorded candidate resources, it can ensure that the search results obtained meet the user's real search intention and improve the accuracy of the search results.
[0074] The resource search method provided by the present invention is particularly suitable for application scenarios where the character string input by the user is pinyin letters.
[0075] For step S101, when the user wants to search for resources such as TV programs, TV series, music videos (MVs), etc., the resource search can be performed based on the information of the required resources. For example, the resource information can be the resource name, actor name, character name, publisher name, etc.
[0076] The user can enter a character string representing the information of the required resource in the search box provided by the terminal. Among them, the character string representing the information of the required resource is: the pinyin of the information of the required resource. That is to say, the user can enter the first pinyin letter or the full pinyin of the information of the required resource in the search box provided by the terminal. For example, when the user wants to search for a TV program named "Midday News", the first pinyin letter "wjxw" or the full pinyin "wujianxinwen" of "Midday News" can be entered. Or, when the user wants to search for the TV series "The Legend of Li Si" starring Zhang, the first pinyin letter "lsz" or the full pinyin "lisizhuan" of "The Legend of Li Si" can be entered.
[0077] In one implementation, the character string to be processed is: received through a search window of a terminal.
[0078] In an embodiment of the present invention, the electronic device can obtain a character string representing pinyin input by the user at the terminal as a character string to be processed. For example, the terminal can be a TV terminal logged in by the user. Due to the limitation of the input method of the TV terminal, the user can only search by inputting letters (i.e., pinyin letters).
[0079] Correspondingly, the electronic device can obtain the character string input by the user and perform resource search according to the above steps S101 to S104.
[0080] In this way, the character string representing pinyin input by the user in the search window of the terminal can be processed according to the resource search method provided by the present invention to ensure that the search results obtained meet the user's real search intention and improve the accuracy of the search results.
[0081] It is understandable that, due to the accuracy of the information input by the user, there may be at least one of the following situations, resulting in the character string to be processed being unable to represent the user's true search intent:
[0082] In the first case, the information represented by the character string input by the user lacks some content relative to the actual information of the resource required by the user.
[0083] For example, the actual name of the resource required by the user is "TV Noon News", and the pinyin of the information is "diyidianshitaiwujianxinwen" and "dydstwjxw", while the user may actually input the string "wujianxinwen" representing "Noon News" or the string "diyidianshitaixinwen" representing "TV No. 1 News". In other words, during the process of the user inputting a string, the information represented by the string input by the user may lack some content relative to the actual information of the required resource, resulting in the string to be processed failing to represent the user's true search intention.
[0084] In the second case, the information represented by the character string input by the user has a word order difference with respect to the actual information of the resource required by the user.
[0085] For example, the actual name of the resource required by the user is "TV Noon News", and the pinyin of the information is "diyidianshitaiwujianxinwen" and "dydstwjxw", while the user may actually input the string "wujianxinwendiyidianshitai" which represents "TV Noon News". That is, during the process of the user inputting the string, the information represented by the string input by the user may have a different word order than the actual information of the required resource, resulting in the string to be processed not being able to represent the user's true search intention.
[0086] In order to make the search results obtained according to the character string to be processed meet the user's real search intention, the electronic device can split and reorganize the character string to be processed to obtain the information to be matched for matching with the pre-recorded candidate resources.
[0087] For step S102 to step S103, one Chinese character corresponds to one pinyin syllable. The character string to be processed is split according to the pinyin syllables, that is, the electronic device can split the pinyin of each Chinese character represented by the character string based on Chinese characters to obtain all syllables contained in the character string to be processed.
[0088] In one implementation, the character string to be processed and the prompt word can be input into a pre-trained large language model (LLM) to obtain the character corresponding to each syllable in the character string to be processed. The prompt word can be "split the character string to be processed according to Chinese syllables".
[0089] For example, if the character string 1 to be processed is "xinwenpindao", the character string to be processed can be split according to the syllables of the pinyin to obtain the full pinyin of all syllables contained in the character string 1 to be processed: "xin / wen / pin / da o". Each pinyin sequence separated by " / " represents the full pinyin of a syllable.
[0090] If the character string 2 to be processed is "xwpd", the character string to be processed can be split according to the pinyin syllables to obtain the pinyin initials of all syllables contained in the character string 2 to be processed: "x / w / p / d". Each pinyin sequence separated by " / " represents the pinyin initials of a syllable.
[0091] Correspondingly, the electronic device may use all syllables included in the obtained character string to be processed as syllables to be combined.
[0092] Furthermore, the electronic device can combine adjacent syllables in the character string to be processed according to different granularities to obtain all combination sequences corresponding to the character string to be processed as the information to be matched. The granularity represents the number of syllables contained in a combination. The granularity of each combination contained in a combination sequence can be the same or different.
[0093] In some embodiments, see Figure 2 , Figure 2 A second flow chart of the resource search method provided by the embodiment of the present invention, in Figure 1 On the basis of, step S103 comprises:
[0094] S1031: If each syllable to be combined obtained by splitting represents the pinyin initial letter of a syllable, combine adjacent syllables to be combined to obtain all initial letter combination sequences corresponding to the character string to be processed as the information to be matched.
[0095] Among them, a combination sequence includes multiple initial letter combinations, and an initial letter combination sequence includes the pinyin initial letters of all syllables in the character string to be processed.
[0096] In the embodiment of the present invention, if the character string to be processed is the pinyin initial letter of the syllable corresponding to at least one Chinese character, each syllable to be combined obtained by splitting also represents the pinyin initial letter of a syllable.
[0097] For example, for the above-mentioned character string 2 to be processed is "xwpd", all the syllables to be combined contained in the character string 2 to be processed can be split into: "x / w / p / d", where each syllable to be combined represents the first pinyin letter of a syllable.
[0098] Correspondingly, the electronic device can combine adjacent syllables to be combined according to different granularities to obtain all initial letter combination sequences corresponding to the character string to be processed as information to be matched.
[0099] For example, for the above-mentioned character string 2 to be processed "xwpd", all the initial letter combination sequences obtained are: "x / w / p / d", "x / w / pd", x / wp / d", "x / wpd", "xw / p / d", "xwp / d", "xw / pd", "xwpd". Among them, each pinyin sequence separated by " / " represents an initial letter combination.
[0100] Based on the above processing, when each syllable to be combined obtained by splitting represents the first letter of the pinyin of a syllable, all the first letter combination sequences corresponding to the string to be processed can be used as the information to be matched for resource search. Subsequently, the corresponding index and the alternative resources that are similar or related to the string to be processed can be returned to the user, which can increase the scope of resource search, improve the flexibility of resource retrieval while meeting user needs, increase the number of resources searched, and meet the user's personalized needs.
[0101] In some embodiments, see Figure 3 , Figure 3 A third flow chart of the resource search method provided by the embodiment of the present invention, in Figure 1 On the basis of, step S103 comprises:
[0102] S103a: If each syllable to be combined obtained by splitting represents the full pinyin spelling of a syllable, combine the full pinyin spellings of adjacent syllables to be combined to obtain all full pinyin combination sequences corresponding to the string to be processed, and / or combine the first pinyin letters of adjacent syllables to be combined to obtain all first letter combination sequences corresponding to the string to be processed as the information to be matched.
[0103] Among them, a full spelling combination sequence includes multiple full spelling combinations, and a full spelling combination sequence includes the full pinyin spelling of all syllables in the character string to be processed.
[0104] In the embodiment of the present invention, if the character string to be processed is the full pinyin of a syllable corresponding to at least one Chinese character, each syllable to be combined obtained by splitting also represents the full pinyin of a syllable.
[0105] For example, for the above-mentioned character string 1 to be processed "xinwenpindao", all the syllables to be combined contained in the character string 1 to be processed can be split into: "xin / wen / pin / dao", "xin / wen / pindao", "xin / wenpin / dao", "xin / wenpindao", "xinwen / pin / dao", "xinwenpin / dao", "xinwenpin / dao", "xinwen / pindao", "xinwenpindao". Among them, each syllable to be combined represents the full pinyin of a syllable.
[0106] Accordingly, the information to be matched can be obtained in at least one of the following ways:
[0107] Method 1: According to different granularities, the pinyin and full spellings of adjacent syllables to be combined are combined to obtain all full spelling combination sequences corresponding to the character string to be processed as the information to be matched.
[0108] For example, for the above-mentioned character string 1 to be processed "xinwenpindao", all the full spelling combination sequences obtained are: "xin / wen / pin / dao", "xin / wen / pindao", "xin / wenpin / dao", "xin / wenpindao", "xinwen / pin / dao", "xinwenpin / dao", "xinwenpin / dao", "xinwen / pindao", "xinwenpindao". Among them, each pinyin sequence separated by " / " represents a full spelling combination.
[0109] Method 2: According to different granularities, the first letters of the adjacent pinyin syllables to be combined are combined to obtain all the first letter combination sequences corresponding to the character string to be processed as the information to be matched.
[0110] For example, for the above-mentioned character string 1 to be processed "xinwenpindao", all the initial letter combination sequences obtained are: "x / w / p / d", "x / w / pd", "x / wp / d", "x / wpd", "xw / p / d", "xwp / d", "xw / pd", "xwpd". Among them, each pinyin sequence separated by " / " represents an initial letter combination.
[0111] Based on the above processing, when each syllable to be combined obtained by splitting represents the full pinyin of a syllable, all the full spelling combination sequences corresponding to the string to be processed can be used as the information to be matched, and all the initial letter combination sequences corresponding to the string to be processed can also be used as the information to be matched. Subsequently, when searching for resources based on the information to be matched, the scope of resource search can be improved, and the flexibility of resource retrieval can be improved while meeting user needs, and the number of resources obtained by search can be increased to meet the personalized needs of users.
[0112] With respect to step S104, after obtaining the information to be matched, the electronic device may obtain, from pre-recorded candidate resources, candidate resources whose corresponding indexes match the character string to be matched as search results of the character string to be processed.
[0113] The process of obtaining candidate resources whose corresponding indexes match the information to be matched may also be referred to as a resource recall process, and the specific recall process will be described in subsequent embodiments.
[0114] The electronic device may obtain pre-recorded candidate resources and at least one index corresponding to each candidate resource. For example, the candidate resources and at least one index corresponding to each candidate resource may be recorded in a database. Accordingly, the electronic device may obtain data recorded in the database.
[0115] For a candidate resource, the index corresponding to the candidate resource is: established according to the identification information of the candidate resource. For example, the identification information of a candidate resource may include at least one of the following: name, actor name, role name, publisher name, etc.
[0116] In some embodiments, the index corresponding to the pre-recorded candidate resource is established by at least one of the following methods:
[0117] Method 1: For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the full pinyin of each Chinese character in the identification information of the candidate resource to obtain the full pinyin of the identification information of the candidate resource as the index corresponding to the candidate resource.
[0118] In the embodiment of the present invention, for any candidate resource, if the identification information of the candidate resource includes Chinese characters, the pinyin of each Chinese character can be obtained.
[0119] In one implementation, the electronic device may determine the pinyin of each Chinese character included in the identification information of the candidate resource according to a preset database recording the correspondence between Chinese characters and pinyin.
[0120] In another implementation, the electronic device may also input each Chinese character in the identification information of the candidate resource into a preset Chinese character to pinyin conversion model to obtain the pinyin of each Chinese character. For example, the Chinese character to pinyin conversion model may be a large language model (LLM).
[0121] Furthermore, the full pinyin of each Chinese character can be used to replace each Chinese character in the identification information of the candidate resource to obtain the full pinyin corresponding to the identification information of the candidate resource as the index corresponding to the candidate resource.
[0122] For example, the identification information of candidate resource 1 includes: the name of the candidate resource "Li Si Chuan 01", then "Li Si Chuan" can be replaced with "lisizhuan", and then the replaced "lisizhuan01" can be used as the index corresponding to the candidate resource.
[0123] The identification information of candidate resource 2 includes: the name of the candidate resource "First News Channel", then "diyixinwenpindao" can be used to replace "First News Channel", and then the replaced "diyixinwenpindao" can be used as the index corresponding to the candidate resource.
[0124] In this way, for any alternative resource, an index corresponding to the identification information of the alternative resource can be established based on the full pinyin of the Chinese characters contained in the identification information of the alternative resource, so that when the character string to be processed input by the user contains the full pinyin of the identification information of the alternative resource, the alternative resource can be used as the search result of the character string to be processed.
[0125] Method 2: For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the pinyin initials of each Chinese character in the identification information of the candidate resource to obtain the pinyin initials of the identification information of the candidate resource as the index corresponding to the candidate resource.
[0126] In the embodiment of the present invention, for any candidate resource, if the identification information of the candidate resource includes Chinese characters, the pinyin of each Chinese character can be obtained. The process of obtaining the pinyin of each Chinese character can refer to the above embodiment and will not be described in detail here.
[0127] Correspondingly, after obtaining the pinyin of each Chinese character in the identification information of the alternative resource, the first pinyin letter of each Chinese character can be used to replace each Chinese character in the identification information of the alternative resource to obtain the first pinyin letter corresponding to the identification information of the alternative resource as the index corresponding to the alternative resource.
[0128] It can be understood that the first letters of the pinyin of the identification information of an alternative resource represent the first letters of each syllable in the full pinyin of the identification information of the alternative resource. Among them, one Chinese character corresponds to one syllable.
[0129] For example, if the identification information of alternative resource 1 includes the name of the alternative resource "Li Si Zhuan 01", then the first letters "lsz" of each syllable in "lisizhuan" can be used to replace "Li Si Zhuan". Furthermore, the replaced "lsz01" can be used as the index corresponding to this alternative resource.
[0130] The identification information of alternative resource 2 includes the name of the alternative resource "First News Channel", then "dyxwpd" can be used to replace "First News Channel". Furthermore, the replaced "dyxwpd" can be used as the index corresponding to this alternative resource.
[0131] In this way, for any alternative resource, an index corresponding to the identification information of the alternative resource can be established according to the first letters of the pinyin of the Chinese characters included in the identification information of the alternative resource, so that when the input string to be processed by the user includes the first letters of the pinyin of the identification information of the alternative resource, this alternative resource can be used as the search result of the string to be processed.
[0132] Method 3: For any alternative resource, the identification information of the alternative resource is segmented according to a preset granularity to obtain multiple segments corresponding to the identification information of the alternative resource, and the full pinyin of each segment is used as the index corresponding to the alternative resource.
[0133] In the embodiments of the present invention, for any alternative resource, if the identification information of the alternative resource includes Chinese characters, the identification information of the alternative resource can be segmented according to a preset granularity. The preset granularity is set by those skilled in the art according to actual needs. For example, the granularity of segmentation can be a word (basic vocabulary unit), or a phrase (a fixed collocation composed of multiple words), etc.
[0134] In one implementation, for the identification information of an alternative resource, the electronic device can input the identification information of the alternative resource into a preset segmentation model, and the segmentation model can segment the identification information of the alternative resource according to a preset granularity and output multiple segments corresponding to the identification information of the alternative resource.
[0135] Correspondingly, after obtaining multiple segments corresponding to the identification information of an alternative resource, for any segment, the pinyin of the Chinese characters included in the segment can be obtained to get the full pinyin of the segment. Furthermore, the full pinyin of each segment corresponding to the identification information of the alternative resource can be used as the index corresponding to the alternative resource. Among them, the process of obtaining the pinyin of each Chinese character can refer to the above embodiments and will not be elaborated here.
[0136] For example, the identification information of candidate resource 3 includes: the name of the candidate resource "TV Noon News", then "TV Noon News" is segmented according to the preset granularity to obtain multiple segmented words corresponding to "TV Noon News": "TV Noon", "Noon", "News". Then, the full pinyin of each segmented word can be obtained: "diyidianshitai", "wujian", "xinwen", as the index corresponding to the candidate resource.
[0137] In this way, for any candidate resource, the identification information of the candidate resource can be segmented, and based on the full pinyin of each segmented word, an index corresponding to the identification information of the candidate resource can be established. When the character string to be processed input by the user contains the full pinyin of a segmented word corresponding to the candidate resource, the alternative resource can be used as the search result of the character string to be processed. In other words, the character string input by the user does not need to be completely consistent with the character string representing the identification information of the candidate resource, and the alternative resource can also be retrieved, which can improve the flexibility and accuracy of the search.
[0138] Method 4: For any candidate resource, perform word segmentation processing on the identification information of the candidate resource according to a preset granularity to obtain multiple word segments corresponding to the identification information of the candidate resource, and use the first pinyin letter of each word segment as the index corresponding to the candidate resource.
[0139] In an embodiment of the present invention, for any candidate resource, if the identification information of the candidate resource contains Chinese characters, after the identification information of the candidate resource is segmented according to a preset granularity to obtain multiple segmented words corresponding to the identification information of the candidate resource, for any segmented word, the pinyin first letter of the Chinese character contained in the segmented word can be obtained to obtain the pinyin first letter of the segmented word. Furthermore, the pinyin first letter of each segmented word corresponding to the identification information of the candidate resource can be used as the index corresponding to the candidate resource. Among them, the process of segmenting the identification information of the candidate resource according to the preset granularity and the process of obtaining the pinyin first letter of each Chinese character can refer to the above embodiment and will not be repeated here.
[0140] It is understandable that the first letter of the pinyin of a segment represents: the first letter of each syllable in the full pinyin of the segment, wherein one Chinese character corresponds to one syllable.
[0141] For example, the identification information of candidate resource 4 includes: the name of the candidate resource is "TV Noon News", then "TV Noon News" is segmented according to the preset granularity to obtain multiple segmented words corresponding to "TV Noon News": "TV Noon", "Noon", "News". Then, the first letter of each syllable in the full pinyin of each segmented word can be obtained to obtain the pinyin first letter of each segmented word: "dydst", "wj", "xw", as the index corresponding to the candidate resource.
[0142] In this way, for any candidate resource, the identification information of the candidate resource can be segmented, and an index corresponding to the identification information of the candidate resource can be established based on the first pinyin letter of each segmented word. When the character string to be processed input by the user contains the first pinyin letter of a segmented word corresponding to the candidate resource, the candidate resource can be used as the search result of the character string to be processed. In other words, the character string input by the user does not need to be completely consistent with the character string representing the identification information of the candidate resource, and the candidate resource can also be retrieved, which can improve the flexibility and accuracy of the search.
[0143] It is understandable that, for any candidate resource, when establishing an index of the candidate resource, at least one method can be selected from the above indexing methods according to actual needs to establish the index of the candidate resource.
[0144] Based on the above processing, an index corresponding to the alternative resources can be established according to at least one of the above methods, based on the pinyin of the Chinese characters in the identification information of the pre-recorded alternative resources. In this way, it can be ensured that when the user searches for resources through the pinyin input method, the corresponding index can be obtained from the pre-recorded alternative resources, and the alternative resources that match the information to be matched input by the user can be obtained, thereby improving the accuracy of the search.
[0145] In addition, when establishing indexes corresponding to alternative resources in accordance with multiple methods among the above-mentioned methods, the indexes corresponding to each alternative resource can be enriched. When the information represented by the string input by the user is not completely consistent with the identification information of the alternative resource, resources that meet the user's needs can also be searched. In this way, the flexibility of retrieval can be improved.
[0146] In some embodiments, see Figure 4 , Figure 4 A fourth flow chart of a resource search method provided by an embodiment of the present invention, in Figure 1 On the basis of this, step S104 comprises:
[0147] S1041: For any information to be matched, if there is an index that includes all the combinations in the information to be matched, the candidate resource to which the index belongs in the pre-stored candidate resources is determined as the first candidate resource corresponding to the information to be matched.
[0148] S1042: For each candidate resource, if the candidate resource is the first candidate resource corresponding to each information to be matched, determine the candidate resource as the search result of the character string to be processed.
[0149] In an embodiment of the present invention, for any information to be matched, when the information to be matched is a sequence of initial letter combinations, if there is an index containing all the initial letter combinations in the information to be matched, then the alternative resource to which the index belongs can be determined as the alternative resource that matches the information to be matched, that is, the first alternative resource corresponding to the information to be matched.
[0150] For example, the index corresponding to an alternative resource is "diyidianshitaixinwenpindao", and for an initial combination sequence "x / w / p / d" of the above-mentioned string 2 to be processed "xwpd", the index can contain all initial combinations in the combination sequence. Accordingly, the alternative resource to which the index belongs can be determined as the alternative resource matching the combination sequence.
[0151] Correspondingly, for any information to be matched, when the information to be matched is a full spelling combination sequence, if there is an index that contains the full spelling combination in the information to be matched, the alternative resource to which the index belongs can be determined as the alternative resource that matches the information to be matched, that is, the first alternative resource corresponding to the information to be matched.
[0152] For example, the index corresponding to an alternative resource is "diyidianshitaixinwenpindao". For the full spelling combination sequence "xin / wen / pindao" of the above-mentioned string 1 to be processed "xinwenpindao", the index can contain all the full spelling combinations in the combination sequence. Accordingly, the alternative resource to which the index belongs can be determined as the alternative resource that matches the combination sequence.
[0153] That is, for any combination sequence and the index matched with the combination sequence, the position of each combination included in the combination sequence in the matched index is not limited, and is consistent with the position in the combination sequence. The above matching method can be called non-prefix matching.
[0154] It is understandable that, for one piece of information to be matched, there may be multiple alternative videos whose corresponding indexes match the information to be matched. For example, if the name of alternative resource 1 is "Midday News Channel", the indexes corresponding to alternative resource 1 include: "wujian", "xinwen", "pindao"; the name of alternative resource 2 is "News Channel 001", and the indexes corresponding to alternative resource 2 include: "xinwenpindao", "xinwen", "pindao". When one piece of information to be matched is "xinwen / pindao", the above-mentioned alternative resource 1 and alternative resource 2 can both be determined as alternative resources whose corresponding indexes match the information to be matched.
[0155] Furthermore, for each candidate resource, if the candidate resource is the first candidate resource corresponding to each information to be matched, the candidate resource is determined as the search result of the string to be processed. That is, the electronic device can obtain the intersection of the first candidate resources corresponding to each information to be matched, and use the candidate resource corresponding to the intersection as the search result of the string to be processed.
[0156] In another implementation, for each candidate resource, the search result of the to-be-processed character string may be determined according to the number of times the candidate resource is determined as the first candidate resource corresponding to each piece of information to be matched.
[0157] For example, the search results may be sorted from large to small according to the number of occurrences, and the candidate resources having a number of occurrences greater than a specified threshold are used as the search results of the string to be processed.
[0158] Based on the above processing, the alternative resources that appear repeatedly in the search results of each information to be matched are obtained, and these alternative resources that appear repeatedly are used as the search results of the string to be processed. In this way, it can be ensured that the search results obtained are closer to the user's actual needs and the accuracy of resource retrieval is improved.
[0159] In some embodiments, before the character string to be processed is split and reorganized, a resource search may be performed based on the subsequences in the character string to be processed. Figure 5 , Figure 5 A fifth flow chart of a resource search method provided by an embodiment of the present invention, in Figure 1 On the basis of, before step S102, the method further includes:
[0160] S105: Obtain all subsequences contained in the character string to be processed as the first subsequence.
[0161] S106: Determine the first subsequence to be used currently in descending order of the number of characters included.
[0162] S107: Determine whether there is a candidate resource whose corresponding index is consistent with the first subsequence to be currently used in the pre-recorded candidate resources.
[0163] If it exists, execute step S108; if it does not exist, return to execute step S106.
[0164] S108: Determine the candidate resource whose corresponding index is consistent with the first subsequence to be currently used as the second candidate resource.
[0165] Step S102 includes:
[0166] S102a: If the number of the determined second candidate resources is not greater than a preset threshold, the character string to be processed is split according to syllables to obtain all syllables included in the character string to be processed as syllables to be combined.
[0167] In the embodiment of the present invention, the electronic device may obtain all subsequences contained in the character string to be processed as the first subsequence.
[0168] In one implementation, step S104 includes:
[0169] Step 1: Determine the i-th character in the string to be processed in order from front to back, and determine the j-th character in the string to be processed in order from back to front.
[0170] Among them, the value range of i is 1 to N, N represents the total number of characters contained in the character string to be processed; the value range of j is i to N.
[0171] Step 2: Get a sequence consisting of all characters between the ith character and the jth character as the first subsequence.
[0172] In the embodiment of the present invention, the i-th character in the string to be processed is determined in order from front to back, and the j-th character in the string to be processed is determined in order from back to front, and the total number of characters contained in the string to be processed can be expressed as N. Then, the sequence consisting of all characters between the i-th character and the j-th character is used as the first subsequence. The value range of i is 1 to N, N represents the total number of characters contained in the string to be processed; the value range of j is i to N.
[0173] It can be understood that according to the above steps 1 to 2, the first subsequence obtained (i.e., i is 1 and j is N) is the sequence corresponding to the string to be processed itself, and is also the longest subsequence among the subsequences contained in the string to be processed.
[0174] For example, the string to be processed is "ts06". According to the above steps 1 to 2, all subsequences contained in the string to be processed are obtained as follows: "ts06", "ts0", "s06", "ts", "s0", "06", "t", "s", "0", "6". Accordingly, the 10 subsequences can be used as the first subsequence.
[0175] Furthermore, the electronic device can determine the first subsequence to be used currently in the order of the number of characters contained from large to small, and search for resources based on the first subsequence to be used currently. That is, the electronic device can sort the characters contained in each first subsequence in descending order, and search for resources one by one according to the sorted first subsequences. If there are multiple first subsequences containing the same number of characters, the order between the multiple first subsequences can be random.
[0176] Whenever a resource search is performed according to the first subsequence to be currently used, the electronic device may determine whether there is an alternative resource whose corresponding index is consistent with the first subsequence to be currently used among the pre-recorded alternative resources.
[0177] If there is at least one candidate resource whose corresponding index is consistent with the first subsequence to be currently used, the at least one candidate resource is determined as the second candidate resource.
[0178] That is, after obtaining the candidate resource whose corresponding index matches the first subsequence according to the first subsequence to be used, the electronic device will stop the next resource search. That is, the first subsequence used to obtain the search result of the string to be processed is: among all the subsequences contained in the string to be processed, the subsequence with the largest number of characters and an index consistent with the subsequence (which can be called the longest search subsequence).
[0179] If there is no alternative resource whose corresponding index is consistent with the first subsequence to be used currently, a first subsequence whose number of characters is not greater than the first subsequence to be used currently and for which no resource search has been performed can be obtained from all first subsequences to update the first subsequence to be used currently, and a resource search can be performed based on the updated first subsequence to be used currently.
[0180] For example, for each first subsequence obtained for the above-mentioned string "ts06" to be processed, the first subsequence to be used can be determined in the order of "ts06", "ts0", "s06", "ts", "s0", "06", "t", "s", "0", and "6", and a resource search can be performed based on the first subsequence to be used. That is to say, when performing a resource search for the first time, "ts06" can be determined as the first subsequence to be used, and then it can be determined whether there is an alternative resource with a corresponding index consistent with "ts06" in the pre-recorded alternative resources. If so, the alternative resource with a corresponding index consistent with "ts06" can be obtained as the search result of the string to be processed. If not, "ts0" or "s06" can be determined as the first subsequence to be used, and the above-mentioned resource search steps are repeated until it is determined that there is an alternative resource with a corresponding index consistent with the first subsequence to be used in the pre-recorded alternative resources.
[0181] That is to say, if the first subsequence currently to be used is "ts0" when the resource search is performed for the second time, and there is an alternative resource with a corresponding index consistent with "ts0", then the alternative resource with a corresponding index consistent with "ts0" can be obtained as the search result of the string to be processed ("ts06").
[0182] The number of the determined second candidate resources is not greater than the preset threshold, indicating that the number of the determined second candidate resources is small, or there is no candidate resource with a corresponding index consistent with each first subsequence in the pre-recorded candidate resources, that is, the second candidate resource is not determined. At this time, in order to avoid inaccuracy of the character string to be processed due to an error in user input and failure to obtain resource search results, step S102 can be performed to split the character sequence in the character string to be processed.
[0183] Based on the above processing, resources are searched according to each first subsequence in the order of the number of characters contained from large to small, and longer subsequences can be matched preferentially. Since longer subsequences can more accurately represent the resources required by the user, and the actual text meaning represented by longer subsequences is more unique than that represented by shorter subsequences, the resources required by the user can be located more quickly, thereby improving the search efficiency. When the number of second candidate resources obtained by the search is small, the character string to be processed can be split and reorganized, which can improve the efficiency of the search and avoid the waste of calculation.
[0184] In some embodiments, before step S105, the method further includes:
[0185] From the pre-recorded candidate resources, search for the candidate resource whose corresponding index is consistent with the string to be processed.
[0186] Step S105 includes:
[0187] If the number of candidate resources obtained by searching is less than a preset threshold, all subsequences contained in the character string to be processed are obtained as the first subsequence.
[0188] In the embodiment of the present invention, after obtaining the character string input by the user (ie, the character string to be processed), the electronic device may search for a candidate resource whose corresponding index is consistent with the character string to be processed from pre-recorded candidate resources.
[0189] If the number of candidate resources obtained by the search is less than the preset threshold, it indicates that the number of candidate resources obtained by the current search is small. If the obtained candidate resources are directly returned to the user, the user's search needs may not be met, resulting in a poor user experience.
[0190] Correspondingly, when the number of candidate resources obtained through the search is less than a preset threshold, the electronic device may perform a resource search according to the above steps S105 to S108, and the specific search process will not be described in detail herein.
[0191] Based on the above processing, when a fine search is performed through a string input by a user and the search results obtained are few, a fuzzy search can be performed according to the resource search method provided by the present invention, ensuring that the search results obtained meet the user's real search intention while enriching the number of search results. In other words, in the scenario where there are no results for a clear search intention, an incremental recommendation function can be provided, effectively improving the distribution of similar content and promoting the improvement of overall distribution efficiency.
[0192] In some embodiments, see Figure 6 , Figure 6 A flowchart for sorting searched candidate resources provided by an embodiment of the present invention, after obtaining the candidate resources whose corresponding indexes match the string to be matched according to the above steps S101 to S103, the candidate resources whose corresponding indexes match the string to be matched can be sorted according to the following steps:
[0193] S601: Based on a preset first sorting model, sort candidate resources whose corresponding indexes match the character string to be matched, and determine a first preset number of first resources to be sorted.
[0194] S602: Sort the first resources to be sorted based on a preset second sorting model to determine the first second preset number of second resources to be sorted.
[0195] S603: Sort the second resources to be sorted based on the preset third sorting model to obtain a specified order of each second resource to be sorted, and return the second resources to be sorted and the specified order of each second resource to be sorted to the user.
[0196] It is understandable that the search results of the string to be processed may contain thousands or tens of thousands of candidate resources. Therefore, the electronic device can further filter and sort the search results of the string to be processed to improve the accuracy of the search results while reducing the number of resources obtained by the search.
[0197] In an embodiment of the present invention, after obtaining the search results of the string to be processed, the candidate resources contained in the search results of the string to be processed can be roughly sorted based on a preset first sorting model (also referred to as a rough sorting model) to determine the first first preset number of first resources to be sorted. For example, the first sorting model can score the candidate resources whose corresponding index matches the string to be matched in multiple business target dimensions (such as click-through rate, etc.), and determine the first first preset number of candidate resources as the first resources to be sorted in descending order of scores.
[0198] Among them, the preset first sorting model can be a machine learning model such as a logistic regression (LR) model or a multilayer perceptron (MLP) model.
[0199] In this way, the number of resources required to be returned to the user can be reduced according to actual needs. In addition, when the first resources to be sorted are subsequently refined, the efficiency of the refined sorting can be improved, and a large amount of computing resources can be wasted during the refined sorting process.
[0200] The electronic device can further screen and sort the first resources to be sorted by a preset second sorting model (also called a refined sorting model) to determine the first second preset number of second resources to be sorted. For example, the second sorting model can score each candidate resource in multiple business target dimensions (such as click-through rate, conversion rate, etc.), and determine the first second preset number of first resources to be sorted as the second resources to be sorted in descending order of scores.
[0201] Among them, the preset second sorting model can be a deep neural network (DNN, Deep Neural Networks) model, a recurrent neural network (RNN, Recurrent Neural Network) model, etc.
[0202] After obtaining the second resources to be sorted, the second resources to be sorted can be re-ranked based on the third sorting model (also called a re-ranking model) in combination with the actual needs of the business scenario (such as click-through rate, number of views, number of favorites, etc.) to obtain the specified order of each second resource to be sorted. The re-ranking can be a recurrent neural network model, a self-attention network (Self-Attention) model, etc.
[0203] After obtaining the designated sequence of each second resource to be sorted, each second resource to be sorted may be displayed on the terminal logged in by the user according to the designated sequence of each second resource to be sorted.
[0204] Based on the above processing, after obtaining the search results of the string input by the user, the search results can be filtered and sorted based on the first sorting model, the second sorting model and the third sorting model, so as to adjust the display order of the searched resources according to actual needs, give priority to recommending resources that meet user needs, improve user experience, and provide users with intelligent resource search services.
[0205] See also Figure 7 , Figure 7 A schematic diagram of a resource search process provided by an embodiment of the present invention. Figure 7 In the example, TV (television) content source represents pre-recorded alternative resources, and offline service represents the establishment of indexes corresponding to alternative resources. Accordingly, for each alternative resource, a full spelling index of the alternative resource can be established in accordance with the above method 1 through the Chinese to Pinyin recognition service, and an initial letter index of the alternative resource can be established in accordance with the above method 2. For each alternative resource, a word-granular full spelling index of the alternative resource can also be established in accordance with the above method 3 through the word segmentation service, and an initial letter index of the alternative resource can be established in accordance with the above method 4.
[0206] The recall service represents the process of searching for resources. Accordingly, after obtaining the string input by the user (i.e., the string to be processed, also referred to as a token), the electronic device can split and reorganize the string to be processed according to the above steps S102-S103 to obtain the information to be matched for matching with the pre-recorded candidate resources.
[0207] In addition, after obtaining the character string to be processed, a resource search (i.e., longest subsequence matching) can be performed according to steps S105 to S108. That is, all subsequences contained in the character string to be processed are matched with the indexes of each candidate resource (including the first letter index and the full spelling index), and a subsequence (i.e., the longest subsequence) containing the largest number of characters and having an index consistent with the subsequence is obtained, as well as a second candidate resource whose corresponding index is consistent with the longest subsequence. When the number of the second candidate resources determined is not greater than the preset threshold, steps S102-S103 are executed.
[0208] Furthermore, for each information to be matched, after the first candidate resource corresponding to each information to be matched, the intersection of the first candidate resources corresponding to each information to be matched can be determined, that is, the resources that appear repeatedly in each search result can be used as the search result of the string to be processed.
[0209] Accordingly, the search results of the character string to be processed can be roughly sorted, finely sorted, and rearranged according to steps S601 to S603 to obtain the resources (i.e., the second resources to be sorted) and the specified order of each resource that are finally returned to the user. Subsequently, each second resource to be sorted can be displayed on the terminal logged in by the user according to the specified order of each second resource to be sorted.
[0210] Based on the same inventive concept, an embodiment of the present invention provides an image generating device, see Figure 8 , Figure 8 A structural diagram of a resource search device provided by an embodiment of the present invention. The device comprises:
[0211] The to-be-processed character string acquisition module 801 is used to acquire a character string representing pinyin as the to-be-processed character string;
[0212] A splitting module 802 is used to split the character string to be processed according to syllables, and obtain all syllables contained in the character string to be processed as syllables to be combined;
[0213] A combination module 803 is used to combine adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed;
[0214] The recall module 804 is used to determine, from the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched as the search result of the string to be processed; wherein each pre-recorded candidate resource corresponds to at least one index.
[0215] In some embodiments, the combining module 803 is specifically used for:
[0216] If each syllable to be combined obtained by splitting represents the pinyin first letter of a syllable, the adjacent syllables to be combined are combined to obtain all the first letter combination sequences corresponding to the character string to be processed as the information to be matched; wherein, a combination sequence contains multiple first letter combinations, and an first letter combination sequence contains the pinyin first letters of all syllables in the character string to be processed.
[0217] In some embodiments, the combining module 803 is specifically used for:
[0218] If each syllable to be combined obtained by splitting represents the full pinyin of a syllable, the full pinyin of the adjacent syllables to be combined are combined to obtain all the full pinyin combination sequences corresponding to the character string to be processed as the information to be matched; wherein a full pinyin combination sequence contains multiple full pinyin combinations, and a full pinyin combination sequence contains the full pinyin of all syllables in the character string to be processed;
[0219] And / or, if each syllable to be combined obtained by splitting represents the full pinyin spelling of a syllable, the pinyin first letters of adjacent syllables to be combined are combined to obtain all first letter combination sequences corresponding to the character string to be processed as the information to be matched.
[0220] In some embodiments, the recall module 804 is specifically used to:
[0221] For any information to be matched, if there is an index that includes all the combinations in the information to be matched, the candidate resource to which the index belongs in the pre-stored candidate resources is determined as the first candidate resource corresponding to the information to be matched;
[0222] For each candidate resource, if the candidate resource is the first candidate resource corresponding to each information to be matched, the candidate resource is determined as the search result of the character string to be processed.
[0223] In some embodiments, the apparatus further comprises:
[0224] A subsequence acquisition module, before splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined, obtains all subsequences contained in the character string to be processed as a first subsequence;
[0225] A subsequence determination module determines a first subsequence to be used currently in descending order of the number of characters contained;
[0226] A judgment module determines whether there is a candidate resource with a corresponding index consistent with the first subsequence to be currently used in the pre-recorded candidate resources;
[0227] A first candidate resource determination module, configured to determine, if any, a candidate resource whose corresponding index is consistent with the first subsequence to be currently used as a second candidate resource;
[0228] The return module is used to trigger the subsequence determination module if it does not exist;
[0229] The splitting module 802 is specifically used for:
[0230] If the number of the determined second candidate resources is not greater than a preset threshold, the character string to be processed is split according to syllables to obtain all syllables included in the character string to be processed as syllables to be combined.
[0231] In some embodiments, the subsequence acquisition module is specifically used to:
[0232] Determine the i-th character in the string to be processed in order from front to back, and determine the j-th character in the string to be processed in order from back to front; wherein the value range of i is 1 to N, N represents the total number of characters contained in the string to be processed; the value range of j is i to N;
[0233] A sequence consisting of all characters between the ith character and the jth character is obtained as a first subsequence.
[0234] In some embodiments, the apparatus further comprises:
[0235] A first search module, configured to search for a candidate resource whose corresponding index is consistent with the character string to be processed from pre-recorded candidate resources;
[0236] The subsequence acquisition module is specifically used for:
[0237] If the number of candidate resources obtained through the search is less than a preset threshold, all subsequences contained in the character string to be processed are obtained as the first subsequence.
[0238] In some embodiments, the index corresponding to the pre-recorded candidate resource is established by at least one of the following methods:
[0239] For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the full pinyin of each Chinese character in the identification information of the candidate resource, and obtain the full pinyin of the identification information of the candidate resource as the index corresponding to the candidate resource;
[0240] For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the pinyin initials of each Chinese character in the identification information of the candidate resource, and obtain the pinyin initials of the identification information of the candidate resource as the index corresponding to the candidate resource;
[0241] For any candidate resource, perform word segmentation processing on the identification information of the candidate resource according to a preset granularity to obtain multiple word segments corresponding to the identification information of the candidate resource, and use the full pinyin of each word segment as the index corresponding to the candidate resource;
[0242] For any candidate resource, the identification information of the candidate resource is segmented according to a preset granularity to obtain multiple segmented words corresponding to the identification information of the candidate resource, and the first pinyin letter of each segmented word is used as the index corresponding to the candidate resource.
[0243] In some embodiments, the character string to be processed is: received through a search window of a terminal.
[0244] The embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0245] Memory 903, used for storing computer programs;
[0246] The processor 901 is used to implement the steps of any resource search method in the above embodiments when executing the program stored in the memory 903.
[0247] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0248] The communication interface is used for communication between the above electronic device and other devices.
[0249] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0250] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0251] In another embodiment of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the resource search method described in any one of the above embodiments is implemented.
[0252] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is executed on a computer, the computer executes the resource search method described in any one of the above embodiments.
[0253] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0254] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0255] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0256] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A resource search method, characterized in that: The method comprises: Get the string representing the pinyin as the string to be processed; Splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined; Combining adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed; From the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched is determined as the search result of the string to be processed; wherein each pre-recorded candidate resource corresponds to at least one index.
2. The method according to claim 1, characterized in that The combining of adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched includes: If each syllable to be combined obtained by splitting represents the pinyin first letter of a syllable, the adjacent syllables to be combined are combined to obtain all the first letter combination sequences corresponding to the character string to be processed as the information to be matched; wherein, a combination sequence contains multiple first letter combinations, and an first letter combination sequence contains the pinyin first letters of all syllables in the character string to be processed.
3. The method according to claim 1, characterized in that: The combining of adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched includes: If each syllable to be combined obtained by splitting represents the full pinyin of a syllable, the full pinyin of the adjacent syllables to be combined are combined to obtain all the full pinyin combination sequences corresponding to the character string to be processed as the information to be matched; wherein a full pinyin combination sequence contains multiple full pinyin combinations, and a full pinyin combination sequence contains the full pinyin of all syllables in the character string to be processed; And / or, if each syllable to be combined obtained by splitting represents the full pinyin spelling of a syllable, the pinyin first letters of adjacent syllables to be combined are combined to obtain all first letter combination sequences corresponding to the character string to be processed as the information to be matched.
4. The method according to claim 1, characterized in that: The step of determining, from the pre-stored candidate resources, a candidate resource whose corresponding index matches the information to be matched as the search result of the string to be processed includes: For any information to be matched, if there is an index that includes all the combinations in the information to be matched, the candidate resource to which the index belongs in the pre-stored candidate resources is determined as the first candidate resource corresponding to the information to be matched; For each candidate resource, if the candidate resource is the first candidate resource corresponding to each information to be matched, the candidate resource is determined as the search result of the character string to be processed.
5. The method according to claim 1, characterized in that Before splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined, the method further includes: Obtain all subsequences contained in the character string to be processed as the first subsequence; Determine the first subsequence to be used currently in descending order of the number of characters contained; Determine whether there is a candidate resource with a corresponding index consistent with the first subsequence to be currently used in the pre-recorded candidate resources; If so, the candidate resource whose corresponding index is consistent with the first subsequence to be used is determined as the second candidate resource; If not, return to the step of determining the first subsequence to be used in descending order of the number of characters contained; The step of splitting the character string to be processed according to syllables to obtain all syllables contained in the character string to be processed as syllables to be combined includes: If the number of the determined second candidate resources is not greater than a preset threshold, the character string to be processed is split according to syllables to obtain all syllables included in the character string to be processed as syllables to be combined.
6. The method according to claim 5, characterized in that The step of obtaining all subsequences contained in the character string to be processed as the first subsequence includes: Determine the i-th character in the string to be processed in order from front to back, and determine the j-th character in the string to be processed in order from back to front; wherein the value range of i is 1 to N, N represents the total number of characters contained in the string to be processed; the value range of j is i to N; A sequence consisting of all characters between the ith character and the jth character is obtained as a first subsequence.
7. The method according to claim 5, characterized in that Before obtaining all subsequences contained in the character string to be processed as the first subsequence, the method further includes: Searching for a candidate resource whose corresponding index is consistent with the character string to be processed from pre-recorded candidate resources; The step of obtaining all subsequences contained in the character string to be processed as the first subsequence includes: If the number of candidate resources obtained through the search is less than a preset threshold, all subsequences contained in the character string to be processed are obtained as the first subsequence.
8. The method according to claim 1, characterized in that: The index corresponding to the pre-recorded candidate resource is established by at least one of the following methods: For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the full pinyin of each Chinese character in the identification information of the candidate resource, and obtain the full pinyin of the identification information of the candidate resource as the index corresponding to the candidate resource; For any candidate resource, replace each Chinese character in the identification information of the candidate resource according to the pinyin initials of each Chinese character in the identification information of the candidate resource, and obtain the pinyin initials of the identification information of the candidate resource as the index corresponding to the candidate resource; For any candidate resource, perform word segmentation processing on the identification information of the candidate resource according to a preset granularity to obtain multiple word segments corresponding to the identification information of the candidate resource, and use the full pinyin of each word segment as the index corresponding to the candidate resource; For any candidate resource, the identification information of the candidate resource is segmented according to a preset granularity to obtain multiple segmented words corresponding to the identification information of the candidate resource, and the first pinyin letter of each segmented word is used as the index corresponding to the candidate resource.
9. The method according to claim 1, characterized in that: The character string to be processed is: received through the search window of the terminal.
10. A resource search device, characterized in that: The device comprises: A module for obtaining a character string to be processed is used to obtain a character string representing pinyin as a character string to be processed; A splitting module, used for splitting the character string to be processed according to syllables, and obtaining all syllables contained in the character string to be processed as syllables to be combined; A combination module, used for combining adjacent syllables to be combined to obtain all combination sequences corresponding to the character string to be processed as information to be matched; wherein a combination sequence includes multiple combinations, each combination includes at least one syllable, and a combination sequence includes all syllables in the character string to be processed; The recall module is used to determine, from the pre-stored candidate resources, the candidate resources whose corresponding indexes match the information to be matched as the search result of the string to be processed; wherein each pre-recorded candidate resource corresponds to at least one index.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 9 when executing a program stored in a memory.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Search term recommendation method and device, computer and storage medium
CN110619076A
Method for searching multimedia resources based on word segmentation index, and server
CN111259171A
Input recommendation method and device, electronic equipment and storage medium
CN117009495A
Pinyin-based video file retrieval method and related equipment
CN118170947A
Chinese language input apparatus and keyboard thereof
JP1990126362A
