A method, device, electronic device and storage medium for processing search information
By performing word segmentation processing on the search information to be processed and deleting adjacent word segmentation with similar pinyin input methods, the problem of poor query error correction in the prior art is solved, and the accuracy of search results is improved.
Patent Information
- Application Number
- CN202210747606.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-06-29
AI Technical Summary
The prior art only performs error correction from the text level when users enter incorrect queries, resulting in low accuracy of search results.
By performing word segmentation processing on the search information to be processed, it is determined whether there are text characters with similar pinyin input methods in the target participle and its adjacent participle. If it exists, delete the adjacent participle to obtain the processed search information.
The accuracy of search results can be improved and the information that users want to search can be determined more accurately. Compared with the method of correcting errors only at the text level, the scope of error correction is expanded.
Smart Images

Figure CN115048584B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information search technology, and in particular to a method, device, electronic device and storage medium for processing search information. Background Art
[0002] Information search is an important function for all kinds of websites. The search information that users can enter in the search box is called query. The website can find the corresponding search results based on the query entered by the user and feedback them to the user. However, due to the existence of spelling errors or memory errors of users, there will be some errors in the query entered by the user, which will lead to inaccurate search results. Therefore, it is an essential process to correct the query entered by the user.
[0003] Current error correction technology usually only corrects the original query at the text level. The corrected query only needs to be semantically coherent, and then the edit distance is used to determine whether to use the corrected query for search. The edit distance is the number of times the original query is added, deleted, modified, etc. to obtain the corrected query.
[0004] However, a semantically coherent query is not necessarily the query that the user actually wants to search for. In the error correction process, the effect of correcting the query only at the text level is not ideal. For example, after entering incorrect information, the user may not delete the incorrect information, but directly enter the correct information after the incorrect information. The semantically coherent query obtained by the above error correction method is not necessarily the query that the user actually wants to search for. Therefore, the accuracy of the search results is low. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a method, device, electronic device and storage medium for processing search information to improve the accuracy of search results. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for processing search information, the method comprising:
[0007] Get pending search information;
[0008] Performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed;
[0009] Determine whether there is at least one text character in a target segmentation whose text features match a preset named entity and whose pinyin input mode is similar to that of the text characters in the adjacent segmentation.
[0010] If it exists, the adjacent word segmentation is deleted to obtain the processed search information.
[0011] Optionally, the step of determining whether there is at least one text character corresponding to a text character included in the target segmentation and a text character included in an adjacent segmentation whose pinyin input mode is similar includes:
[0012] Determine, according to the pinyin of the target word segment, a similar pinyin corresponding to the pinyin of the target word segment from a preset pinyin library as a first similar pinyin, wherein the preset pinyin library stores a correspondence between each pinyin and its similar pinyin;
[0013] Determine, from the preset pinyin library, a similar pinyin corresponding to the pinyin of the adjacent segmented word of the target segmented word, as a second similar pinyin;
[0014] Determine whether the pinyin of the target word and the first similar pinyin and the pinyin of the adjacent word and the second similar pinyin have the same pinyin;
[0015] If so, it is determined that at least one of the text characters included in the target word segment and the text characters included in the adjacent word segment has a similar pinyin input method.
[0016] Optionally, the step of determining whether the pinyin of the target segmentation word and the first similar pinyin and the pinyin of the adjacent segmentation word and the second similar pinyin have the same pinyin includes:
[0017] If the number of text characters included in the target word is greater than the number of text characters included in the adjacent word, the same number of pinyins as the text characters included in the adjacent word are intercepted from the pinyin of the target word and the first similar pinyin as the pinyin to be matched;
[0018] Determine whether the pinyin to be matched, the pinyin of the adjacent word segmentation, and the second similar pinyin have the same pinyin;
[0019] If so, it is determined that the same pinyin exists among the pinyin of the target word segment and the first similar pinyin and the pinyin of the adjacent word segment and the second similar pinyin.
[0020] Optionally, the method for establishing the preset pinyin library includes:
[0021] Get the pinyin corresponding to each text;
[0022] According to the number of pinyin characters and the edit distance between every two pinyins, the similar pinyins of each pinyin are marked;
[0023] Each pinyin is recorded in correspondence with its corresponding similar pinyin to obtain the preset pinyin library.
[0024] Optionally, the step of marking similar pinyins of each pinyin according to the number of pinyin characters and the edit distance between every two pinyins includes:
[0025] For each two pinyins, if the two pinyins meet one of the following conditions, the two pinyins are determined to be similar pinyins:
[0026] The two pinyins include the same number of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0;
[0027] The two pinyins include different numbers of pinyin characters, and the pinyin characters included in one pinyin include all the pinyin characters included in the other pinyin;
[0028] The two pinyins include different numbers of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0.
[0029] Optionally, the step of performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed includes:
[0030] The search information to be processed is input into a pre-trained word segmentation model to perform word segmentation processing on the search information to be processed, and the word segments included in the search information to be processed and the parts of speech corresponding to the word segments are determined.
[0031] Optionally, before the step of determining whether there is at least one text character in the text characters included in the target segmentation and the text characters included in the adjacent segmentation whose corresponding pinyin input mode is similar, the method further includes:
[0032] Inputting the part-of-speech entity noun segmentation included in the search information to be processed into a pre-trained entity noun recognition model to determine the named entity category to which the segmentation belongs;
[0033] Determine the segmented word whose named entity category is the category of the preset named entity as the target segmented word.
[0034] Optionally, after the step of deleting the adjacent segmented words to obtain processed search information, the method further includes:
[0035] Determining semantic scores of the search information to be processed and the search information after processing according to the semantics of the search information to be processed and the semantics of the search information after processing respectively;
[0036] Determine the search times corresponding to the search information to be processed and the search information after processing respectively;
[0037] Determining the number of search results corresponding to the search information to be processed and the search information after processing respectively;
[0038] Calculate an error correction score based on the semantic score, the number of searches, and the number of search results;
[0039] Based on the error correction score, it is determined whether to use the processed search information for searching.
[0040] Optionally, the method further includes:
[0041] If it is determined to use the processed search information for searching, searching based on the processed search information to obtain search results;
[0042] If it is determined not to use the processed search information for searching, a search is performed based on the search information to be processed to obtain search results.
[0043] In a second aspect, an embodiment of the present invention provides a device for processing search information, the device comprising:
[0044] An acquisition module, used to acquire search information to be processed;
[0045] A word segmentation module, used for performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed;
[0046] A first determination module is used to determine whether there is a text character included in a target segmentation and a text character included in an adjacent segmentation, and whether there is at least one text character corresponding to the text character having a similar pinyin input mode, wherein the target segmentation is a segmentation whose text feature matches a preset named entity;
[0047] The deletion module is used to delete the adjacent word segments if they are similar, so as to obtain processed search information.
[0048] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0049] Memory, used to store computer programs;
[0050] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.
[0051] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein 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 the first aspects are implemented.
[0052] In the scheme provided by the embodiment of the present invention, the electronic device can obtain the search information to be processed, perform word segmentation processing on the search information to be processed, obtain the vocabulary included in the search information to be processed, and then determine whether there is at least one text character corresponding to the text character included in the target word segmentation and the text character included in the adjacent word segmentation. The target word segmentation is a word segmentation whose text feature matches the preset named entity. If so, the adjacent word segmentation is deleted to obtain the processed search information. Through the above scheme, the electronic device can determine the target word segmentation whose text feature matches the preset named entity in the search information, that is, the name of the preset entity that the user wants to search for with a high probability, and can also correct the error from the pinyin level of the word segmentation, that is, delete the adjacent word segmentation whose pinyin input method corresponding to the included text character is similar to the pinyin input method corresponding to the text character included in the target word segmentation. In this way, the electronic device can delete the search information input by the user by mistake, thereby determining the information that the user really wants to search in the search information. Furthermore, when the subsequent electronic device searches based on the processed search information, the accuracy of the search results can be improved compared with the method of correcting the search information only from the text level. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] 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.
[0054] Figure 1 A flowchart of a method for processing search information provided by an embodiment of the present invention;
[0055] Figure 2 for Figure 1 A specific flow chart of step S103 in the illustrated embodiment;
[0056] Figure 3 for Figure 2 A specific flow chart of step S203 in the illustrated embodiment;
[0057] Figure 4 Based on Figure 1 A flow chart of a method for establishing a preset audio library in the illustrated embodiment;
[0058] Figure 5 Based on Figure 1 A flow chart of a method for determining a target word segmentation in the illustrated embodiment;
[0059] Figure 6 Based on Figure 1 A flow chart of a method for determining search information of the illustrated embodiment;
[0060] Figure 7 Another flow chart of the method for processing search information provided by an embodiment of the present invention;
[0061] Figure 8 A schematic diagram of the structure of a search information processing device provided by an embodiment of the present invention;
[0062] Fig. 9 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] 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.
[0064] In order to improve the accuracy of search results, embodiments of the present invention provide a method, device, electronic device, computer-readable storage medium and computer program product for processing search information. First, a method for processing search information provided by embodiments of the present invention is introduced below.
[0065] The method for processing search information provided by the embodiment of the present invention can be applied to any electronic device that needs to process search information, such as a server, a processor, a search device, etc. No specific limitation is made here, and for the sake of clarity, it is referred to as an electronic device hereinafter.
[0066] like Figure 1 As shown, a method for processing search information, the method comprising:
[0067] S101, obtaining search information to be processed;
[0068] S102, performing word segmentation processing on the search information to be processed to obtain word segments included in the search information to be processed;
[0069] S103, determining whether there is a text character included in the target word and a text character included in its adjacent word, and whether there is at least one text character corresponding to a similar pinyin input method, if so, executing step S104;
[0070] The target word segmentation is a word segmentation whose text features match a preset named entity.
[0071] S104, deleting the adjacent word segments to obtain processed search information.
[0072] It can be seen that in the scheme provided by the embodiment of the present invention, the electronic device can obtain the search information to be processed, perform word segmentation processing on the search information to be processed, obtain the vocabulary included in the search information to be processed, and then determine whether there is at least one text character corresponding to the text character included in the target word segmentation and the text character included in the adjacent word segmentation. The target word segmentation is a word segmentation whose text feature matches the preset named entity. If it exists, the adjacent word segmentation is deleted to obtain the processed search information. Through the above scheme, the electronic device can determine the target word segmentation whose text feature matches the preset named entity in the search information, that is, the name of the preset entity that the user is likely to want to search for, and can also correct errors from the pinyin level of the word segmentation, that is, the adjacent word segmentation whose pinyin input method corresponding to the included text character is similar to the pinyin input method corresponding to the text character included in the target word segmentation. In this way, the electronic device can delete the search information that the user mistakenly inputs, thereby determining the information that the user really wants to search in the search information. Furthermore, when the subsequent electronic device searches based on the processed search information, compared with the method of correcting the search information only from the text level, the accuracy of the search results can be improved.
[0073] When a user wants to search for videos, news, actor information, film and television drama information, products, etc. on a website, he can enter the search information of the target he wants to search for in the search box of the website, such as the video name, actor name, role name, film and television drama name, product name, news keyword or creator name, etc. The user can send a search instruction to the website by clicking a search button or pressing the enter key, indicating that the user wants to search for information corresponding to the search information he entered, so that the electronic device can obtain the search information entered by the user, that is, the search information to be processed.
[0074] Since each user has different input habits, and there are cases where users do not delete erroneous information after entering it, the search information to be processed obtained by the electronic device may include both information that the user actually wants to search for and information that the user does not want to search for, that is, erroneous information.
[0075] If the electronic device uses the pending search information containing the user input error information to search for videos, the search results obtained may not be the search results that the user really wants to search, or the corresponding search results may not be found. Therefore, in order to determine whether the pending search information includes the target word segmentation that matches the text feature with the preset named entity, after obtaining the pending search information, the electronic device can perform the above step S102, that is, perform word segmentation processing on the above pending search information to obtain the word segmentation included in the above pending search information, and of course, determine the part of speech of each word segmentation, which is reasonable.
[0076] Among them, the preset named entities can be determined in advance according to various resources available on the website. For example, the names of various film and television dramas, actor names, character names, etc. can be determined as preset named entities based on video resources. Another example is that the names of various products can be determined as preset named entities based on product resources.
[0077] Among them, the word segmentation processing method can adopt any word segmentation processing method in the field of language text processing. The corresponding part of speech of the word segmentation can be a common noun, an entity noun, a verb, a particle, etc., which are not specifically limited here. Among them, an entity noun is a noun that can refer to a specific person or thing, which is not specifically limited here.
[0078] For example, when the search information to be processed is "Search for the TV drama 'Lights Up the City' starring James Harden", after word segmentation processing of this search information to be processed, the word segmentation result obtained is "Search / verb; James Harden / entity noun; Lights Up the City / entity noun; TV drama / common noun".
[0079] In one implementation, after word segmentation processing of the search information to be processed, the word segmentation in the word segmentation result may not have a part of speech. For example, when the search information to be processed is "tu Breakthrough", after word segmentation processing of this search information to be processed, the word segmentation result obtained is "tu / without part of speech, Breakthrough / entity noun".
[0080] In one implementation, since the target word segmentation that matches the preset named entity in terms of text features is generally an entity noun, the word segmentation with the part of speech of entity noun in the search information to be processed can be determined first, and then the target word segmentation that matches the preset named entity in terms of text features can be determined from the word segmentation with the part of speech of entity noun.
[0081] Furthermore, the electronic device can execute the above step S103 and the above step S104, that is, determine whether there is at least one text character in the text characters included in the target word segmentation and the text characters included in its adjacent word segmentation whose corresponding pinyin input methods are similar; if so, delete the adjacent word segmentation to obtain the processed search information.
[0082] Since after the user discovers that the wrong information has been entered, the user may directly enter the information that he really wants to search after this wrong information, and after entering the correct information that he really wants to search, no other information will be entered anymore. Therefore, in the search information to be processed, the wrong information is generally before the vocabulary that the user really wants to search. Of course, it cannot be excluded that the user will continue to enter a wrong vocabulary after entering the information that he really wants to search. Therefore, the above adjacent word segmentation includes the previous adjacent word segmentation and the subsequent adjacent word segmentation.
[0083] Therefore, the electronic device can determine whether there is at least one text character in the text characters included in the target word segment that has a similar pinyin input method to the text characters included in its adjacent word segment. If the pinyin input methods corresponding to two text characters are similar, it indicates that these two text characters are very likely to be the same character that the user wants to input, and are a correct text character and an incorrect text character due to pinyin input errors.
[0084] Then, if there is at least one text character in the text characters included in the target word segment that has a similar pinyin input method to the text characters included in its adjacent word segment, it indicates that this adjacent word segment is very likely an incorrect word segment input by the user for inputting the target word segment. Therefore, this adjacent word segment is a prefix noise or a suffix noise, that is, incorrect information input by the user. Therefore, the electronic device can delete this adjacent word segment to obtain the processed search information.
[0085] If not, it indicates that this adjacent word segment is not incorrect information input by the user. Therefore, the electronic device does not need to delete this adjacent word segment.
[0086] For example, the search information to be processed is "Harden, When the Lanterns Are First Lit, TV drama". "When the Lanterns Are First Lit" is the target word segment whose text features match the preset named entity (TV drama name). The electronic device can determine whether there is at least one text character in the text characters included in "When the Lanterns Are First Lit" that has a similar pinyin input method to the text characters included in "Harden" and "TV drama". Since the pinyin input methods corresponding to "When the Lanterns Are First Lit" and "Harden" are similar, it can be considered that "Harden" is a prefix noise, and the electronic device can delete "Harden" to obtain the processed search information, that is, "When the Lanterns Are First Lit, TV drama".
[0087] When the search information to be processed includes multiple target word segments, the electronic device can determine one by one whether there is at least one text character in the text characters included in the target word segment that has a similar pinyin input method to the text characters included in its adjacent word segment. In one implementation, in the order from front to back, for each target word segment arranged, it is determined one by one whether there is at least one text character in the text characters included in this target word segment that has a similar pinyin input method to the text characters included in its adjacent word segment, which will not be elaborated here.
[0088] In this way, the electronic device can determine the target segmentation in the search information to be processed, that is, the entity noun that the user wants to search for, and can also correct errors at the pinyin level of the text characters included in the segmentation, that is, the electronic device can delete the segmentation that the user mistakenly inputs, thereby determining the information that the user really wants to search for in the search information to be processed. Furthermore, when the subsequent electronic device searches based on the processed search information, compared with the method of correcting the search information only at the text level, the error correction scope can be expanded, and the accuracy of the search results can be improved, which is particularly suitable for searching for videos on video websites.
[0089] As an implementation method of the embodiment of the present invention, Figure 2 As shown, the step of determining whether there is at least one text character corresponding to a text character included in the target word and a text character included in an adjacent word that has a similar pinyin input method may include:
[0090] S201, determining a similar pinyin corresponding to the pinyin of the target word segment from a preset pinyin library according to the pinyin of the target word segment as a first similar pinyin;
[0091] Generally, the reasons why users input incorrect information may be: 1. The pinyin input by the user is correct, but the selected vocabulary is incorrect, resulting in incorrect vocabulary corresponding to the pinyin, which leads to incorrect information in the search information to be processed. 2. The pinyin input by the user is incorrect, including missing letters, extra letters, wrong letters, etc., which leads to incorrect information in the search information to be processed.
[0092] That is, the pinyin of the information incorrectly input by the user in the pending search information may be the same as the pinyin of the word that the user really wants to search in the pending search information, or individual letters may be different, that is, the pinyin input method of the text characters included in the information incorrectly input by the user is similar to the pinyin input method of the text characters included in the word that the user really wants to search. Therefore, in order to determine the word that the user really wants to search in the pending search information, the electronic device can determine the similar pinyin of the target word segmentation pinyin.
[0093] The electronic device can determine the similar pinyin corresponding to the pinyin of each text character in the target word segment from a preset pinyin library based on the pinyin of each text character in the target word segment. The preset pinyin library is pre-established and stores the corresponding relationship between each pinyin and its similar pinyin.
[0094] For example, for the entity noun "Huapi", its pinyin is "hua; pi". The electronic device can respectively determine the similar pinyins of "hua" and "pi" from a preset pinyin library, and obtain that the similar pinyin of "hua" is "kua", "fa", "ha", and the similar pinyin of "pi" is "bi", "qi".
[0095] After determining the similar pinyins corresponding to the target word segmentation, the electronic device can, according to the arrangement order of each text character in the target word segmentation, combine the pinyin of the first text character in the target word segmentation and the similar pinyin of the first text character with the pinyins of other text characters and the similar pinyins corresponding to other text characters respectively, so as to obtain the similar pinyin corresponding to the pinyin of the target word segmentation as the first similar pinyin.
[0096] For example, the electronic device can combine "hua" in "hua; pi" and the similar pinyins "kua", "fa", "ha" of "hua" with "pi" and the similar pinyins "bi", "qi" of "pi" respectively, and obtain 11 new pinyin combinations, which can include "hua; bi", "hua; qi", "kua; pi", "kua; bi", "kua; qi", "hu; pi", "hu; bi", "hu; qi", "ha; pi", "ha; bi", "ha; qi" as the first similar pinyin.
[0097] S202, determine the similar pinyin corresponding to the pinyin of the adjacent word segmentation of the target word segmentation from the preset pinyin library as the second similar pinyin;
[0098] The electronic device can determine the similar pinyin corresponding to the pinyin of each text character in the adjacent word segmentation from the preset pinyin library based on the pinyin of the adjacent word segmentation of the target word segmentation.
[0099] For example, the previous adjacent word segmentation of the target word segmentation "Huapi" is "Hupi", and its pinyin is "hu; pi". The electronic device can respectively determine the similar pinyins of "hu" and "pi" from the preset pinyin library, and obtain that the similar pinyin of "hu" is "hua", "bu", "pu", "ha", "ku", and the similar pinyin of "pi" is "bi", "qi".
[0100] After determining the similar pinyins corresponding to the above adjacent word segmentation, the electronic device can, according to the arrangement order of each text character in the adjacent word segmentation, combine the pinyin of the first text character in the adjacent word segmentation and the similar pinyin of the first text character with the pinyins of other text characters and the similar pinyins corresponding to other text characters in the adjacent word segmentation respectively, so as to obtain the similar pinyin corresponding to the pinyin of the adjacent word segmentation as the second similar pinyin.
[0101] For example, the electronic device can arrange and combine the "hu" in "hu;pi" and the similar pinyins of "hu", "hua", "bu", "pu", "ha", and "ku" with "pi" and the similar pinyins of "pi", "bi", and "qi", respectively, and obtain 17 new pinyin combinations, which may include: "hu;bi", "hu;qi", "hua;pi", "hua;bi", "hua;qi", "bu;pi", "bu;bi", "bu;qi", "pu;pi", "pu;bi", "pu;qi", "ha;pi", "ha;bi", "ha;qi", "ku;pi", "ku;bi", and "ku;qi" as the second similar pinyin.
[0102] S203, determining whether the pinyin of the target word segment, the first similar pinyin, the pinyin of the adjacent word segment, and the second similar pinyin have the same pinyin, and if so, executing step S204;
[0103] S204: Determine whether the text characters included in the target word segment and the text characters included in the adjacent word segment have at least one text character corresponding to a similar pinyin input method.
[0104] After determining the first similar pinyin and the second similar pinyin, the electronic device may determine whether the pinyin of the target word segment and the first similar pinyin are identical to the pinyin of the adjacent word segment and the second similar pinyin.
[0105] If it does not exist, it means that the pinyin input method of the adjacent word segmentation is quite different from that of the target word segmentation. Therefore, the electronic device can determine that the pinyin of the target word segmentation and its adjacent word segmentation are not similar, that is, the corresponding pinyin input methods of the text characters included in the target word segmentation and the text characters included in its adjacent word segmentation are not similar.
[0106] If it exists, it means that the pinyin input method of the adjacent word segment is the same as or very similar to the pinyin input method of the target word segment. Therefore, the electronic device can determine that the pinyin of the target word segment is similar to the pinyin of its adjacent word segment, that is, there is at least one text character included in the target word segment and the text characters included in its adjacent word segment, and the pinyin input method corresponding to the text character is similar.
[0107] For example, following the example of steps S201-S202 above, "hua;pi" and the first similar pinyin and "hu;pi" and the second similar pinyin have the same pinyin "hua;bi", "hua;qi", "hu;pi", "hu;bi", "hu;qi", "ha;pi", "ha;bi", "ha;qi", so the electronic device can determine that "hua;pi" is similar to "hu;pi".
[0108] It can be seen that in this embodiment, the electronic device can determine the similar pinyin corresponding to the pinyin of the target segmentation from the preset pinyin library according to the pinyin of the target segmentation, as the first similar pinyin, determine the similar pinyin corresponding to the pinyin of the adjacent segmentation from the preset pinyin library according to the pinyin of the adjacent segmentation, as the second similar pinyin, determine whether the pinyin of the target segmentation and the first similar pinyin and the pinyin of the adjacent segmentation and the second similar pinyin are the same pinyin, if so, it is determined that the text characters included in the target segmentation and the text characters included in the adjacent segmentation have at least one text character corresponding to the pinyin input method similar. Since the first similar pinyin is a pinyin very similar to the pinyin of the target segmentation, and the second preset pinyin is a pinyin very similar to the pinyin of the adjacent segmentation, if the same pinyin exists between the two, it means that the pinyin of the target segmentation is similar to the pinyin of the adjacent segmentation. In this way, the electronic device can more accurately determine whether the pinyin of the target segmentation and its adjacent segmentation are similar from the pinyin level, so as to facilitate the subsequent processed search information, thereby improving the accuracy of the search results.
[0109] As an implementation method of the embodiment of the present invention, Figure 3 As shown, the step of determining whether the pinyin of the target word segment and the first similar pinyin, the pinyin of the adjacent word segment and the second similar pinyin have the same pinyin may include:
[0110] S301, if the number of text characters included in the target word is greater than the number of text characters included in the adjacent word, intercept the same number of pinyins as the text characters included in the adjacent word from the pinyin of the target word and the first similar pinyin as the pinyin to be matched;
[0111] Since the target word segmentation may include a large number of text characters, the user may only type the first few text characters incorrectly when inputting, and directly input the correct target word segmentation after the first few text characters.
[0112] In this case, when the number of text characters included in the target word segment is greater than the number of text characters included in its adjacent word segment, the number of pinyins corresponding to all text characters in the target word segment is also greater than the number of pinyins corresponding to all text characters in the adjacent word segment. In this situation, the pinyins corresponding to the latter part of the target word segment do not need to be considered.
[0113] For example, the target word segment is "When Flowers Bloom in That Year, the Moon Is Full", and its adjacent word segment is "that side". There are 7 pinyins corresponding to all text characters in "When Flowers Bloom in That Year, the Moon Is Full", while there are only 2 pinyins corresponding to all text characters in "that side". Whether the pinyin of "Flowers Bloom, the Moon Is Full" in "When Flowers Bloom in That Year, the Moon Is Full" is the same as the pinyin of "that side" does not need to be considered.
[0114] Therefore, for the above situation, in order to determine whether the pinyin of the target word segment is similar to the pinyin of its adjacent word segment, the electronic device can intercept from the pinyin of the target word segment and the first similar pinyin the same number of pinyins as the number of pinyins of the text characters included in the adjacent word segment as the pinyins to be matched.
[0115] For example, there are two pinyins corresponding to "na;mian". The electronic device can intercept two pinyins from "na;nian;hua;kai;yue;zheng;yuan" to get "na;nian". Similarly, the electronic device can intercept the first two pinyins of each similar pinyin from the first similar pinyin of "When Flowers Bloom in That Year, the Moon Is Full" to obtain the pinyins to be matched.
[0116] S302. Determine whether there are the same pinyins among the pinyins to be matched, the pinyins of the adjacent word segment, and the second similar pinyins. If there are, then execute step S303;
[0117] S303. Determine that there are the same pinyins among the pinyins of the target word segment, the first similar pinyin, the pinyins of the adjacent word segment, and the second similar pinyins.
[0118] Furthermore, the electronic device can determine whether there are the same pinyins among the pinyins to be matched, the pinyins of the adjacent word segment, and the second similar pinyins. If not, it means that the difference between the pinyins of the above adjacent word segment and the pinyins to be matched is relatively large. Therefore, the electronic device can determine that the pinyin of the target word segment is not similar to the pinyin of its adjacent word segment, that is, among the text characters included in the target word segment and the text characters included in its adjacent word segment, there are no text characters with similar pinyin input methods.
[0119] If it exists, it means that the pinyin of the above-mentioned adjacent word segmentation is the same as or very similar to the pinyin of the target word segmentation. Therefore, the electronic device can determine that the pinyin of the target word segmentation is similar to the pinyin of its adjacent word segmentation, that is, there is at least one text character included in the target word segmentation and the text characters included in its adjacent word segmentation, and the pinyin input method corresponding to the text characters is similar.
[0120] It can be seen that in this embodiment, if the number of text characters included in the target segmentation is greater than the number of text characters corresponding to the adjacent segmentation, the same number of pinyins as the number of text characters included in the adjacent segmentation can be intercepted from the pinyin of the target segmentation and the first similar pinyin as the pinyin to be matched, and it is determined whether the pinyin to be matched, the pinyin of the adjacent segmentation and the second similar pinyin are the same. If so, it is determined that the pinyin of the target segmentation is similar to the pinyin of its adjacent segmentation. In this way, for the case where the number of text characters included in the target segmentation is greater than the number of text characters included in the adjacent segmentation, the electronic device can also accurately determine whether the pinyin of the target segmentation and its adjacent segmentation are similar from the pinyin level, so as to facilitate the subsequent processed search information, thereby improving the accuracy of the search results.
[0121] As an implementation mode of an embodiment of the present invention, if the number of text characters included in a target word segment is greater than the number of text characters included in its adjacent word segment, the electronic device may, before determining the first similar pinyin, intercept the same number of pinyins as the number of text characters included in the adjacent word segment from the pinyin of the target word segment as the pinyin to be determined.
[0122] Furthermore, the electronic device can determine the similar pinyin corresponding to the pinyin of each text character in the pinyin to be determined from the above-mentioned preset pinyin library as the first similar pinyin based on the pinyin of each text character in the pinyin to be determined. Based on the pinyin of each text character in the above-mentioned adjacent segmented words, the similar pinyin corresponding to the pinyin of each text character in the adjacent segmented words is determined from the preset pinyin library as the second similar pinyin. Furthermore, the electronic device can determine whether the pinyin to be determined and the first similar pinyin have the same pinyin as the pinyin of the adjacent segmented words and the second similar pinyin. If so, it can be determined that the pinyin of the target segmented word is similar to the pinyin of its adjacent segmented words.
[0123] It can be seen that in this embodiment, for the case where the number of text characters included in the target word segmentation is greater than the number of text characters included in the adjacent word segmentation, the electronic device can first intercept the same number of pinyins as the number of pinyins of the text characters included in the adjacent word segmentation from the target word segmentation as the pinyins to be determined, and then determine the similar pinyins of the pinyins to be determined. In this way, the number of similar pinyins to be determined can be reduced, and it can be determined more quickly and accurately whether the pinyins of the target word segmentation and its adjacent word segmentation are similar, so as to facilitate the subsequent processed search information, thereby improving the search efficiency.
[0124] As an implementation method of the embodiment of the present invention, Figure 4 As shown, the method for establishing the above-mentioned preset pinyin library may include:
[0125] S401, obtaining the pinyin corresponding to each text;
[0126] The electronic device can obtain the pinyin corresponding to each text in Chinese. For example, the electronic device can obtain the pinyin corresponding to each Chinese character in the dictionary. Since the user does not enter the scale corresponding to the pinyin when entering the search information to be processed, the electronic device does not need to consider the scale of each pinyin when obtaining the pinyin corresponding to each text. For example, the electronic device can obtain the pinyin corresponding to "breakthrough", which is "tu;wei".
[0127] S402, marking similar pinyins of each pinyin according to the number of pinyin characters and the edit distance between every two pinyins;
[0128] The number of pinyin characters included in a pinyin is the number of characters that make up the pinyin. For example, the pinyin characters included in the pinyin "shou" are s, h, o and u, and the number of pinyin characters is 4. The pronunciation of a pinyin may include plosives, nasals, fricatives, affricates, etc. For example, b; p; d; t are plosives, m; n are nasals, and f; v; z; r are fricatives. There is no specific limitation here. Edit distance is a quantitative measure of the degree of difference between two character strings. The standard of the measurement method is how many times it takes to transform one character string into another.
[0129] For two pinyins, the edit distance is the number of times the pinyin characters of a pinyin are added, deleted, modified, etc. to become another pinyin. The smaller the edit distance, the more similar the two pinyins are. For example, the pinyin "sui; shou" is modified from "sui" to "d" to get "dui; shou", that is, the pinyin "sui; shou" is modified once to get "dui; shou", so the edit distance is 1.
[0130] In one embodiment, the electronic device can mark pinyins with similar pronunciations and pinyins with an editing distance less than a preset threshold as similar pinyins, where the preset threshold is set according to different pinyin lengths, for example, it can be 1, 2, 3, etc., and is not specifically limited here.
[0131] Specifically, the electronic device can determine whether the pronunciation is similar by whether the initial consonants or final vowels of the pinyin are the same. For example, "hu" and "ku" have different initial consonants but the same final vowels, so "hu" and "ku" can be marked as similar pinyin.
[0132] In another embodiment, the electronic device can mark similar pinyins of each pinyin according to the number of pinyin characters and the edit distance between each two pinyins. Specifically, for each two pinyins, if the two pinyins meet one of the following conditions, the two pinyins can be determined to be similar pinyins.
[0133] The first condition is that the two pinyins have the same number of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0. The same number of pinyin characters included in the two pinyins indicates that the two pinyins are similar in spelling, and the existence of at least one pair of pinyin characters whose corresponding edit distance is not 0 indicates that the two pinyins are not exactly the same.
[0134] For example, for the pinyin "hua" and "kua", the number of pinyin characters included in the two pinyins is the same, 3, where the edit distance between h and k is 1, that is, there is a pair of pinyin characters whose corresponding edit distance is not 0. Therefore, "hua" and "kua" are similar pinyins.
[0135] The second condition is that the two pinyins have different numbers of pinyin characters, and the pinyin characters included in one pinyin include all the pinyin characters included in the other pinyin. In the case where the two pinyins have different numbers of pinyin characters, if the pinyin characters included in one pinyin include all the pinyin characters included in the other pinyin, the two pinyins can also be considered similar.
[0136] For example, for the pinyins "hua" and "ha", the number of pinyin characters included in the two pinyins is 3 and 2 respectively, that is, the number of pinyin characters included in the two pinyins is different, but because "hua" includes all the pinyin characters included in "ha", "hua" and "ha" are similar pinyins.
[0137] The third condition is that the two pinyins have different numbers of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0. In the case where the two pinyins have different numbers of pinyin characters, if among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0, the two pinyins can also be considered to be similar pinyins.
[0138] For example, for the pinyins "hua" and "fa", the number of pinyin characters included in the two pinyins is 3 and 2 respectively, that is, the number of pinyin characters included in the two pinyins is different, but since the edit distance between h and f is 1, that is, among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0, so "hua" and "fa" are similar pinyins.
[0139] S403, recording each pinyin and its corresponding similar pinyin in correspondence to obtain the preset pinyin library.
[0140] After obtaining the similar pinyins of each pinyin, each pinyin and its corresponding similar pinyin can be recorded in correspondence to obtain a preset pinyin library. In this way, in the subsequent process of determining similar pinyins, the similar pinyins of the target word and its adjacent word parts can be determined based on the pinyin of the vocabulary and the correspondence between each pinyin and its corresponding similar pinyin.
[0141] For example, the preset pinyin library obtained by the electronic device may be shown in the following table:
[0142] Serial number Pinyin Similar Pinyin 1 hu "hua", "bu", "pu", "ha", "ku" 2 pi "bi", "qi" … … … N ma "na", "wa", "ga"
[0143] It can be seen that in this embodiment, the electronic device can obtain the pinyin corresponding to each text, mark the similar pinyin of each pinyin according to the number of pinyin characters and the edit distance between each two pinyins, record each pinyin and its corresponding similar pinyin, and obtain a preset pinyin library. In this way, the electronic device can establish a preset audio library to facilitate the subsequent determination of similar pinyins, thereby facilitating the subsequent processing of search information, thereby further improving the search efficiency.
[0144] As an implementation method of the embodiment of the present invention, Figure 5 As shown, before the step of determining whether there is at least one text character in the text characters included in the target segmentation and the text characters included in the adjacent segmentation whose corresponding pinyin input mode is similar, the method may further include:
[0145] S501, inputting the part-of-speech entity noun segmentation included in the search information to be processed into a pre-trained entity noun recognition model to determine the named entity category to which the segmentation belongs;
[0146] In order to accurately and quickly determine whether a participle whose part of speech is an entity noun is a participle of a preset named entity category, the electronic device can input the part of speech of the entity noun included in the search information to be processed into a pre-trained entity noun recognition model. The entity noun recognition model can recognize a specific type of participle, namely, a named entity category from the participle set. In other words, the entity noun recognition model can output the category to which the participle belongs, and the electronic device can determine the named entity category to which each participle belongs.
[0147] Among them, named entities are names of people, names of organizations, names of places, and all other entities identified by names. More extensive entities may also include numbers, dates, currencies, addresses, etc. The entity recognition model may be any model that can perform entity recognition, for example, it may be a CRF (Conditional Random Field) model, an HMM (HiddenMarkov Model), a Maximum Entropy model, etc.
[0148] Named entity categories can be movies, TV series, documentaries, variety shows, music, products, news, actors, roles, popular words, etc. When the input word belongs to the named entity category, it means that the word may be the entity name corresponding to the information the user wants to search for, that is, it can be the vocabulary corresponding to the video resources on the website, the name of the product sold, the keyword of the news, etc.
[0149] S502: Determine a word segmentation whose named entity category is a preset named entity category as a target word segmentation.
[0150] The electronic device can determine that the named entity category to which the participle belongs is a category of the preset named entity, and its text features match the preset named entity. That is to say, when the named entity category to which the participle belongs is a category of the preset named entity, the website can provide the resources corresponding to the participle, and the corresponding search results can be searched, so the participle is the target participle.
[0151] It can be seen that in this embodiment, the electronic device can input the part-of-speech entity noun segmentation included in the search information to be processed into the pre-trained entity noun recognition model, determine the named entity category to which the segmentation belongs, and determine the segmentation whose named entity category is the category of the preset named entity as the target segmentation. In this way, the target segmentation can be accurately determined to facilitate the subsequent improvement of the accuracy of the search results.
[0152] As an implementation manner of an embodiment of the present invention, the above step of performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed may include:
[0153] The electronic device can input the search information to be processed into a pre-trained word segmentation model to perform word segmentation on the search information to be processed, and the word segmentation model can output the word segments included in the search information to be processed, and can also output the parts of speech corresponding to the word segments. The word segmentation model can be any model that can segment text, for example, it can be a perceptron model, a maximum entropy model, a CRF model, etc., which is not specifically limited here.
[0154] For example, when the electronic device inputs the search information to be processed "search for Breakout TV series" into a pre-trained word segmentation model, it can determine the participles and the parts of speech corresponding to the participles included in the search information to be processed, specifically "search / verb; Breakout / entity noun; TV series / common noun".
[0155] It can be seen that in this embodiment, the electronic device can input the search information to be processed into the pre-trained word segmentation model to perform word segmentation processing on the search information to be processed, and determine the word segments and the parts of speech corresponding to the word segments included in the search information to be processed. In this way, the electronic device can obtain the word segments and the parts of speech corresponding to the word segments in the search information to be processed, so as to perform error correction on the search information to be processed later.
[0156] As an implementation method of an embodiment of the present invention, the entity noun recognition model and the word segmentation model can be trained using any training method in the field of model training, as long as the corresponding model can be trained. In one implementation method, historical search records can be obtained, and the entity noun recognition model and the word segmentation model can be trained based on various information included in the historical search records.
[0157] For example, the training method of the entity noun recognition model can be: obtain a vocabulary sample whose part of speech is entity noun and an initial model, use the category corresponding to each word in the vocabulary sample as the sample label, input the vocabulary whose part of speech is entity noun into the initial model, obtain the category corresponding to each word, use the category corresponding to each word as the prediction result, and based on the difference between the prediction result and the sample label, use the gradient descent algorithm or the stochastic gradient descent algorithm to adjust the model parameters of the initial model until the initial model converges, thereby obtaining the entity noun recognition model.
[0158] As an implementation method of the embodiment of the present invention, Figure 6 As shown, after the above step of deleting the adjacent word segments to obtain processed search information, the method may further include:
[0159] S601, determining semantic scores of the search information to be processed and the processed search information according to the semantics of the search information to be processed and the semantics of the processed search information respectively;
[0160] Since there may be errors in the word segmentation model and the entity recognition model, the processed search information may not be the information the user actually wants to search for. Therefore, in order to improve the search accuracy, the electronic device can determine the semantic scores of the search information to be processed input by the user and the processed search information based on the semantics of the search information to be processed input by the user and the semantics of the processed search information, respectively.
[0161] In one embodiment, the electronic device can input the to-be-processed search information input by the user and the processed search information into the n-gram model respectively. Since the n-gram model is based on an assumption that the probability of the Nth word appearing is only related to the previous N-1 words, but not to other words, the probability of the whole sentence appearing is the probability of each word appearing in the sentence, thereby determining whether the semantics are smooth and obtaining a semantic score. Therefore, the n-gram model can output the semantic scores of the to-be-processed search information input by the user and the processed search information.
[0162] S602, respectively determining the search times corresponding to the search information to be processed and the search information after processing;
[0163] Since the higher the search times corresponding to the search information, the higher the possibility that the search information is a word corresponding to a resource in the website, the electronic device can respectively determine the search times corresponding to the search information to be processed input by the user and the processed search information.
[0164] S603, respectively determining the number of search results corresponding to the search information to be processed and the search information after processing;
[0165] Since the more video search results corresponding to the search information, the higher the possibility that the search information is a word corresponding to the resources in the website, the electronic device can respectively determine the number of search results corresponding to the search information to be processed input by the user and the processed search information.
[0166] S604, calculating an error correction score based on the semantic score, the number of searches, and the number of search results;
[0167] After obtaining the semantic score, the number of searches, and the number of search results, the electronic device may calculate the error correction scores corresponding to the search information to be processed and the processed search information input by the user. In one embodiment, the electronic device may multiply the semantic score, the number of searches, and the number of search results by corresponding weight values, respectively, to obtain the error correction score.
[0168] For example, the weight corresponding to the semantic score is 0.2, the weight corresponding to the number of searches is 0.4, and the weight corresponding to the number of search results is 0.4. The semantic score of the search information to be processed entered by the user is 50, the number of searches is 100, and the number of search results is 50. The semantic score of the processed search information is 90, the number of searches is 200, and the number of search results is 100. Then, the error correction score corresponding to the search information to be processed entered by the user is 60, and the error correction score corresponding to the processed search information is 138.
[0169] S605: Determine whether to use the processed search information to perform video search based on the error correction score.
[0170] After obtaining the error correction score, the electronic device can determine whether to use the processed search information for video search based on the error correction score. When the number of searches and the number of search results are not significantly different, if the error correction score of the processed search information is greater than the error correction score of the search information to be processed input by the user, the electronic device can use the processed search information for search. If the error correction score of the processed search information is not greater than the error correction score of the search information to be processed input by the user, the electronic device can use the search information to be processed input by the user for search.
[0171] For example, following the example of step S605 above, the error correction score of the processed search information is greater than the error correction score of the search information to be processed input by the user, so the electronic device can use the processed search information to perform video search.
[0172] It can be seen that in this embodiment, the semantic scores of the search information to be processed and the processed search information are determined according to the semantics of the search information to be processed and the semantics of the processed search information, the search times corresponding to the search information to be processed and the processed search information are determined, and the number of search results corresponding to the search information to be processed and the processed search information are determined. Based on the semantic score, the search times and the number of search results, the error correction score is calculated, and based on the error correction score, it is determined whether to use the processed search information for search. In this way, the electronic device can determine whether to use the processed search information for search based on the three aspects of the semantic score, the search times and the number of search results. Compared with the current method of only considering the gap between the search information before and after error correction to determine whether to use the search information after error correction, the error correction coverage is greater, thereby improving the accuracy of the search results.
[0173] As an implementation method of an embodiment of the present invention, when the number of searches corresponding to the processed search information is much greater than the number of searches corresponding to the search information to be processed, it means that the processed search information is more likely to be a vocabulary corresponding to the resources in the website. Therefore, the electronic device may not determine the semantic score and the number of search results, and directly use the processed search information for searching.
[0174] It can be seen that in this embodiment, the electronic device can more quickly determine whether to use the processed search information to perform video search, thereby improving search efficiency.
[0175] As an implementation method of an embodiment of the present invention, when the number of search results corresponding to the processed search information is much larger than the number of search results corresponding to the search information to be processed, it means that the processed search information is more likely to be the vocabulary corresponding to the resources in the website. Therefore, the electronic device may not determine the semantic score and the number of searches, and directly use the processed search information for searching.
[0176] It can be seen that in this embodiment, the electronic device can more quickly determine whether to use the processed search information for searching, thereby improving search efficiency.
[0177] As an implementation of the embodiment of the present invention, the above method may further include:
[0178] If it is determined to use the processed search information for search, then a search is performed based on the processed search information to obtain search results; if it is determined not to use the processed search information for search, then a search is performed based on the search information to be processed to obtain search results.
[0179] If the electronic device determines to use the processed search information for the search, it means that the processed search information is the search information that the user actually wants to input. Therefore, the electronic device can search based on the processed search information and obtain search results, that is, the resources that the user wants to search for.
[0180] If the electronic device determines not to use the processed search information for searching, it means that the processed search information is not the search information that the user actually wants to input, and the search information to be processed input by the user is the search information that the user actually wants to input. Therefore, the electronic device can search based on the search information that the user actually wants to input, and then obtain search results, that is, the resources that the user wants to search for.
[0181] It can be seen that in this embodiment, if it is determined to use the processed search information for search, then the search is performed based on the processed search information to obtain search results, and if it is determined not to use the processed search information for search, then the search is performed based on the unprocessed search information input by the user to obtain search results. In this way, no matter in which case, the electronic device can use accurate search information for search, thereby improving the accuracy of search results and obtaining search results that the user really wants to search.
[0182] Combine the following Figure 7 A method for processing search information provided by an embodiment of the present invention is introduced by way of example, wherein the description is made by taking an adjacent segmentation as the preceding adjacent segmentation of a target segmentation.
[0183] S701, obtaining search information to be processed;
[0184] S702, performing word segmentation processing on the search information to be processed to obtain the word segments and the parts of speech corresponding to the word segments included in the search information to be processed;
[0185] Among them, only the part of speech of the second participle in the search information to be processed is an entity noun.
[0186] S703, determining whether the second segmented word in the search information to be processed is the target segmented word; if not, executing step S704; if yes, executing step S705;
[0187] The target word segmentation is the word segmentation whose text features match the preset named entity.
[0188] S704, do not correct the pending search information;
[0189] S705, determining a similar pinyin corresponding to the pinyin of the second participle from a preset pinyin library as a first similar pinyin, and determining a similar pinyin corresponding to the pinyin of the first participle from the preset pinyin library as a second similar pinyin according to the pinyin of the first participle;
[0190] S706, determining whether the second participle's pinyin and the first similar pinyin have the same pinyin as the first participle's pinyin and the second similar pinyin; if not, executing step S704; if so, executing step S707;
[0191] S707, deleting the first word to obtain processed search information;
[0192] S708, respectively obtaining semantic scores, search times, and the number of search results of the processed search information and the search information to be processed, and respectively calculating error correction scores of the processed search information and the search information to be processed based on the semantic scores, search times, and the number of search results;
[0193] S709, based on the error correction score, determine whether to use the processed search information for searching; if so, execute step S710; if not, execute step S711;
[0194] S710, performing a search based on the processed search information to obtain search results;
[0195] S711, searching based on the search information to be processed to obtain search results.
[0196] It can be seen that in this embodiment, the electronic device can perform error correction at the pinyin level of the search information to be processed to obtain processed search information, and then select more accurate search information for search, thereby improving the accuracy of search results.
[0197] Corresponding to the above-mentioned method for processing search information, an embodiment of the present invention further provides a device for processing search information. The following is an introduction to a device for processing search information provided by an embodiment of the present invention:
[0198] like Figure 8 As shown, a device for processing search information may include:
[0199] An acquisition module 810 is used to acquire search information to be processed;
[0200] A word segmentation module 820, configured to perform word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed;
[0201] The first determination module 830 is used to determine whether there is a text character included in the target word and a text character included in an adjacent word, and whether there is at least one text character corresponding to the text character having a similar pinyin input mode;
[0202] The target word segmentation is a word segmentation whose text features match a preset named entity.
[0203] The deletion module 840 is used to delete the adjacent word segments if they exist, so as to obtain processed search information.
[0204] It can be seen that in the scheme provided by the embodiment of the present invention, the electronic device can obtain the search information to be processed, perform word segmentation processing on the search information to be processed, obtain the vocabulary included in the search information to be processed, and then determine whether there is at least one text character corresponding to the text character included in the target word segmentation and the text character included in the adjacent word segmentation. The target word segmentation is a word segmentation whose text feature matches the preset named entity. If it exists, the adjacent word segmentation is deleted to obtain the processed search information. Through the above scheme, the electronic device can determine the target word segmentation whose text feature matches the preset named entity in the search information, that is, the name of the preset entity that the user is likely to want to search for, and can also correct errors from the pinyin level of the word segmentation, that is, the adjacent word segmentation whose pinyin input method corresponding to the included text character is similar to the pinyin input method corresponding to the text character included in the target word segmentation. In this way, the electronic device can delete the search information that the user mistakenly inputs, thereby determining the information that the user really wants to search in the search information. Furthermore, when the subsequent electronic device searches based on the processed search information, compared with the method of correcting the search information only from the text level, the accuracy of the search results can be improved.
[0205] As an implementation of the embodiment of the present invention, the first determining module 830 may include:
[0206] A first determining unit is used to determine, according to the pinyin of the target word segment, a similar pinyin corresponding to the pinyin of the target word segment from a preset pinyin library as a first similar pinyin;
[0207] The preset pinyin library stores the corresponding relationship between each pinyin and its similar pinyin.
[0208] A second determining unit is used to determine, from the preset pinyin library, a similar pinyin corresponding to the pinyin of the adjacent segmented word of the target segmented word as a second similar pinyin;
[0209] A third determining unit is used to determine whether the pinyin of the target word segment and the first similar pinyin have the same pinyin as the pinyin of the adjacent word segment and the second similar pinyin;
[0210] The fourth determining unit is used to determine, if any, that at least one of the text characters included in the target word segment and the text characters included in its adjacent word segment has a similar pinyin input method.
[0211] As an implementation manner of the embodiment of the present invention, the third determining unit may include:
[0212] A interception subunit is used for intercepting the same number of pinyins as the number of text characters included in the adjacent word from the pinyin of the target word and the first similar pinyin as the pinyin to be matched if the number of text characters included in the target word is greater than the number of text characters included in the adjacent word;
[0213] A first determination subunit is used to determine whether the pinyin to be matched, the pinyin of the adjacent word segmentation, and the second similar pinyin have the same pinyin;
[0214] The second determining subunit is used to determine whether the same pinyin exists among the pinyin of the target word segment and the first similar pinyin and the pinyin of the adjacent word segment and the second similar pinyin, if any.
[0215] As an implementation of an embodiment of the present invention, the above-mentioned device further includes a module for establishing a preset audio library, and the module for establishing the preset pinyin library may include:
[0216] An acquisition unit, used to acquire the pinyin corresponding to each text;
[0217] A marking unit, used for marking similar pinyins of each pinyin according to the number of pinyin characters and the edit distance between every two pinyins;
[0218] The recording unit is used to record each pinyin and its corresponding similar pinyin in correspondence to obtain the preset pinyin library.
[0219] As an implementation manner of an embodiment of the present invention, the above-mentioned labeling unit may include:
[0220] The marking subunit is used to determine that, for each two pinyins, the two pinyins are similar if the two pinyins meet one of the following conditions:
[0221] The two pinyins include the same number of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0;
[0222] The two pinyins include different numbers of pinyin characters, and the pinyin characters included in one pinyin include all the pinyin characters included in the other pinyin;
[0223] The two pinyins include different numbers of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0.
[0224] As an implementation of the embodiment of the present invention, the above device may further include:
[0225] A second determination module is used to input a segmentation whose part of speech is an entity noun included in the search information to be processed into a pre-trained entity noun recognition model to determine the named entity category to which the segmentation belongs before determining whether there is at least one text character corresponding to the pinyin input method similar between the text characters included in the target segmentation and the text characters included in its adjacent segmentation;
[0226] The third determination module is used to determine a segmentation whose named entity category is a preset named entity category as a target segmentation.
[0227] As an implementation of an embodiment of the present invention, the above-mentioned word segmentation module 820 may include:
[0228] The word segmentation unit is used to input the search information to be processed into a pre-trained word segmentation model to perform word segmentation processing on the search information to be processed, and determine the word segments included in the search information to be processed and the parts of speech corresponding to the word segments.
[0229] As an implementation of the embodiment of the present invention, the above device may further include:
[0230] A fourth determination module is used to determine the semantic scores of the search information to be processed and the processed search information according to the semantics of the search information to be processed and the semantics of the processed search information respectively after the adjacent segmented words are deleted to obtain the processed search information;
[0231] A fifth determining module, used to respectively determine the search times corresponding to the search information to be processed and the search information after processing;
[0232] A sixth determination module, used to determine the number of search results corresponding to the search information to be processed and the processed search information respectively;
[0233] A calculation module, used for calculating an error correction score based on the semantic score, the number of searches and the number of search results;
[0234] A seventh determination module is used to determine whether to use the processed search information for searching based on the error correction score.
[0235] As an implementation of the embodiment of the present invention, the above device may further include:
[0236] an eighth determination module, configured to, if it is determined to use the processed search information for search, perform search based on the processed search information to obtain search results;
[0237] The ninth determination module is used to search based on the search information to be processed to obtain search results if it is determined that the processed search information is not to be used for search.
[0238] 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.
[0239] Memory 903, used for storing computer programs;
[0240] The processor 901 is used to implement the method steps of the above-mentioned method for processing search information when executing the program stored in the memory 903.
[0241] It can be seen that in the scheme provided by the embodiment of the present invention, the electronic device can obtain the search information to be processed, perform word segmentation processing on the search information to be processed, obtain the vocabulary included in the search information to be processed, and then determine whether there is at least one text character corresponding to the text character included in the target word segmentation and the text character included in the adjacent word segmentation. The target word segmentation is a word segmentation whose text feature matches the preset named entity. If it exists, the adjacent word segmentation is deleted to obtain the processed search information. Through the above scheme, the electronic device can determine the target word segmentation whose text feature matches the preset named entity in the search information, that is, the name of the preset entity that the user is likely to want to search for, and can also correct errors from the pinyin level of the word segmentation, that is, the adjacent word segmentation whose pinyin input method corresponding to the included text character is similar to the pinyin input method corresponding to the text character included in the target word segmentation. In this way, the electronic device can delete the search information that the user mistakenly inputs, thereby determining the information that the user really wants to search in the search information. Furthermore, when the subsequent electronic device searches based on the processed search information, compared with the method of correcting the search information only from the text level, the accuracy of the search results can be improved.
[0242] 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.
[0243] The communication interface is used for communication between the above electronic device and other devices.
[0244] 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.
[0245] 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.
[0246] 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. When the computer program is executed by a processor, a method for processing search information described in any of the above embodiments is implemented.
[0247] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes a method for processing search information described in any one of the above embodiments.
[0248] 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.
[0249] 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.
[0250] 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 devices, electronic devices, computer-readable storage media, and computer program products, 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.
[0251] 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 method for processing search information, characterized in that: The method comprises: Get pending search information; Performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed; Determine whether there is at least one text character in a target segmentation whose text features match a preset named entity and whose pinyin input mode is similar to that of the text characters in the adjacent segmentation. If it exists, the adjacent word segmentation is deleted to obtain the processed search information; The step of determining whether there is at least one text character in the target segmentation and the text characters in the adjacent segmentation whose corresponding pinyin input mode is similar includes: Determine, according to the pinyin of the target word segment, a similar pinyin corresponding to the pinyin of the target word segment from a preset pinyin library as a first similar pinyin, wherein the preset pinyin library stores a correspondence between each pinyin and its similar pinyin; Determine, from the preset pinyin library, a similar pinyin corresponding to the pinyin of the adjacent segmented word of the target segmented word, as a second similar pinyin; Determine whether the pinyin of the target word and the first similar pinyin and the pinyin of the adjacent word and the second similar pinyin have the same pinyin; If so, it is determined that at least one of the text characters included in the target word segment and the text characters included in the adjacent word segment has a similar pinyin input method.
2. The method according to claim 1, characterized in that The step of determining whether the pinyin of the target word segment and the first similar pinyin have the same pinyin as the pinyin of the adjacent word segment and the second similar pinyin comprises: If the number of text characters included in the target word is greater than the number of text characters included in the adjacent word, the same number of pinyins as the text characters included in the adjacent word are intercepted from the pinyin of the target word and the first similar pinyin as the pinyin to be matched; Determine whether the pinyin to be matched, the pinyin of the adjacent word segmentation, and the second similar pinyin have the same pinyin; If so, it is determined that the same pinyin exists among the pinyin of the target word segment and the first similar pinyin and the pinyin of the adjacent word segment and the second similar pinyin.
3. The method according to claim 1, characterized in that: The method for establishing the preset pinyin library includes: Get the pinyin corresponding to each text; According to the number of pinyin characters and the edit distance between every two pinyins, the similar pinyins of each pinyin are marked; Each pinyin is recorded in correspondence with its corresponding similar pinyin to obtain the preset pinyin library.
4. The method according to claim 3, characterized in that The step of marking similar pinyins of each pinyin according to the number of pinyin characters and the edit distance between every two pinyins comprises: For each two pinyins, if the two pinyins meet one of the following conditions, the two pinyins are determined to be similar pinyins: The two pinyins include the same number of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0; The two pinyins include different numbers of pinyin characters, and the pinyin characters included in one pinyin include all the pinyin characters included in the other pinyin; The two pinyins include different numbers of pinyin characters, and among the pinyin characters included in the two pinyins, there is at least one pair of pinyin characters whose corresponding edit distance is not 0.
5. The method according to claim 1, characterized in that The step of performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed includes: The search information to be processed is input into a pre-trained word segmentation model to perform word segmentation processing on the search information to be processed, and the word segments included in the search information to be processed and the parts of speech corresponding to the word segments are determined.
6. The method according to claim 5, characterized in that Before the step of determining whether at least one text character included in the target segmentation and the text characters included in its adjacent segmentation has a similar pinyin input mode, the method further includes: Inputting the part-of-speech entity noun segmentation included in the search information to be processed into a pre-trained entity noun recognition model to determine the named entity category to which the segmentation belongs; Determine the word segmentation whose named entity category is the category of the preset named entity as the target word segmentation.
7. The method according to any one of claims 1 to 6, characterized in that: After the step of deleting the adjacent segmented words to obtain processed search information, the method further includes: Determining semantic scores of the search information to be processed and the search information after processing according to the semantics of the search information to be processed and the semantics of the search information after processing respectively; Determine the search times corresponding to the search information to be processed and the search information after processing respectively; Determining the number of search results corresponding to the search information to be processed and the search information after processing respectively; Calculate an error correction score based on the semantic score, the number of searches, and the number of search results; Based on the error correction score, it is determined whether to use the processed search information for searching.
8. The method according to claim 7, characterized in that The method further comprises: If it is determined to use the processed search information for searching, searching based on the processed search information to obtain search results; If it is determined not to use the processed search information for searching, a search is performed based on the search information to be processed to obtain search results.
9. A search information processing device, characterized in that: The device comprises: An acquisition module, used to acquire search information to be processed; A word segmentation module, used for performing word segmentation processing on the search information to be processed to obtain the word segments included in the search information to be processed; A first determination module is used to determine whether there is a text character included in a target segmentation and a text character included in an adjacent segmentation, and whether there is at least one text character corresponding to the text character having a similar pinyin input mode, wherein the target segmentation is a segmentation whose text feature matches a preset named entity; A deletion module, used for deleting the adjacent word segments if they are similar, to obtain processed search information; Wherein, the first determining module includes: A first determining unit is used to determine, according to the pinyin of the target word segment, a similar pinyin corresponding to the pinyin of the target word segment from a preset pinyin library as a first similar pinyin; The preset pinyin library stores the corresponding relationship between each pinyin and its similar pinyin; A second determining unit is used to determine, from the preset pinyin library, a similar pinyin corresponding to the pinyin of the adjacent segmented word of the target segmented word as a second similar pinyin; A third determination unit is used to determine whether the pinyin of the target word segment and the first similar pinyin have the same pinyin as the pinyin of the adjacent word segment and the second similar pinyin; The fourth determining unit is used to determine, if any, that at least one of the text characters included in the target word segment and the text characters included in its adjacent word segment has a similar pinyin input method.
10. 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 8 when executing a program stored in a memory.
11. 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 8 are implemented.
Citation Information
Patent Citations
Artificial intelligence based voice searching method and device
CN106570180A
Handheld electronic device with text disambiguation
SG128014A1