A keyword matching method, an electronic device cluster, and a program product
By splitting and encrypting the text to be matched based on the length of the search word group, encrypted keywords and search word groups are generated, which solves the problems of low data security and efficiency in encrypted keyword matching and achieves efficient and secure keyword matching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-11-29
- Publication Date
- 2026-05-29
Smart Images

Figure CN122113915A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a keyword matching method, an electronic device cluster, and a program product. Background Technology
[0002] Keyword matching involves searching and matching within the input text to determine whether the text contains keywords.
[0003] However, in some application scenarios, due to data security requirements, keywords cannot be stored directly in plaintext on electronic devices and need to be encrypted. Therefore, a keyword matching method is needed to perform keyword matching based on encrypted keywords to confirm whether the input text contains the keywords. Summary of the Invention
[0004] To address the problem of how to perform keyword matching based on encrypted keywords, this application provides a keyword matching method, an electronic device cluster, and a program product. This application also provides a computer-readable storage medium.
[0005] To avoid omissions in keyword matching and reduce the time and data processing volume, the keyword matching method in this embodiment generates search word groups (each search word group includes one or more characters) based on keywords, with the length of the search word group being a preset value. Both keywords and search word groups are then encrypted to generate encrypted keywords and encrypted search word groups.
[0006] When performing keyword matching, the text to be matched is first split based on the length of the search term group, and the split results are matched with the encrypted search terms. After the text to be matched matches the encrypted search terms, the text to be matched is split again based on the length of the keyword, and the split results are matched with the encrypted keywords.
[0007] Specifically, the embodiments of this application adopt the following technical solutions:
[0008] Firstly, this application provides a keyword matching method, applied to electronic devices, the method comprising:
[0009] Extract all consecutive characters that meet the index group length from the text to be matched, and generate one or more groups of characters to be retrieved, wherein the index group length is a preset value;
[0010] Based on the first confidentiality processing method, one or more groups of characters to be retrieved are confidentialized to generate one or more ciphertext search groups. The first confidentiality processing method is the confidentiality processing method for generating ciphertext search groups. The ciphertext search groups are the data generated by confidentializing the search groups. The search groups are continuous characters extracted from the keywords according to the length of the index groups.
[0011] Match one or more ciphertext search words with ciphertext index words;
[0012] When a ciphertext search word group that matches the ciphertext index word group exists, obtain the length of one or more keywords;
[0013] Extract consecutive characters that meet the length of one or more keywords from the text to be matched, and generate one or more groups of characters to be matched;
[0014] Based on the second confidentiality processing method, one or more groups of characters to be matched are confidentialized to generate one or more ciphertext matching groups. The second confidentiality processing method is the confidentiality processing method for generating ciphertext keywords, and the ciphertext keywords are the data generated by confidentializing the keywords.
[0015] Match one or more ciphertext matching words with the ciphertext keywords to obtain the matching results.
[0016] According to the method in the first aspect, the text to be matched is split based on the length of the search word group, and the split result is matched with the ciphertext search word. Only when the text to be matched matches the ciphertext search word is the text to be matched split based on the keyword length.
[0017] Since the length of the search term is a preset value, while the keyword length may have multiple different values, splitting the text to be matched based on the search term length requires significantly less data processing than splitting the text to be matched based on the keyword length. Therefore, the method described in the first aspect can effectively reduce the amount of data processing required for the matching operation and improve its execution efficiency.
[0018] Specifically, in the first aspect of the method, the confidentiality processing refers to processing the text to generate ciphertext data, making it impossible to directly identify the text content of the corresponding text through the ciphertext data.
[0019] The encryption process can be reversible or irreversible. That is, in one implementation of the first aspect, the corresponding text can be generated from the ciphertext data. Alternatively, in another implementation of the first aspect, the corresponding text cannot be generated from the ciphertext data.
[0020] Furthermore, in the first aspect of the method, there is a unique correspondence between ciphertext data and text. That is, for the same confidentiality processing method, one text corresponds to only one unique ciphertext data, and vice versa.
[0021] Furthermore, data matching can be performed between ciphertext data generated based on the same confidentiality processing method. If two ciphertext data match each other, their corresponding texts also match each other.
[0022] Furthermore, the embodiments of this application do not impose specific restrictions on the confidentiality processing methods adopted to achieve confidentiality processing. Those skilled in the art can design confidentiality processing methods according to actual needs.
[0023] In one implementation of the first aspect, for the sake of facilitating confidentiality processing and simplifying the implementation of the scheme, the first confidentiality processing method and the second confidentiality processing method are the same confidentiality processing method.
[0024] In another implementation of the first aspect, in order to improve data security and increase the confidentiality level, the first confidentiality processing method and the second confidentiality processing method are different confidentiality processing methods.
[0025] In one implementation of the first aspect, obtaining one or more keyword lengths includes obtaining the keyword length corresponding to the ciphertext index group that matches the ciphertext search group.
[0026] Based on the above implementation method, obtaining the keyword length corresponding to the ciphertext index group of the matching ciphertext retrieval group can reduce the workload when splitting the text to be matched based on the keyword length, and reduce the amount of data processing in the matching operation.
[0027] In another implementation of the first aspect, the length of one or more keywords is obtained, including obtaining the length of all keywords.
[0028] Based on the above implementation method, all keyword lengths can be obtained without storing the correspondence between the ciphertext index group and the keyword length, thus simplifying the data storage structure.
[0029] In one implementation of the first aspect, matching one or more ciphertext matching word groups with ciphertext keywords to obtain matching results includes: matching one or more ciphertext matching word groups with ciphertext keywords corresponding to ciphertext index word groups that match ciphertext retrieval word groups to obtain matching results.
[0030] The method described above can eliminate useless ciphertext keywords, reducing the number of ciphertext keywords involved in the matching operation and thus reducing the data processing overhead.
[0031] In another implementation of the first aspect, matching one or more ciphertext matching words with ciphertext keywords to obtain matching results includes: matching one or more ciphertext matching words with all ciphertext keywords to obtain matching results.
[0032] The method described above eliminates the need to record the correspondence between ciphertext index groups and ciphertext keywords, thus simplifying the data storage structure.
[0033] In another implementation of the first aspect, based on the current keyword matching scenario, all ciphertext keywords in the ciphertext keyword group corresponding to the keyword matching scenario are called, and one or more ciphertext matching word groups are matched with the called ciphertext keywords to obtain the matching result.
[0034] Based on the above implementation method, useless ciphertext keywords can be removed according to the application scenario requirements, reducing the number of ciphertext keywords participating in the matching operation and reducing the data processing consumption of the matching operation.
[0035] In one implementation of the first aspect, different ciphertext keywords correspond to different ciphertext index groups.
[0036] According to the above implementation method, there is a one-to-one correspondence between the ciphertext keywords and the ciphertext index group, which makes it easy to call the corresponding ciphertext keywords based on the ciphertext index group.
[0037] In one implementation of the first aspect, the character group to be matched is a continuous character in the text to be matched that meets the keyword length and includes the matching field, and the matching field is the character group to be retrieved corresponding to the ciphertext retrieval character group that matches the ciphertext index character group.
[0038] According to the above implementation method, the character group to be matched includes the character group to be retrieved corresponding to the ciphertext retrieval character group that matches the ciphertext index character group. This can eliminate useless character groups to be matched, reduce the number of character groups to be matched, and reduce the data processing consumption of the matching operation.
[0039] In one implementation of the first aspect, the word group to be matched is any consecutive word in the text to be matched that meets the keyword length.
[0040] According to the above implementation method, when extracting the matching word group from the text to be matched, only the keyword length is satisfied, and the matching word group corresponding to the ciphertext retrieval word group that matches the ciphertext index word group is not considered.
[0041] According to the above implementation method, when extracting the matching word groups from the text to be matched, it is not necessary to recognize the text of the text to be matched, which simplifies the operation process and reduces the amount of data processing consumed.
[0042] In another implementation of the first aspect, the word group to be matched is a continuous word in the text to be matched that meets the keyword length and contains the matching search word group, wherein the matching search word group is the word group to be searched corresponding to the ciphertext search word group that matches the ciphertext index word group.
[0043] According to the above implementation method, the character group to be matched includes the character group to be retrieved corresponding to the ciphertext retrieval character group that matches the ciphertext index character group. This can eliminate useless character groups to be matched, reduce the number of character groups to be matched, and reduce the data processing consumption of the matching operation.
[0044] In one implementation of the first aspect, the retrieval word group is a series of consecutive words extracted from the keyword, starting from the first character of the keyword, according to the length of the index word group.
[0045] Based on the above implementation method, the search term is limited to consecutive characters starting from the first character of the keyword, which simplifies the process of extracting search term from the keyword.
[0046] In one implementation of the first aspect, consecutive characters satisfying one or more keyword lengths are extracted from the text to be matched, generating one or more groups of characters to be matched, including:
[0047] Starting from the matching search word groups in the text to be matched, extract consecutive words that meet the length of one or more keywords to generate one or more word groups to be matched.
[0048] According to the above implementation method, based on the fact that the search word group is a continuous string of characters starting from the first character of the keyword, when determining the word group to be matched from the text to be matched, the word group to be matched is a continuous string of characters starting from the search word group.
[0049] The method described above simplifies the process of extracting characters to be matched, eliminates useless characters to be matched, reduces the number of characters to be matched, and thus reduces the data processing consumption of the matching operation.
[0050] Secondly, this application provides a keyword matching device, which is applied to an electronic device, and the device includes:
[0051] The first character group module is used to extract all consecutive characters that meet the index character group length from the text to be matched, and generate one or more character groups to be retrieved, wherein the index character group length is a preset value;
[0052] The first confidentiality processing module is used to perform confidentiality processing on one or more groups of characters to be retrieved based on the first confidentiality processing method, and generate one or more ciphertext retrieval groups. The first confidentiality processing method is the confidentiality processing method for generating ciphertext retrieval groups. The ciphertext retrieval groups are the data generated by performing confidentiality processing on the retrieval groups. The retrieval groups are continuous characters extracted from the keywords according to the length of the index groups.
[0053] The first matching module is used to match one or more ciphertext search word groups with ciphertext index word groups;
[0054] The second character group module is used to: obtain one or more keyword lengths when a ciphertext retrieval character group that matches the ciphertext index character group exists; and extract continuous characters that satisfy one or more keyword lengths from the text to be matched to generate one or more character groups to be matched.
[0055] The second confidentiality processing module is used to perform confidentiality processing on one or more groups of characters to be matched based on the second confidentiality processing method, and generate one or more ciphertext matching groups. The second confidentiality processing method is a confidentiality processing method for generating ciphertext keywords, and the ciphertext keywords are the data generated by performing confidentiality processing on the keywords.
[0056] The second matching module is used to match one or more ciphertext matching word groups with ciphertext keywords to obtain matching results.
[0057] In one implementation of the second aspect, the second character group module is configured to obtain the keyword length corresponding to the ciphertext index group that matches the ciphertext index group when a ciphertext retrieval character group exists.
[0058] In one implementation of the second aspect, the second character group module is configured to obtain the length of all keywords when a ciphertext retrieval character group that matches the ciphertext index character group exists.
[0059] In one implementation of the second aspect, the second matching module is configured to match one or more ciphertext matching word groups with the ciphertext keywords corresponding to the ciphertext index word groups that match the ciphertext retrieval word groups, and obtain the matching results.
[0060] In one implementation of the second aspect, the second matching module is configured to match one or more ciphertext matching word groups with all ciphertext keywords to obtain the matching results.
[0061] In one implementation of the second aspect, the second character group module is configured to extract consecutive characters of arbitrary keyword length from the text to be matched to generate character groups to be matched.
[0062] In one implementation of the second aspect, the second character group module is configured to extract consecutive characters from the text to be matched that meet the keyword length and include a matching field to generate a character group to be matched, wherein the matching field is the character group to be retrieved corresponding to the ciphertext retrieval character group that matches the ciphertext index character group.
[0063] In one implementation of the second aspect, the second character group module is configured to extract consecutive characters that satisfy the length of one or more keywords, starting from the matching search character group in the text to be matched, and generate one or more character groups to be matched.
[0064] Thirdly, this application provides an electronic device cluster, the electronic device cluster including at least one electronic device, each electronic device including a memory and a processor;
[0065] The processor of the at least one electronic device is configured to execute instructions stored in the memory of the at least one electronic device to cause the cluster of electronic devices to perform the method as described in the first aspect.
[0066] Fourthly, this application provides a computer program product containing instructions that, when executed by an electronic device system, cause the electronic device cluster to perform the method described in the first aspect of the claim.
[0067] Fifthly, this application provides a computer-readable storage medium including computer program instructions, which, when executed by a computer system, perform the method described in the first aspect. Attached Figure Description
[0068] Figure 1 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application;
[0069] Figure 2 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application;
[0070] Figure 3 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application;
[0071] Figure 4 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application;
[0072] Figure 5 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application;
[0073] Figure 6 The diagram shown is a schematic diagram of a keyword matching device according to an embodiment of this application;
[0074] Figure 7The diagram shown is a flowchart of a keyword matching method according to an embodiment of this application;
[0075] Figure 8 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0076] Figure 9 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0077] Figure 10 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0078] Figure 11 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0079] Figure 12 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0080] Figure 13 The diagram shown is a flowchart of a method for generating ciphertext index words according to an embodiment of this application;
[0081] Figure 14 This is a schematic diagram of an electronic device structure according to an embodiment of this application;
[0082] Figure 15 This is a schematic diagram of an electronic device cluster according to an embodiment of this application;
[0083] Figure 16 This is a schematic diagram of an electronic device cluster network connection according to an embodiment of this application. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0085] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0086] To address the problem of keyword matching based on encrypted keywords, one feasible technical solution is to decrypt the encrypted keywords and then perform keyword matching on the input text based on the decrypted keywords. While this achieves keyword matching while maintaining encrypted keyword storage, the keywords remain in plaintext (decrypted) during the matching process, posing a risk of keyword leakage. Furthermore, decrypting keywords during the matching process also carries the risk of the decryption key being leaked, further reducing data security.
[0087] To address the aforementioned issues and improve keyword data security, another feasible technical solution involves not decrypting the keywords throughout the entire keyword matching process.
[0088] Specifically, for a given text, if it matches the keyword, then the encrypted text obtained by encrypting the text and the keyword separately using the same encryption algorithm will also match the ciphertext keyword.
[0089] Therefore, in one embodiment, during the keyword matching process, the encrypted keywords are not decrypted. Instead, the text to be matched is encrypted using the same encryption algorithm, and the encrypted text is matched with the encrypted keywords.
[0090] Figure 1 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application.
[0091] like Figure 1 As shown, in one embodiment:
[0092] S100, obtain encrypted keywords.
[0093] S101, Get the text to be matched.
[0094] S102 is an encryption algorithm based on encrypted keywords that encrypts the text to be matched and generates encrypted text.
[0095] S103. Match the encrypted keywords with the encrypted text. If they match, the text to be matched is the keyword; if they do not match, the text to be matched is not the keyword.
[0096] according to Figure 1 The method shown keeps the keywords encrypted throughout the keyword matching process, thus ensuring the security of the keyword data.
[0097] However, in Figure 1 In the illustrated method flow, the encrypted text is matched against the ciphertext keyword as a whole. The encrypted text and the ciphertext keyword only match if the text to be matched exactly matches the keyword. However, there are cases where the text to be matched contains the keyword as well as other words besides the keyword. In such cases, according to... Figure 1 The method shown cannot confirm whether the text to be matched contains keywords, which may lead to missing keyword matches.
[0098] To address the aforementioned issues and avoid omissions in keyword matching, another feasible technical solution involves segmenting the text to be matched into words, obtaining one or more segmentation results, iterating and combining the segmentation results to generate one or more segmentation combinations, and then performing keyword matching on each segmentation combination.
[0099] Figure 2 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application.
[0100] like Figure 2 As shown, in one embodiment:
[0101] S200, obtain encrypted keywords.
[0102] S201, Get the text to be matched.
[0103] S202, perform word segmentation on the text to be matched, and obtain one or more word segmentation results.
[0104] S203, based on the order of the word segmentation results in the text to be matched, traverse and combine one or more word segmentation results to generate one or more word segmentation combinations, each word segmentation combination containing one or more word segmentation results.
[0105] S204 is an encryption algorithm based on encrypted keywords that encrypts each word segmentation combination separately, generating one or more encrypted word segmentation combinations.
[0106] S205, match the encrypted keyword with each encrypted word segmentation combination. If there is an encrypted word segmentation combination that matches the encrypted keyword, then the text to be matched contains the keyword; if there is no encrypted word segmentation combination that matches the encrypted keyword, then the text to be matched does not contain the keyword.
[0107] For example, matching based on the keyword "oolong tea".
[0108] Figure 3 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application.
[0109] The user entered the text: "Would you like to drink oolong tea?".
[0110] The word segmentation result of "Do you want to drink oolong tea?" includes: "you", "want to drink", "oolong", "tea", and "ma".
[0111] Based on the order of the word segmentation results in the text to be matched, the word segmentation results are traversed and combined to generate word segmentation combinations including: "you", "want to drink", "want to drink oolong", "want to drink oolong tea", "want to drink oolong tea?", "want to drink", "want to drink oolong", "want to drink oolong tea", "want to drink oolong tea?", "oolong", "oolong tea", "oolong tea?", "tea", "tea?", "?".
[0112] Each word segmentation combination is encrypted separately to generate multiple encrypted word segmentation combinations.
[0113] Retrieve the encrypted text A corresponding to "Oolong Tea".
[0114] The encrypted text A was compared with each encrypted word segmentation group, and it was found that the encrypted text A was consistent with the encrypted result of the word segmentation group "oolong tea".
[0115] Therefore, the question "Do you want to drink oolong tea?" contains the keyword "oolong tea".
[0116] according to Figure 2 The method shown can effectively avoid missing keyword matching.
[0117] but, Figure 2 The method shown relies heavily on the accuracy of the word segmentation results in the word segmentation process in S202. If word segmentation errors or omissions occur, the accuracy of the keyword matching results will be directly affected.
[0118] For example, suppose we're matching the keyword "drink oolong tea". During word segmentation, the segmentation results include "want to drink", without separating "want" from "drink". Therefore, the word combination won't include "drink oolong tea", resulting in an incorrect matching result.
[0119] The question "Would you like to drink oolong tea?" does not contain the keyword "drink oolong tea".
[0120] In the process of word segmentation, semantic recognition of the text is required to ensure the accuracy of word segmentation, which will undoubtedly consume a lot of processing resources.
[0121] In another feasible technical solution, the text to be matched is split based on individual characters, and the characters of the text to be matched are traversed and combined based on the keyword length range to generate one or more character groups, and keyword matching is performed on each character group.
[0122] Figure 4 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application.
[0123] like Figure 4 As shown, in one embodiment:
[0124] S400, obtain encrypted keywords.
[0125] S401, Get the text to be matched.
[0126] S402, split the text to be matched based on individual characters and obtain each character contained in the text to be matched.
[0127] S403: Based on the order of characters in the text to be matched, the characters in the text to be matched are traversed and combined according to the length of the keyword to generate one or more character groups, each character group having the same length as the keyword.
[0128] S404 is an encryption algorithm based on encrypted keywords that encrypts each word group separately to generate one or more encrypted word groups.
[0129] S405, match the encrypted keyword with each encrypted word group. If an encrypted word group that matches the encrypted keyword exists, the text to be matched contains the keyword; if no encrypted word group that matches the encrypted keyword exists, the text to be matched does not contain the keyword.
[0130] For example, matching based on the keyword "oolong tea".
[0131] Figure 5 The diagram shown is a schematic flowchart of a keyword matching method according to an embodiment of this application.
[0132] The user entered the text: "Would you like to drink oolong tea?".
[0133] Breaking down the question "Do you want to drink oolong tea?" yields the following results: "you", "want", "drink", "oolong", "tea", "ma".
[0134] Based on the keyword length of 3, the characters are traversed and combined according to their order in the text to be matched, generating character groups including: "You want to drink", "Want to drink oolong", "Drink oolong", "Oolong tea", "Dragon tea?"
[0135] Each character group is encrypted separately to generate multiple encrypted character groups.
[0136] Retrieve the encrypted text A corresponding to "Oolong Tea".
[0137] The encrypted text A is compared with each encrypted word group, and it is found that the encrypted text A is consistent with the encrypted result of the word group "oolong tea".
[0138] Therefore, the question "Do you want to drink oolong tea?" contains the keyword "oolong tea".
[0139] according to Figure 4 The method shown effectively avoids the possibility of missing keywords in word groups by iterating and combining the characters.
[0140] However, according to Figure 4 The method shown, in S403, iterates through all possibilities of word groups, and the number of word groups increases with the number of characters contained in the text to be matched. Furthermore, when there are multiple keywords of varying lengths, it is necessary to iterate and combine characters for each keyword length, resulting in a large number of word groups. This significantly extends the execution time of S404 and S405, and greatly increases the processing resource consumption of S404 and S405.
[0141] To avoid omissions in keyword matching and to reduce the time and data processing volume of keyword matching, an embodiment of this application provides a keyword matching method.
[0142] In the keyword matching method of this application embodiment, a search term group (a search term group includes one or more characters) is generated based on the keywords, and the length of the search term group is a preset value. The keywords and search term groups are then encrypted to generate encrypted keywords and encrypted search term groups.
[0143] When performing keyword matching, the text to be matched is first split based on the length of the search term group, and the split results are matched with the encrypted search terms. After the text to be matched matches the encrypted search terms, the text to be matched is split again based on the length of the keyword, and the split results are matched with the encrypted keywords.
[0144] According to the method of this application embodiment, the text to be matched is split based on the length of the search word group, and the splitting result is matched with the ciphertext search word. Only when the text to be matched matches the ciphertext search word is the text to be matched split based on the keyword length.
[0145] Since the length of the search term is a preset value, while the keyword length may have multiple different values, splitting the text to be matched based on the search term length requires significantly less data processing than splitting the text to be matched based on the keyword length. Therefore, the method according to the embodiments of this application can effectively reduce the amount of data processing required for the matching operation and improve the execution efficiency of the matching operation.
[0146] Specifically, in the method of this application embodiment, the confidentiality processing refers to processing the text to generate ciphertext data, so that the text content of the corresponding text cannot be directly identified through the ciphertext data.
[0147] The encryption process can be reversible or irreversible. In one embodiment, the corresponding text can be generated from the encrypted data. Alternatively, in another embodiment, the corresponding text cannot be generated from the encrypted data.
[0148] There is a unique correspondence between encrypted data and text. That is, for the same confidentiality processing method, one text corresponds to only one unique piece of encrypted data, and vice versa.
[0149] Furthermore, data matching can be performed between ciphertext data generated based on the same confidentiality processing method. If two ciphertext data match each other, their corresponding texts also match each other.
[0150] For example, using the confidentiality processing method S, encrypted keywords for keyword A and keyword B are generated respectively.
[0151] Based on the encrypted keyword A, the content of keyword A cannot be identified. Based on the encrypted keyword B, the content of keyword B cannot be identified.
[0152] If the ciphertext keyword of keyword A matches the ciphertext keyword of keyword B, then keyword A matches keyword B.
[0153] This application does not impose specific restrictions on the confidentiality processing method used to achieve confidentiality processing. Those skilled in the art can design confidentiality processing methods according to actual needs.
[0154] For example, in one embodiment, the confidentiality process includes encrypting the text based on a key and using the encrypted text as ciphertext data of the text.
[0155] For example, in another embodiment, the confidentiality process includes performing a hash operation on the text and using the calculated text hash value as the ciphertext data of the text.
[0156] An embodiment of this application also provides a keyword matching device for implementing a keyword matching method.
[0157] Figure 6 The diagram shown is a schematic diagram of a keyword matching device according to an embodiment of this application.
[0158] like Figure 6 As shown, the keyword matching device 600 includes a storage module 601, a text acquisition module 602, a first character group module 603, a first matching module 604, a second character group module 605, a second matching module 606, a confidentiality processing module 607, a confidentiality processing module 609, and an output module 608.
[0159] Storage module 601 is used to store ciphertext keywords and corresponding ciphertext index groups for each ciphertext keyword. In storage module 601, there is a corresponding ciphertext index group for each ciphertext keyword.
[0160] The encrypted keyword is the data generated by making the keyword confidential, and the encrypted index group is the data generated by making the index group confidential. The confidentiality methods for the encrypted index group and the encrypted keyword can be the same or different.
[0161] An index word group is a group of consecutive words extracted from a keyword according to the length of the index word group.
[0162] Different keywords can have the same or different lengths. Different index groups use the same index group length.
[0163] The length of the index group is less than or equal to the length of the shortest keyword, and the length of the index group can be 1.
[0164] For example, suppose the keywords include: "Oolong tea", "Jasmine tea", and "Peach grapefruit tea". The minimum keyword length is 3.
[0165] The length of the index word group can be any one of 1, 2, or 3.
[0166] In one embodiment, index word groups are extracted from different keywords based on a fixed extraction position.
[0167] For example, starting from the first character of the keyword, extract multiple consecutive characters of the index character group length.
[0168] For example, suppose the keywords include "oolong tea", "jasmine tea", and "peach and grapefruit tea". Set the index word group length to 2, and extract the index word groups including "oolong", "jasmine", and "peach".
[0169] For example, starting from the second character of the keyword, extract multiple consecutive characters of the index character group length.
[0170] For example, suppose the keywords include: "oolong tea", "jasmine tea", and "peach and grapefruit tea". Set the index group length to 2, and extract the index groups including: "oolong tea", "jasmine", and "peach and grapefruit tea".
[0171] In another embodiment, the extraction location can be different when extracting index word groups from different keywords.
[0172] For example, suppose the keywords include "oolong tea", "jasmine tea", and "peach and grapefruit tea". Setting the index group length to 2, the extracted index groups could include: "oolong tea", "jasmine tea", and "peach"; alternatively, they could include: "oolong tea", "jasmine", and "grapefruit".
[0173] In one embodiment, different keywords are defined to correspond to different index word groups, that is, different consecutive words are extracted from different keywords as index word groups.
[0174] For example, suppose the keywords include "oolong tea", "oolong ball", and "oolong academy". Set the index group length to 2, and extract "oolong tea", "oolong ball", and "oolong academy" as the index group. Alternatively, extract "oolong", "oolong ball", and "oolong academy" as the index group. You cannot extract "oolong", "oolong", and "oolong academy" as the index group.
[0175] According to the method in the embodiments of this application, different keywords correspond to different index groups, that is, different ciphertext keywords correspond to different ciphertext index groups, which helps to sort out the correspondence between ciphertext keywords and ciphertext index groups, and facilitates the subsequent search of ciphertext keywords based on ciphertext index groups.
[0176] In another embodiment, different keywords are not necessarily required to correspond to different index groups; multiple ciphertext keywords can correspond to one ciphertext index group.
[0177] For example, suppose the keywords include "oolong tea", "oolong ball", and "oolong academy". Set the index word length to 2 and extract "oolong" and "dragon ball" as the index word; or, extract "oolong" as the index word.
[0178] According to the method of the embodiments of this application, a one-to-one correspondence between different keywords and index groups is not required. Different keywords can correspond to the same index group, which can simplify the operation of extracting index groups from keywords and reduce the number of index groups.
[0179] The text acquisition module 602 is used to acquire the text to be matched.
[0180] The first character group module 603 is used to generate a character group to be retrieved based on the length of the index character group and the text to be matched.
[0181] The confidentiality processing module 607 is used to perform confidentiality processing on the target word group based on the confidentiality processing method of generating ciphertext index word group, and generate ciphertext search word group.
[0182] The first matching module 604 is used to match the ciphertext search word group with the ciphertext index word group.
[0183] The second character group module 605 is used to generate multiple character groups to be matched based on the keyword length of the keyword corresponding to the keyword in the ciphertext index character group when the ciphertext retrieval character group matches the ciphertext index character group.
[0184] The confidentiality processing module 609 is used to perform confidentiality processing on the character group to be matched based on the confidentiality processing method of generating ciphertext keywords, and generate ciphertext matching character groups.
[0185] The second matching module 606 is used to match the ciphertext matching word group with the ciphertext keyword.
[0186] Output module 608 is used to output the matching results of the second matching module 606.
[0187] Figure 7 The diagram shown is a flowchart of a keyword matching method according to an embodiment of this application.
[0188] In one embodiment, Figure 6 The keyword matching device 600 shown performs the following: Figure 7 The following process is shown to achieve keyword matching.
[0189] S700, the text acquisition module 602 acquires the text to be matched.
[0190] S701, the first character group module 603 extracts all consecutive characters that meet the index character group length from the text to be matched, and generates one or more character groups to be retrieved, wherein the index character group length is a preset value.
[0191] For example, in one embodiment, a sliding window extraction method is used, where the window length is the length of the index word group and the starting position of the window is the first word of the text to be matched.
[0192] Extract the word groups corresponding to the window positions from the text to be matched. For each word group extracted, the window position is shifted one word to the right until the end position of the window is the last word of the text to be matched.
[0193] For example, the text to be matched is "Do you want to drink oolong tea or jasmine tea?" and the index word length is 2.
[0194] During the process of extracting the word group to be retrieved:
[0195] The window is 2 characters long, and its initial coverage position is the first two characters of "Do you want to drink oolong tea or jasmine tea?".
[0196] The extraction window covers the group of characters to be retrieved, and the window moves one character to the right each time an extraction is performed.
[0197] The extracted word group to be retrieved includes:
[0198] "You want to", "Want to drink", "Drink oolong", "Oolong tea", "Tea still", "Still", "Is jasmine", "Jasmine flower", "Flower tea".
[0199] S702, the confidentiality processing module 607 performs confidentiality processing on one or more groups of characters to be retrieved based on the first confidentiality processing method, and generates one or more ciphertext retrieval groups.
[0200] In S702, the first security processing method is the security processing method of generating ciphertext index word groups.
[0201] S703, the first matching module 604 calls the ciphertext index group stored in the storage module 601.
[0202] Specifically, in one embodiment, the first matching module 604 calls all the ciphertext index groups stored in the storage module 601.
[0203] For example, in one embodiment, the keywords are "oolong tea" and "jasmine tea". The index group length is 2, and the index groups "oolong" and "jasmine" are extracted. In S703, the ciphertext index groups corresponding to "oolong" and "jasmine" are called.
[0204] In another embodiment, the storage module 601 stores ciphertext keyword groups corresponding to different keyword matching scenarios. Each ciphertext keyword group contains one or more ciphertext keywords and a corresponding ciphertext index group.
[0205] In S703, the first matching module 604 calls all the ciphertext index words in the ciphertext keyword group of the corresponding keyword matching scenario according to the current keyword matching scenario.
[0206] For example, suppose there are keyword matching scenarios for "catering" and "flowers".
[0207] For the keyword matching scenario "catering", the keywords "oolong tea" and "jasmine tea" are present; for the keyword matching scenario "flowers", the keywords "peony" and "jasmine" are present.
[0208] For the keyword matching scenario of "catering", the keywords "oolong tea" and "jasmine tea" are used to extract the index words "oolong" and "jasmine".
[0209] For the keyword matching scenario of "flowers", the keywords "peony" and "jasmine" are used to extract the index words "peony" and "jasmine".
[0210] The text to be matched is "Would you like to drink oolong tea or jasmine tea?".
[0211] Based on the text to be matched, the keyword matching scenario can be identified as "catering". Therefore, in S703, the ciphertext index group corresponding to the index group "oolong" and "jasmine" is called.
[0212] S704, the first matching module 604 matches all the ciphertext retrieval word groups generated by S702 with the ciphertext index word groups called by S703.
[0213] Specifically, in the embodiments of the present application, no specific limitation is imposed on the matching operation process for matching between two data, and those skilled in the art can design a specific matching operation process according to the actual application scenario requirements.
[0214] For example, in one embodiment, matching the first data with the second data includes comparing each byte of the first data and the second data. If the first data and the second data are exactly the same, then the first data and the second data match.
[0215] Again, for example, in another embodiment, matching the first data with the second data includes:
[0216] Performing a hash operation on the first data to obtain the hash value (the first hash value) of the first data;
[0217] Performing a hash operation on the second data to obtain the hash value (the second hash value) of the second data;
[0218] Comparing the first hash value and the second hash value. If the first hash value and the second hash value are the same, then the first data and the second data match.
[0219] For example, in one embodiment, the ciphertext retrieval word groups corresponding to the retrieval word groups "Oolong" and "Jasmine" match the ciphertext index word groups corresponding to the index word groups "Oolong" and "Jasmine".
[0220] In S704, when there is no ciphertext index word group that matches the ciphertext retrieval word group, S705 is executed.
[0221] S705, the output module 608 outputs that the text to be matched does not contain the keyword.
[0222] In the case of S705, since the text to be matched does not contain the keyword, and no plaintext keyword or plaintext index word group is introduced in all the matching operations, the content of the keyword is effectively kept secret.
[0223] In S704, when there is a ciphertext index word group that matches the ciphertext retrieval word group, for each group of mutually matching ciphertext retrieval word groups and ciphertext index word groups, S706 to S710 are executed respectively.
[0224] S706, the second word group module 605 obtains the keyword length.
[0225] In one embodiment, in S706, the second word group module 605 obtains the keyword length corresponding to the ciphertext index word group that matches the ciphertext retrieval word group.
[0226] For example, assume that the text to be matched is "Do you want to drink oolong tea?", and the keywords are "oolong tea" and "jasmine tea", with keyword lengths of 3 and 4 respectively.
[0227] The ciphertext retrieval word group corresponding to the retrieved word group "oolong" matches the ciphertext index word group corresponding to the index word group "oolong".
[0228] In S706, the second word group module 605 obtains the keyword length corresponding to the index word group "oolong": 3.
[0229] Another example, assume that the text to be matched is "Do you want to drink oolong tea or jasmine tea?", and the keywords are "oolong tea", "jasmine tea" and "green tea", with keyword lengths of 2, 3 and 4 respectively.
[0230] The ciphertext retrieval word groups corresponding to the retrieved word groups "oolong" and "jasmine" match the ciphertext index word groups corresponding to the index word groups "oolong" and "jasmine".
[0231] In S706, the second word group module 605 obtains the keyword lengths corresponding to the index word groups "oolong" and "jasmine": 3 and 4 respectively.
[0232] According to the method of the embodiment of the present application, obtaining the keyword length corresponding to the ciphertext index word group that matches the ciphertext retrieval word group can reduce the workload of splitting the text to be matched based on the keyword length in the subsequent process, and reduce the data processing amount of the matching operation.
[0233] Specifically, in one embodiment, according to any ciphertext index word group stored in the storage module 601, the keyword length corresponding to the ciphertext index word group can be determined.
[0234] The keyword length corresponding to the ciphertext index word group is the keyword length corresponding to the ciphertext keyword corresponding to the ciphertext index word group.
[0235] In the embodiment of the present application, there is no specific limitation on the specific manner of determining the keyword length corresponding to the ciphertext index word group.
[0236] For example, in one embodiment, the storage module 601 stores the correspondence between the ciphertext index word group and the keyword length.
[0237] In S706, the second word group module 605 determines the keyword length corresponding to the first ciphertext index word group based on the correspondence between the ciphertext index word group and the keyword length.
[0238] Specifically, in the embodiment of the present application, there is no specific limitation on the storage manner of the correspondence between the ciphertext index word group and the keyword length.
[0239] For example, in one embodiment, different ciphertext keywords correspond to different ciphertext index groups. An index group label (e.g., index group number) is assigned to the ciphertext index group, and a first correspondence table is created to record the length of a keyword corresponding to each index group label in the first correspondence table.
[0240] Figure 8 The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0241] S800, Create the first mapping table.
[0242] S801 sorts multiple keywords in ascending order of keyword length.
[0243] S802, sort by keywords and extract the first keyword.
[0244] S803: Starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0245] S804, assign an index group label to the currently extracted index group, save the currently extracted index group, and save the correspondence between the currently extracted index group and the index group label.
[0246] S805, record the index group label of the currently extracted index group into the first correspondence table, and record the keyword length of the currently extracted keyword corresponding to the index group label in the first correspondence table.
[0247] S806, Determine if there are any unextracted keywords.
[0248] In S806, if there are any keywords that have not been extracted, proceed to S807.
[0249] S807, sort by keywords and extract the next keyword.
[0250] S808: Starting from the nth character of the currently extracted keyword, extract consecutive characters of the index character group length to form the index character group n, where the initial value of n is 1.
[0251] S809, match the currently extracted index group n with the saved index groups.
[0252] In S809, when the currently extracted index group n matches a saved index group, S810 is executed.
[0253] S810, let n = n + 1. Return to S808.
[0254] In S809, if the currently extracted index group n does not match a saved index group, return to S804.
[0255] In S806, if there are no unextracted keywords, proceed to S811.
[0256] S811, each saved index group is encrypted, and an index group tag is added to the encrypted index group to generate a ciphertext index group containing a readable index group tag.
[0257] In this way, after S811, multiple ciphertext index groups are generated. These multiple ciphertext index groups are different from each other, and each ciphertext index group corresponds one-to-one with the encryption key.
[0258] Based on the keyword length under the index group label recorded in the first correspondence table, the keyword length corresponding to the ciphertext index group can be determined according to the index group label contained in the ciphertext index group.
[0259] For example, in one embodiment, different ciphertext keywords correspond to different ciphertext index groups, and the ciphertext index groups contain keyword length information, which is used to describe the keyword length corresponding to the ciphertext index group.
[0260] Figure 9 The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0261] S900 sorts multiple keywords in ascending order of keyword length.
[0262] S901, sort by keywords and extract the first keyword.
[0263] S902, starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0264] S903, Create corresponding keyword length information for the currently extracted index group, which includes the keyword length of the keyword corresponding to the currently extracted index group.
[0265] S904, save the currently extracted index word group, and save the correspondence between the currently extracted index word group and the keyword length information.
[0266] S905, determine if there are any unextracted keywords.
[0267] In S905, if there are any keywords that have not been extracted, proceed to S906.
[0268] S906, sort by keywords and extract the next keyword.
[0269] S907, starting from the nth character of the currently extracted keyword, extract consecutive characters of the index character group length to form the index character group n, with the initial value of n being 1.
[0270] S908, match the currently extracted index group n with the saved index groups.
[0271] In S908, when the currently extracted index group n matches a saved index group, S909 is executed.
[0272] S909, let n = n + 1. Return to S907.
[0273] In S908, if the currently extracted index group n does not match a saved index group, return to S903.
[0274] In S905, if there are no unextracted keywords, proceed to S910.
[0275] S910, perform confidentiality processing on each saved index group, and add keyword length information to the confidentialized index group to generate a ciphertext index group containing readable keyword length information.
[0276] In this way, after S910, multiple ciphertext index groups are generated. These multiple ciphertext index groups are different from each other, and each ciphertext index group corresponds one-to-one with the encryption key.
[0277] The length of the keyword corresponding to the ciphertext index group can be determined based on the keyword length information contained in the ciphertext index group.
[0278] For example, in one embodiment, multiple ciphertext keywords can correspond to a ciphertext index group. An index group label (e.g., index group number) is assigned to the ciphertext index group, and a second correspondence table is created to record the length of one or more keywords corresponding to each index group label.
[0279] Figure 10 The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0280] S1000, Create a second corresponding table.
[0281] S1001, sort multiple keywords in ascending order of keyword length.
[0282] S1002, sort by keywords and extract the first keyword.
[0283] S1003, starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0284] S1004, Assign index group labels to the currently extracted index groups, and save the extracted index groups and their correspondence with the index group labels.
[0285] S1005, record the index group label of the currently extracted index group into the second correspondence table, and record the keyword length of the currently extracted keyword corresponding to the index group label in the second correspondence table.
[0286] S1006, Determine if there are any unextracted keywords.
[0287] In S1006, if there are any keywords that have not been extracted, proceed to S1007.
[0288] S1007, sort by keywords and extract the next keyword.
[0289] S1008: Starting from the first character of the currently extracted keyword, extract consecutive characters of the index character group length to form an index character group.
[0290] S1009, Match the currently extracted index group with the saved index group.
[0291] In S1009, when the currently extracted index group matches a saved index group, S1010 is executed.
[0292] S1010, in the second correspondence table, under the index group label corresponding to a certain index group, increase the keyword length of the currently extracted keyword. Then return to S1006.
[0293] In S1009, if the currently extracted keyword does not match a saved index word group, return to S1004.
[0294] In S1006, if there are no unextracted keywords, proceed to S1011.
[0295] S1011, perform confidentiality processing on each saved index group, and add index group tags to the confidentialized index group to generate a ciphertext index group containing readable index group tags.
[0296] In this way, based on the keyword length under the index group label recorded in the second correspondence table, the keyword length corresponding to the ciphertext index group can be determined according to the index group label contained in the ciphertext index group.
[0297] Figure 11The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0298] S1100, Create a third mapping table.
[0299] S1101, sort multiple keywords in ascending order of keyword length.
[0300] S1102, sort by keywords and extract the first keyword.
[0301] S1103, starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0302] S1104, Assign index group labels to the currently extracted index groups, and save the extracted index groups and their correspondence with the index group labels.
[0303] S1105, record the index group label of the currently extracted index group into the third correspondence table, and record the keyword length of the currently extracted keyword corresponding to the index group label in the third correspondence table.
[0304] S1106, Determine if there are any unextracted keywords.
[0305] In S1106, if there are any keywords that have not been extracted, proceed to S1107.
[0306] S1107, sort by keywords and extract the next keyword.
[0307] S1108, starting from the nth character of the currently extracted keyword, extract consecutive characters of the index character group length to form the index character group n, with the initial value of n being 1.
[0308] S1109, Match the currently extracted index group n with the saved index groups.
[0309] In S1109, when the currently extracted index group n matches a saved index group, S1110 is executed.
[0310] S1110, in the third correspondence table, under the index group label corresponding to a certain index group, increase the keyword length of the currently extracted keyword. Then return to S1106.
[0311] In S1109, if the currently extracted index group n cannot match a saved index group, S1111 is executed.
[0312] S1111, determine whether the length of n+index word group is equal to the length of the currently extracted keyword.
[0313] In S1111, if the length of n+index word group is not equal to the length of the currently extracted keyword, execute S1112.
[0314] S1112, let n = n + 1. Return to S1108.
[0315] In S1111, if the length of n+index word group is equal to the length of the currently extracted keyword, execute S1113.
[0316] S1113: Starting from the first character of the currently extracted keyword, extract consecutive characters of the index character group length to form an index character group. Return to S1105.
[0317] In S1106, if there are no unextracted keywords, proceed to S1114.
[0318] S1114, perform confidentiality processing on each saved index group, and add index group tags to the confidentialized index group to generate a ciphertext index group containing readable index group tags.
[0319] For example, in one embodiment, multiple ciphertext keywords can correspond to a ciphertext index group, which contains keyword length information and is used to describe the length of one or more keywords corresponding to the ciphertext index group.
[0320] Figure 12 The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0321] S1200 sorts multiple keywords in ascending order of keyword length.
[0322] S1201, sort by keywords and extract the first keyword.
[0323] S1202, starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0324] S1203, Create corresponding keyword length information for the currently extracted index group. This keyword length information includes the keyword length of the keyword corresponding to the currently extracted index group.
[0325] S1204, save the currently extracted index word group, and save the correspondence between the currently extracted index word group and the keyword length information.
[0326] S1205, Determine if there are any unextracted keywords.
[0327] In S1205, if there are any keywords that have not been extracted, proceed to S1206.
[0328] S1206, sort by keywords and extract the next keyword.
[0329] S1207: Starting from the first character of the currently extracted keyword, extract consecutive characters of the index character group length to form an index character group.
[0330] S1208, Match the currently extracted index group with the saved index group.
[0331] In S1208, when the currently extracted index word group matches a saved index word group, S1209 is executed.
[0332] S1209: In the keyword length information corresponding to a certain index group, add the keyword length of the currently extracted keyword. Then return to S1205.
[0333] In S1208, if the currently extracted keyword does not match a saved index word group, return to S1203.
[0334] In S1205, if there are no unextracted keywords, proceed to S1210.
[0335] S1210, perform confidentiality processing on each saved index group, and add corresponding keyword length information to the confidential index group to generate a ciphertext index group containing readable keyword length information.
[0336] In this way, the length of the keyword corresponding to the ciphertext index group can be determined based on the keyword length information contained in the ciphertext index group.
[0337] Figure 13 The diagram shown is a flowchart of a method for generating a ciphertext index group according to an embodiment of this application.
[0338] S1301, sort multiple keywords in ascending order of keyword length.
[0339] S1302, sort by keywords and extract the first keyword.
[0340] S1303, starting from the first character of the first keyword, extract consecutive characters of the index character group length to form an index character group.
[0341] S1304, Create corresponding keyword length information for the currently extracted index group. This keyword length information includes the keyword length of the keyword corresponding to the currently extracted index group.
[0342] S1305, save the currently extracted index word group, and save the correspondence between the currently extracted index word group and the keyword length information.
[0343] S1306, Determine if there are any unextracted keywords.
[0344] In S1306, if there are any keywords that have not been extracted, proceed to S1307.
[0345] S1307, sort by keywords and extract the next keyword.
[0346] S1308, starting from the nth character of the currently extracted keyword, extract consecutive characters of the index character group length to form the index character group n, with the initial value of n being 1.
[0347] S1309, Match the currently extracted index group n with the saved index groups.
[0348] In S1309, when the currently extracted index group n matches a saved index group, S1310 is executed.
[0349] S1310, In the keyword length information corresponding to a certain index word group, add the keyword length of the currently extracted keyword. Then return to S1306.
[0350] In S1309, if the currently extracted index group n cannot match a saved index group, S1311 is executed.
[0351] S1311, Determine whether the length of n+index word group is equal to the length of the currently extracted keyword.
[0352] In S1311, if the length of n+index word group is not equal to the length of the currently extracted keyword, execute S1312.
[0353] S1312, let n = n + 1. Return to S1308.
[0354] In S1311, if the length of n+index word group is equal to the length of the currently extracted keyword, execute S1313.
[0355] S1313: Starting from the first character of the currently extracted keyword, extract consecutive characters of the index character group length to form an index character group. Return to S1305.
[0356] In S1306, if there are no unextracted keywords, proceed to S1314.
[0357] S1314, perform confidentiality processing on each saved index group, and add corresponding keyword length information to the confidential index group to generate a ciphertext index group containing readable keyword length information.
[0358] Furthermore, in application scenarios where one index group corresponds to multiple keywords, if the encrypted index group contains keyword length information, the string length of the encrypted index group will become excessively long if the number of keywords corresponding to the index group is too large.
[0359] For example, suppose a certain index word group corresponds to keywords with lengths of 4, 6, 9, 12, 18, and 22. Then the keyword length information must include at least the six numbers 4, 6, 9, 12, 18, and 22.
[0360] In one embodiment, binary strings are used to implement keyword length information in order to reduce the amount of data in keyword length information.
[0361] Specifically, the keyword length information is configured as a binary string, and the number of binary bits in this binary string is the maximum length of the keyword.
[0362] In a binary string, each binary bit corresponds to a keyword length. The first binary bit of the binary string corresponds to a keyword length of 1, and the m-th binary bit corresponds to a keyword length of m.
[0363] In one embodiment, when a binary bit in a binary string is set to 1, the length of the keyword corresponding to that binary bit is the length of the keyword corresponding to the current ciphertext index group.
[0364] For example, the ciphertext index group A contains the binary string A. The 3rd, 4th, and 7th bits of the binary string A are 1, and the remaining bits are 0. This means that the keyword length corresponding to the ciphertext index group A contains 3, 4, and 7.
[0365] Alternatively, in another embodiment, when a binary bit in the binary string is set to 1, the length of the keyword corresponding to that binary bit is the length of the keyword corresponding to the current ciphertext index group.
[0366] For example, the ciphertext index group A contains the binary string A. The 5th and 8th bits of the binary string A are 0, and the remaining bits are 1. This means that the keyword length corresponding to the ciphertext index group A contains 5 and 8.
[0367] For example, in one embodiment, the storage module 601 stores the correspondence between ciphertext keywords and ciphertext index groups, and the storage module 601 also stores the correspondence between ciphertext keywords and keyword lengths.
[0368] In S706, the second word group module 605 determines the ciphertext keyword corresponding to the first ciphertext index word group based on the correspondence between the ciphertext keyword and the ciphertext index word group; and determines the keyword length corresponding to the first ciphertext index word group based on the correspondence between the ciphertext keyword and the keyword length.
[0369] Further, in another embodiment, in S706, all keyword lengths are obtained.
[0370] For example, assume that the text to be matched is "Do you want to drink oolong tea?", and the keywords are "oolong tea" and "jasmine tea", with keyword lengths of 3 and 4 respectively.
[0371] The ciphertext retrieval word group corresponding to the retrieved word group "oolong" matches the ciphertext index word group corresponding to the index word group "oolong".
[0372] In S706, the second word group module 605 obtains all keyword lengths: 3, 4.
[0373] Another example, assume that the text to be matched is "Do you want to drink oolong tea or jasmine tea?", and the keywords are "oolong tea", "jasmine tea", and "green tea", with keyword lengths of 2, 3, and 4 respectively.
[0374] The ciphertext retrieval word groups corresponding to the retrieved word groups "oolong" and "jasmine" match the ciphertext index word groups corresponding to the index word groups "oolong" and "jasmine".
[0375] In S706, the second word group module 605 obtains all keyword lengths: 2, 3, 4.
[0376] According to the method of the embodiment of the present application, when there is a ciphertext index word group that matches the ciphertext retrieval word group, all keyword lengths are obtained, without referring to which ciphertext index word group the ciphertext retrieval word group matches, and without saving the correspondence between the ciphertext index word group and the keyword length.
[0377] According to the method of the embodiment of the present application, the operation process of obtaining the keyword length can be simplified, and the data storage structure can be simplified.
[0378] S707, the second word group module 605 extracts the consecutive words of the keyword length corresponding to the ciphertext index word group from the text to be matched, and generates one or more words to be matched.
[0379] In one embodiment, in S707, the second word group module 605 extracts all consecutive words from the text to be matched that satisfy the keyword length corresponding to the first ciphertext index word group and contain the matching retrieval word group, and generates one or more words to be matched, where the matching retrieval word group is the word group to be retrieved corresponding to the ciphertext retrieval word group that matches the ciphertext index word group.
[0380] For example, assume the keyword is "oolong tea", the index word group extracted from the keyword is "ong tea", the length of the index word group is 2, and the length of the keyword is 3.
[0381] User input text: "Do you want to drink oolong tea?".
[0382] Based on the index word group length of 2, extract the words to be matched: "Do you", "you want", "want to", "to drink", "drink ool", "oolong", "ong tea", "tea?".
[0383] There is a ciphertext index word group that matches the ciphertext retrieval word group, and the word group to be retrieved corresponding to the ciphertext retrieval word group that matches the ciphertext index word group is "ong tea", so the matching retrieval word group is "ong tea".
[0384] Based on the keyword length of 3, extract all consecutive words from "Do you want to drink oolong tea?" that satisfy the keyword length of 3 and contain the matching retrieval word group "ong tea", and generate the words to be matched.
[0385] Specifically, in one embodiment, the index word group is consecutive words extracted from any position of the keyword.
[0386] That is to say, in the keyword, there are other words in front of the index word group, and / or there are other words behind the index word group.
[0387] For example, assume the keyword is "oolong tea" and the length of the index word group is 2.
[0388] Since the extraction position of the index word group is not limited, the index word group extracted from the keyword can be "ong tea", and there is other word "ool" in front of the index word group "ong tea".
[0389] The index word group extracted from the keyword can also be "oolong", and there is other word "tea" behind the index word group "oolong".
[0390] Another example, assume the keyword is "jasmine tea" and the length of the index word group is 2.
[0391] Since the extraction position of the index word group is not limited, the index word group extracted from the keyword can be "jasmine", and there is other word "tea" behind the index word group "jasmine".
[0392] The index word group extracted from the keyword can be "scented tea", and there is another word "jasmine" before the index word group "scented tea".
[0393] The index word group extracted from the keyword can be "lihua", and there is another word "mo" before the index word group "lihua", and there is another word "tea" after the index word group "lihua".
[0394] Since the extraction position of the index word group is not limited, it is impossible to determine that there is another word before the index word group and / or there is another word after the index word group in the keyword.
[0395] Therefore, in S707, all consecutive words that meet the keyword length and contain the matching retrieval word group are extracted from the text to be matched to generate one or more text groups to be matched.
[0396] For example, assume the keyword is "oolong tea", the index word group extracted from the keyword is "long tea", the length of the index word group is 2, and the length of the keyword is 3.
[0397] User input text: "Do you want to drink oolong tea?".
[0398] Based on the index word group length of 2, the text groups to be matched are extracted: "Do you", "you want", "want to drink", "drink oolong", "oolong tea", "tea?".
[0399] There is a ciphertext index word group that matches the ciphertext retrieval word group.
[0400] Based on the keyword length of 3, all consecutive words that meet the keyword length of 3 and contain the matching retrieval word group "long tea" are extracted from "Do you want to drink oolong tea?", and the text groups to be matched include: "oolong tea", "long tea?".
[0401] Another example, assume the keyword is "jasmine tea", the index word group extracted from the keyword is "jasmine", the length of the index word group is 2, and the length of the keyword is 4.
[0402] User input text: "Do you want to drink jasmine tea?".
[0403] Based on the index word group length of 2, the text groups to be matched are extracted: "Do you", "you want", "want to drink", "drink jasmine", "jasmine li", "lihua", "hua tea", "tea?".
[0404] There is a ciphertext index word group that matches the ciphertext retrieval word group.
[0405] Based on the keyword length of 4, all consecutive words that meet the keyword length of 4 and contain the matching retrieval word group "jasmine" are extracted from "Do you want to drink jasmine tea?", and the text groups to be matched include: "want to drink jasmine", "drink jasmine tea", "jasmine tea".
[0406] According to the method of the embodiments of the present application, useless to-be-matched character groups can be eliminated, the number of to-be-matched character groups can be reduced, thereby reducing the consumption of data processing volume for matching operations.
[0407] Specifically, in another embodiment, the index character group is consecutive characters extracted starting from the position of the first character of the keyword.
[0408] That is to say, in the keyword, there are no other characters in front of the index character group.
[0409] For example, assume the keyword is "oolong tea" and the length of the index character group is 2.
[0410] It is specified to extract the index character group starting from the position of the first character of the keyword. The index character group extracted from the keyword is "oolong". There are no other characters in front of the index character group "oolong", and there are no other characters "tea" behind the index character group "oolong".
[0411] Another example, assume the keyword is "jasmine tea" and the length of the index character group is 2.
[0412] It is specified to extract the index character group starting from the position of the first character of the keyword. The index character group extracted from the keyword is "jasmine". There are no other characters in front of the index character group "jasmine", and there are other characters "tea" behind the index character group "jasmine".
[0413] Since there are no other characters in front of the index character group in the keyword. Therefore, in S707, consecutive characters starting from the matching retrieval character group and satisfying the length of the keyword are extracted from the to-be-matched text to generate to-be-matched character groups.
[0414] For example, assume the keyword is "oolong tea", the index character group extracted from the keyword is "oolong", the length of the index character group is 2, and the length of the keyword is 3.
[0415] The user inputs the text: "Do you want to drink oolong tea?".
[0416] Based on the length of the index character group 2, the to-be-matched character groups extracted are: "Do you", "you want", "want to", "to drink", "drink oolong", "oolong tea", "tea?".
[0417] There is a ciphertext index character group that matches the ciphertext retrieval character group.
[0418] Based on the keyword length 3, starting from the matching retrieval character group "oolong" in "Do you want to drink oolong tea?", consecutive characters that satisfy the keyword length 3 are extracted, and the generated to-be-matched character groups include: "oolong tea".
[0419] According to the method of this application embodiment, when determining the extraction of the matching character group from the text to be matched based on the fact that the search character group is a continuous character starting from the first character of the keyword, the matching character group is a continuous character starting from the matching search character group.
[0420] The method according to the embodiments of this application can simplify the operation process of extracting the characters to be matched, remove useless characters to be matched, reduce the number of characters to be matched, and thus reduce the data processing consumption of the matching operation.
[0421] Furthermore, in another embodiment, in S707, without referring to the matching search word group, the second word group module 605 extracts all consecutive words that meet the keyword length from the text to be matched, and generates one or more word groups to be matched.
[0422] For example, suppose the keyword is "oolong tea", the index word extracted from the keyword is "oolong", the index word length is 2, and the keyword length is 3.
[0423] The user entered the text: "Would you like to drink oolong tea?".
[0424] Based on the index word group length of 2, extract the word groups to be matched: "you want", "want to drink", "drink oolong", "dragon tea", "tea?"
[0425] There exists a ciphertext index group that matches the ciphertext retrieval group.
[0426] Based on a keyword length of 3, extract all consecutive characters that satisfy the keyword length of 3 from "Do you want to drink oolong tea?" and generate matching word groups including: "Do you want to drink", "Want to drink oolong", "Drink oolong", "Oolong tea", "Dragon tea?"
[0427] According to the method of this application embodiment, when extracting the matching word group from the text to be matched, only the keyword length is satisfied, and the matching word group corresponding to the ciphertext retrieval word group that matches the ciphertext index word group is not referenced.
[0428] According to the method of this application embodiment, when extracting the word group to be matched from the text to be matched, it is not necessary to recognize the text of the text to be matched, which simplifies the operation process and reduces the amount of data processing consumed.
[0429] S708, the confidentiality processing module 609 performs confidentiality processing on one or more groups of characters to be matched based on the second confidentiality processing method, and generates one or more ciphertext matching groups.
[0430] The second confidentiality method is to generate encrypted keywords.
[0431] In one embodiment, the security processing module 607 and the security processing module 609 may be the same module.
[0432] In one embodiment, for the convenience of implementing confidentiality processing and simplifying the implementation of the solution, the first confidentiality processing method and the second confidentiality processing method are the same confidentiality processing method.
[0433] In another embodiment, the first confidentiality processing method and the second confidentiality processing method are different confidentiality processing methods.
[0434] In this way, even if the first confidentiality processing method is cracked and the illegal user reversely obtains the index word group according to the ciphertext index word group, it is impossible to further reversely obtain the keyword according to the ciphertext keyword, thereby improving the confidentiality level of the keyword and ensuring the data security of the keyword.
[0435] S709, the second matching module 606 calls the ciphertext keyword saved in the storage module 601.
[0436] In one embodiment, according to any ciphertext index word group saved in the storage module 601, the ciphertext keyword corresponding to the ciphertext index word group can be determined.
[0437] In S709, according to the ciphertext index word group that matches the ciphertext retrieval word group in S704, the ciphertext keyword corresponding to the ciphertext index word group is called.
[0438] For example, assume the keywords are "oolong tea" and "jasmine tea", the index word groups extracted from the keywords are "oolong" and "jasmine", the length of the index word group is 2, and the lengths of the keywords are 3 and 4.
[0439] The user inputs the text: "Do you want to drink oolong tea?".
[0440] Based on the index word group length of 2, the words to be matched are extracted: "Do you", "you want", "want to", "to drink", "drink oolong", "oolong tea", "tea?".
[0441] There is a ciphertext index word group that matches the ciphertext retrieval word group. The ciphertext index word group that matches the ciphertext retrieval word group corresponds to "oolong", and the corresponding keyword length is 3.
[0442] Based on the keyword length of 3, starting from "oolong" in "Do you want to drink oolong tea?", the consecutive words that meet the keyword length of 3 are extracted, and the word group to be matched generated is "oolong tea".
[0443] Based on the fact that the ciphertext index word group that matches the ciphertext retrieval word group corresponds to "oolong", the corresponding ciphertext keyword is the ciphertext keyword corresponding to the corresponding keyword "oolong tea".
[0444] Therefore, in S709, the ciphertext keyword corresponding to the keyword "oolong tea" is called.
[0445] For another example, assume the keywords are "oolong tea", "chrysanthemum tea", "jasmine tea", and "green tea". The index word groups extracted from the keywords are "oolong", "chrysanthemum", "jasmine", and "green tea". The length of the index word groups is 2, and the lengths of the keywords are 2, 3, and 4.
[0446] The user inputs the text: "Do you want to drink oolong tea or chrysanthemum tea?".
[0447] Based on the length of the index word group 2, extract the word groups to be matched: "Do you", "you want", "want to", "to drink", "drink oolong", "oolong tea", "tea or", "or chrysanthemum", "chrysanthemum tea", "tea?".
[0448] There are ciphertext index word groups that match the ciphertext retrieval word groups. The ciphertext index word groups that match the ciphertext retrieval word groups correspond to "oolong" and "chrysanthemum", and the corresponding keyword lengths are 3.
[0449] Based on the keyword length 3, extract the consecutive words starting from "oolong" and "chrysanthemum" that satisfy the keyword length 3 from "Do you want to drink oolong tea?". The word groups to be matched generated are "oolong tea" and "chrysanthemum tea".
[0450] Based on the ciphertext index word groups that match the ciphertext retrieval word groups corresponding to "oolong" and "chrysanthemum", the corresponding ciphertext keywords are the ciphertext keywords of the corresponding keywords "oolong tea" and "chrysanthemum tea".
[0451] Therefore, in S709, call the ciphertext keywords corresponding to the keywords "oolong tea" and "chrysanthemum tea".
[0452] According to the method of the embodiment of the present application, useless ciphertext keywords can be eliminated, reducing the number of ciphertext keywords participating in the matching operation and consuming the data processing amount of the matching operation.
[0453] Further, in another embodiment, call all the ciphertext keywords in S709.
[0454] For example, assume the keywords are "oolong tea" and "jasmine tea". The index word groups extracted from the keywords are "oolong" and "jasmine". The length of the index word groups is 2, and the lengths of the keywords are 3 and 4.
[0455] The user inputs the text: "Do you want to drink oolong tea?".
[0456] Based on the length of the index word group 2, extract the word groups to be matched: "Do you", "you want", "want to", "to drink", "drink oolong", "oolong tea", "tea?".
[0457] There are ciphertext index word groups that match the ciphertext retrieval word groups. The ciphertext index word groups that match the ciphertext retrieval word groups correspond to "oolong", and the corresponding keyword length is 3.
[0458] Based on the keyword length of 3, extract the consecutive characters starting from "Oolong" in "Do you want to drink oolong tea?" that meet the keyword length of 3, and generate the word group to be matched as "oolong tea".
[0459] In S709, without considering the ciphertext keywords corresponding to the ciphertext index word groups that match the ciphertext retrieval word groups, call the ciphertext keywords corresponding to all keywords "oolong tea", "jasmine tea".
[0460] For another example, assume the keywords are "oolong tea", "chrysanthemum tea", "jasmine tea", "green tea", and the index word groups extracted from the keywords are "oolong", "chrysanthemum", "jasmine", "green tea", with the index word group length being 2 and the keyword lengths being 2, 3, 4.
[0461] The user inputs the text: "Do you want to drink oolong tea or chrysanthemum tea?".
[0462] Based on the index word group length of 2, extract the word groups to be matched: "Do you", "you want", "want to", "to drink", "drink oolong", "oolong tea", "tea or", "or chrysanthemum", "chrysanthemum tea", "jasmine tea".
[0463] There are ciphertext index word groups that match the ciphertext retrieval word groups. The ciphertext index word groups that match the ciphertext retrieval word groups correspond to "oolong" and "chrysanthemum", and the corresponding keyword length is 3.
[0464] Based on the keyword length of 3, extract the consecutive characters starting from "oolong" and "chrysanthemum" in "Do you want to drink oolong tea?" that meet the keyword length of 3, and generate the word groups to be matched as "oolong tea" and "chrysanthemum tea".
[0465] In S709, without considering the ciphertext keywords corresponding to the ciphertext index word groups that match the ciphertext retrieval word groups, call the ciphertext keywords corresponding to all keywords "oolong tea", "chrysanthemum tea", "jasmine tea", "green tea".
[0466] According to the method of the embodiment of the present application, when calling the ciphertext keywords, do not consider the specific matching situation between the ciphertext retrieval word groups and the ciphertext index word groups, only confirm whether there is a match, and call all the ciphertext keywords when there is a match.
[0467] According to the method of the embodiment of the present application, there is no need to record the correspondence between the ciphertext index word groups and the ciphertext keywords, thus simplifying the data storage structure.
[0468] Furthermore, in another embodiment, in S709, the second matching module 606 calls all the ciphertext keywords in the ciphertext keyword group corresponding to the current keyword matching scenario according to the current keyword matching scenario.
[0469] According to the method in the embodiments of this application, useless ciphertext keywords can be removed according to the application scenario requirements, thereby reducing the number of ciphertext keywords participating in the matching operation and reducing the data processing consumption of the matching operation.
[0470] S710, the second matching module 606 matches one or more ciphertext matching word groups generated in S708 with the ciphertext keywords called in S709 to obtain the matching results.
[0471] In one embodiment, the matching result obtained in S710 includes either a ciphertext matching word group and a ciphertext keyword that match each other, or no ciphertext matching word group and ciphertext keyword that match each other.
[0472] In another embodiment, the matching result obtained by S710 also includes the number of ciphertext keywords that match the ciphertext matching word group.
[0473] In another embodiment, the matching result obtained by S710 also includes keyword tags of ciphertext keywords that match the ciphertext matching word group.
[0474] S711, output module 608 outputs the final matching result based on the matching result of S710.
[0475] In one embodiment, when S706 to S710 are executed for each set of mutually matching ciphertext search word groups, and all matching results of S710 are that there are no mutually matching ciphertext matching word groups and ciphertext keywords, the output module 608 outputs that the text to be matched does not contain keywords.
[0476] When executing S706 to S710 for each pair of mutually matching ciphertext search word groups, if the matching result of S710 is that there are mutually matching ciphertext matching word groups and ciphertext keywords, the output module 608 outputs the text to be matched containing keywords.
[0477] Furthermore, in one embodiment, the output module 608 also outputs the total number of ciphertext keywords that match the ciphertext matching group, which is the sum of the number of ciphertext keywords that match the ciphertext matching group in all the matching results obtained in S710.
[0478] Furthermore, in one embodiment, the output module 608 also outputs keyword tags of ciphertext keywords that match the ciphertext matching group. The keyword tags output by the output module 608 are the set of keyword tags of ciphertext keywords that match the ciphertext matching group in all the matching results obtained in S710.
[0479] The method provided in this application is applied to electronic devices. This application does not limit the type of electronic device that can implement the method proposed in this application. Those skilled in the art can select the appropriate electronic device to implement the method provided in this application according to the application scenario requirements.
[0480] For example, in one embodiment, the device can be implemented using a terminal device. This terminal device can be any interactive terminal device that can interact with the user, such as a mobile phone, tablet, laptop, desktop computer, augmented reality (AR) device, or VR device.
[0481] In the description of the embodiments of this application, for the sake of convenience, the device is described by dividing it into various modules according to its functions. The division of each module is only a logical functional division. When implementing the embodiments of this application, the functions of each module can be implemented in one or more software and / or hardware.
[0482] Specifically, the apparatus proposed in this application can be fully or partially integrated onto a single physical entity (e.g., a GPU or other type of processor), or it can be physically separated. These modules can be implemented entirely in software via processing element calls; entirely in hardware; or some modules can be implemented in software via processing element calls, while others are implemented in hardware. For example, the detection module can be a separate processing element or integrated into a chip in an electronic device. The implementation of other modules is similar. Furthermore, these modules can be fully or partially integrated together or implemented independently. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0483] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs). Alternatively, these modules can be integrated together as a system-on-a-chip (SOC).
[0484] In one embodiment, the keyword matching device provided in this application can be implemented on an electronic device, which includes all the modules of the keyword matching device provided in this application.
[0485] An embodiment of this application also proposes an electronic device (e.g., a mobile phone, AR glasses). This electronic device is used to execute the keyword matching method flow or part of the method flow described in the embodiments of this application.
[0486] Figure 14 This is a schematic diagram of an electronic device structure according to an embodiment of this application.
[0487] like Figure 14 As shown, the electronic device 2400 includes: a bus 2404, a processor 2401, a memory 2402, and a communication interface 2403. The processor 2401, the memory 2402, and the communication interface 2403 communicate with each other via the bus 2404.
[0488] Electronic device 2400 may be a server or a terminal device. It should be understood that this application does not limit the number of processors or memories in electronic device 2400.
[0489] It is understood that the structural description of the electronic device 2400 in this application does not constitute a specific limitation on the electronic device 2400. In other embodiments of this application, the electronic device 2400 may include other components besides the processor 2401 and the memory 2402.
[0490] The 2404 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 16 The bus 2404 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 2404 may include a path for transmitting information between various components of the electronic device 2400 (e.g., memory 2402, processor 2401, communication interface 2403).
[0491] Processor 2401 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0492] The processor 2401 may be an on-chip device (SOC) that may include a central processing unit (CPU) and may further include other types of processors.
[0493] The processor 2401 may include, for example, a CPU, DSP, microcontroller, or digital signal processor, and may also include a GPU, embedded neural network processing units (NPUs), and image signal processors (ISPs). The processor may also include necessary hardware accelerators or logic processing hardware circuitry, such as an ASIC, or one or more integrated circuits for controlling the execution of the program in this application. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in a storage medium.
[0494] Processor 2401 may include one or more processing units. For example, a processor may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent components or integrated into one or more processors. In some embodiments, electronic device 2400 may also include one or more processors 2401. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0495] In some embodiments, the processor 2401 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. The USB interface is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface can be used to connect a charger to charge the electronic device, and can also be used for data transfer between the electronic device and peripheral devices.
[0496] The memory 2402 may include volatile memory, such as random access memory (RAM). The processor 2401 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0497] The memory 2402 stores executable program code, and the processor 2401 executes the executable program code to implement the aforementioned functions, thereby implementing the method proposed in the embodiments of this application. That is, the memory 2402 stores instructions for executing the method proposed in the embodiments of this application.
[0498] The memory 2402 may include a code storage area and a data storage area. The code storage area may store the operating system. The data storage area may store data created during the use of the electronic device 2400. Furthermore, the memory 2402 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc.
[0499] The memory 2402 may be a read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), or other types of dynamic storage devices capable of storing information and instructions. It may also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices. Alternatively, it may be any computer-readable medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer.
[0500] Processor 2401 and memory 2402 can be combined into a single processing device, but more commonly they are separate components.
[0501] The communication interface 2403 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the electronic device 2400 and other devices or communication networks.
[0502] The electronic device 2400 may also include an external memory interface for connecting an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 2401 through the external memory interface to perform data storage functions. For example, music, video, and other files can be stored on the external memory card.
[0503] In another embodiment, the keyword matching device provided in this application can be implemented on multiple electronic devices. For example, a terminal device and a cloud server connected to the terminal device. Or, for example, multiple interconnected terminal devices.
[0504] An embodiment of this application also proposes an electronic device cluster. The electronic device cluster includes at least one electronic device, each electronic device including a memory and a processor; the processor of the at least one electronic device in the electronic device cluster is used to execute instructions stored in the memory of the at least one electronic device in the electronic device cluster, so that the electronic device cluster performs the method described in the embodiment of this application.
[0505] Figure 15 This is a schematic diagram of an electronic device cluster according to an embodiment of this application.
[0506] like Figure 15As shown, the electronic device cluster includes at least one electronic device 2500 (the structure of electronic device 2500 can be referred to as electronic device 2400). Electronic device 2500 can be a server or a terminal device. Each electronic device 2500 includes: a bus 2504 (refer to bus 2404), a processor 2501 (refer to processor 2401), a memory 2502 (refer to memory 2402), and a communication interface 2503 (refer to communication interface 2403).
[0507] The memory 2501 of one or more electronic devices in the electronic device cluster may contain the same instructions for performing the methods proposed in the embodiments of this application.
[0508] In some possible implementations, the memory 2501 of one or more electronic devices 2500 in the electronic device cluster may also store partial instructions for executing the keyword matching method proposed in the embodiments of this application. In other words, a combination of one or more electronic devices 2500 can jointly execute the instructions for executing the keyword matching method proposed in the embodiments of this application.
[0509] It should be noted that the memory 2501 in different electronic devices 2500 in the electronic device cluster can store different instructions, which are used to execute some functions of the keyword matching device proposed in the embodiments of this application.
[0510] In some possible implementations, one or more electronic devices in an electronic device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc.
[0511] Figure 16 This is a schematic diagram of an electronic device cluster network connection according to an embodiment of this application.
[0512] like Figure 16 As shown, the two electronic devices 2600A and 2600B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each electronic device. The structures of electronic devices 2600A and 2600B can be referenced from electronic device 2400.
[0513] Electronic device 2600A includes: bus 2604A (refer to bus 2404), processor 2601A (refer to processor 2401), memory 2602A (refer to memory 2402) and communication interface 2603A (refer to communication interface 2403).
[0514] Electronic device 2600B includes: bus 2604B (refer to bus 2404), processor 2601B (refer to processor 2401), memory 2602B (refer to memory 2402) and communication interface 2603B (refer to communication interface 2403).
[0515] In one embodiment, electronic device 2600A is a terminal device, and electronic device 2600B is a server.
[0516] It should be understood that Figure 16 The functions of electronic device 2600A shown can also be performed by multiple electronic devices. Similarly, the functions of electronic device 2500B can also be performed by multiple electronic devices.
[0517] An embodiment of this application also provides an electronic chip. This electronic chip is used to execute the method flow or part of the method flow described in the embodiments of this application.
[0518] Specifically, the electronic chip includes a processor for executing program instructions. When the computer program instructions are executed by the processor, the electronic chip is triggered to perform the steps described in the embodiments of this application. The processor of the electronic chip can refer to the processor of the above-described electronic device.
[0519] The devices, apparatuses, and modules described in the embodiments of this application can be implemented by computer chips or physical entities, or by products with certain functions.
[0520] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code.
[0521] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0522] Specifically, one embodiment of this application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the method provided in the embodiment of this application.
[0523] An embodiment of this application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to perform the method provided in the embodiment of this application.
[0524] The embodiments described in this application are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0525] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0526] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0527] It should also be noted that in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0528] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0529] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0530] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0531] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments of this application can be implemented using electronic hardware, computer software, or a combination of electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0532] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0533] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A keyword matching method, characterized in that, The method is applied to an electronic device, and the method includes: Extract all consecutive characters that meet the index group length from the text to be matched, and generate one or more character groups to be retrieved, wherein the index group length is a preset value; Based on the first confidentiality processing method, the one or more groups of characters to be retrieved are confidentialized to generate one or more ciphertext search groups. The first confidentiality processing method is the confidentiality processing method for generating ciphertext search groups. The ciphertext search groups are the data generated by confidentializing the search groups. The search groups are continuous characters extracted from the keywords according to the length of the index groups. Match the one or more ciphertext search word groups with the ciphertext index word groups; When a ciphertext search word group matching the ciphertext index word group exists, obtain the length of one or more keywords; Extract consecutive characters that satisfy the length of one or more keywords from the text to be matched, and generate one or more groups of characters to be matched; Based on the second confidentiality processing method, the one or more groups of characters to be matched are confidentialized to generate one or more ciphertext matching groups, wherein the second confidentiality processing method is a confidentiality processing method for generating ciphertext keywords, and the ciphertext keywords are data generated by confidentializing the keywords; The one or more ciphertext matching word groups are matched with the ciphertext keywords to obtain the matching results.
2. The method according to claim 1, characterized in that: The first confidentiality processing method and the second confidentiality processing method are the same confidentiality processing method; or, The first confidentiality processing method and the second confidentiality processing method are different confidentiality processing methods.
3. The method according to claim 1, characterized in that, The process of obtaining the length of one or more keywords includes: Get the length of all keywords; or, Get the keyword length corresponding to the ciphertext index group that matches the ciphertext search group.
4. The method according to claim 1, characterized in that, The step of matching the one or more ciphertext matching word groups with the ciphertext keywords to obtain matching results includes: Match the one or more ciphertext matching word groups with all ciphertext keywords to obtain the matching results; or, The one or more ciphertext matching word groups are matched with the ciphertext keywords corresponding to the ciphertext index word groups that match the ciphertext retrieval word groups to obtain the matching results.
5. The method according to any one of claims 1-4, characterized in that, Different ciphertext keywords correspond to different ciphertext index word groups.
6. The method according to any one of claims 1-4, characterized in that, The word group to be matched is any consecutive word in the text to be matched that meets the keyword length.
7. The method according to any one of claims 1-4, characterized in that, The target word group is a continuous string of words in the target text that meets the keyword length and contains a matching search word group. The matching search word group is the target word group corresponding to the ciphertext search word group that matches the ciphertext index word group.
8. The method according to claim 7, characterized in that, The search term group is a series of consecutive characters extracted from the keyword, starting from the first character of the keyword and following the length of the index term group.
9. The method according to claim 8, characterized in that, The step of extracting consecutive characters from the text to be matched that satisfy the length of one or more keywords, and generating one or more groups of characters to be matched, includes: Starting from the matching search word group in the text to be matched, extract consecutive words that meet the length of one or more keywords to generate the one or more word groups to be matched.
10. An electronic equipment cluster, characterized in that, The electronic device cluster includes at least one electronic device, each electronic device including a memory and a processor; The processor of the at least one electronic device is configured to execute instructions stored in the memory of the at least one electronic device to cause the cluster of electronic devices to perform the method as described in any one of claims 1-9.
11. A computer program product containing instructions, characterized in that, When the instruction is executed by the electronic device system, it causes the electronic device cluster to perform the method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a computer system, perform the method as described in any one of claims 1-9.