A keyword matching method and device across language environments and electronic equipment
By performing word segmentation and synonym expansion on source language keywords, as well as semantic-level fuzzy matching technology, the problem of low accuracy in information retrieval in cross-language environments is solved, achieving more efficient cross-language matching results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU WANGAN TECH DEV CO LTD
- Filing Date
- 2022-12-28
- Publication Date
- 2026-07-24
AI Technical Summary
In cross-language environments, the accuracy of information retrieval in existing technologies is low, especially when non-native speakers input keywords in their native language and the retrieved non-native language text information differs greatly from the expected content or there are too many missed detections.
By segmenting the source language keywords into short or long keyword strings, cross-language matching is performed based on a thesaurus and semantic matching technology. The matching degree is calculated by combining the semantic matching value with the overall relevance, thereby optimizing the accuracy of cross-language matching.
It improves the accuracy of information retrieval in cross-language environments, reduces false negatives and limitations in keyword matching, and ensures the accuracy of matching results.
Smart Images

Figure CN115906817B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information retrieval technology, and more specifically, to a keyword matching method, apparatus, and electronic device for cross-language environments. Background Technology
[0002] In the process of information retrieval, users inevitably encounter the need to search for non-native language text information. This poses a significant challenge for users who are not proficient in other non-native languages. After entering keywords in their native language, the non-native language text information retrieved may differ greatly from the content information the user expects or may have too many omissions. How to improve the accuracy of information retrieval in such cross-language environments is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0003] To address the aforementioned technical problems, this application provides a keyword matching method, apparatus, and electronic device for cross-language environments.
[0004] In a first aspect, embodiments of this application provide a keyword matching method across language environments, the method comprising:
[0005] Retrieve source language keywords used to match target language text, where the target language and source language are different languages;
[0006] The source language keywords are segmented into short keyword strings or long keyword strings based on the segmentation results.
[0007] When the source language keyword is the short keyword string, a target language synonym keyword group corresponding to the source language keyword is obtained based on the source language keyword, and the target language text is matched using the target language synonym keyword group. The target language text including the keywords in the target language synonym keyword group is taken as the target language matching text.
[0008] When the source language keyword is the long keyword string, the target language text is segmented to obtain a segment set of the target language text. The target language keyword corresponding to the source language keyword is matched with the segments in the segment set, and the target language text corresponding to the segments that match the target language keyword is taken as the target language matching text.
[0009] In one possible implementation, the step of segmenting the source language keywords to obtain short keyword strings and long keyword strings includes:
[0010] The source language keywords are segmented using the longest segmentation strategy to obtain a sequence of source language keywords.
[0011] Based on the number of words contained in the source language keyword sequence, the source language keywords are classified into short keyword strings or long keyword strings.
[0012] In one possible implementation, the step of obtaining a target language synonym keyword group corresponding to the source language keyword based on the source language keyword when the source language keyword is the short keyword string, matching the target language text using the target language synonym keyword group, and using the target language text including keywords from the target language synonym keyword group as the target language matching text includes:
[0013] When the source language keyword is the short keyword string, a thesaurus is used to expand the meaning of the source language keyword to obtain a group of synonyms for the source language keyword;
[0014] The keywords in the synonym keyword group are translated using the target language to obtain the target language synonym keyword group corresponding to the synonym keyword group;
[0015] The keywords in the target language synonym keyword group are sequentially input into different target language texts for pattern matching to obtain matching information between different target language texts and the keywords in the target language synonym keyword group. The matching information includes the number of times the target language text matches the keywords in the target language synonym keyword group, the position of the matched keywords in the target language text, and the number of different keywords matched by the target language text.
[0016] The target language text containing the matching information is used as the target language matching text for the source language keyword.
[0017] In one possible implementation, when the source language keyword is the long keyword string, the step of segmenting the target language text to obtain a segment set of the target language text, matching the target language keyword corresponding to the source language keyword with the segments in the segment set, and taking the target language text corresponding to the segments that match the target language keyword as the target language matching text includes:
[0018] When the source language keyword is the long keyword string, the target language text is segmented to obtain a segment set of the target language text;
[0019] The target language keywords are obtained by translating the source language keywords into the target language.
[0020] Calculate the semantic matching parameters between the target language keywords and each segment in the segment set;
[0021] Calculate the overall relevance parameter between the target language keywords and the target language text;
[0022] The matching degree parameter between the target language keyword and the target language text is calculated based on the semantic matching parameter and the overall relevance parameter.
[0023] The matching degree parameter is compared with a preset matching degree threshold. When the matching degree parameter is greater than the preset matching degree threshold, the target language text is used as the target language matching text that matches the source language keyword.
[0024] In one possible implementation, the step of segmenting the target language text to obtain a segment set of the target language text includes:
[0025] The target language text is denoised.
[0026] The denoised target language text is segmented using preset punctuation marks to obtain a segment set of the target language text. When the target language is English or Chinese, the preset punctuation marks include one or more combinations of period, exclamation mark, question mark, tab, line break, semicolon, and comma.
[0027] In one possible implementation, the step of calculating the semantic matching parameters between the target language keywords and each segment in the segment set includes:
[0028] The semantic similarity value between each segment of the target language text and the same target language keyword is calculated by performing semantic matching on each segment of the target language text segment set. The maximum value among the semantic similarity values between each segment of the segment set and the same target language keyword is taken as the maximum semantic similarity value between the segment of the segment set and the same target language keyword.
[0029] The maximum semantic similarity value between the segment in the segment set and the target language keyword is normalized to obtain a normalized semantic similarity value. The maximum normalized semantic similarity value is equal to the ratio of the difference between the maximum semantic similarity value and the minimum value of the similarity theory to the difference between the maximum value of the similarity theory and the minimum value of the similarity theory.
[0030] The maximum normalized semantic similarity value is compared with a preset normalized semantic similarity threshold. If the maximum normalized semantic similarity value is less than the preset normalized semantic similarity threshold, it is determined that there is no segment in the segment set of the target language text that matches the target language keyword. If the maximum normalized semantic similarity value is greater than or equal to the preset normalized semantic similarity threshold, it is determined that there is a segment in the segment set of the target language text that matches the target language keyword, and the maximum normalized semantic similarity value is used as the semantic matching parameter between the target language keyword and each segment in the segment set.
[0031] In one possible implementation, the step of calculating the overall relevance parameter between the target language keywords and the target language text includes:
[0032] In the vector space model, the word frequency-inverse text frequency index is used as the weight to calculate the cosine similarity between the target language keyword and the target language text, and the cosine similarity is used as the overall relevance parameter between the target language keyword and the target language text; wherein, the vector space model is constructed based on the corpus in the target language library.
[0033] In one possible implementation, the step of calculating the overall matching degree parameter between the target language keyword and the target language text based on the semantic matching parameter and the overall relevance parameter includes:
[0034] The semantic matching parameters and the overall relevance parameters are weighted and summed to obtain the overall matching degree parameter between the target language keywords and the target language text;
[0035] The formula for calculating the matching degree parameter M is as follows:
[0036] M = α*L + β*N
[0037] Wherein, α and β are empirical parameters, which are adjusted according to the algorithm used to perform semantic matching on the segment set of the target language text segment by segment based on the target language keywords, L is the semantic matching parameter, and N is the overall relevance parameter.
[0038] Secondly, embodiments of this application also provide a keyword matching device for cross-language environments, the device comprising:
[0039] The acquisition module is used to acquire source language keywords for matching target language text, where the target language and the source language are different languages;
[0040] The word segmentation and partitioning module is used to segment the source language keywords into short keyword strings or long keyword strings based on the word segmentation results.
[0041] The matching module is used to obtain a target language synonym keyword group corresponding to the source language keyword based on the source language keyword when the source language keyword is the short keyword string, use the target language synonym keyword group to match the target language text, and take the target language text including the keywords in the target language synonym keyword group as the target language matching text.
[0042] The matching module is used to segment the target language text to obtain a segment set of the target language text when the source language keyword is the long keyword string, and to match the target language keyword corresponding to the source language keyword with the segments in the segment set, and to take the target language text corresponding to the segments that match the target language keyword as the target language matching text.
[0043] Thirdly, embodiments of this application also provide an electronic device, the electronic device including a processor, a communication unit and a computer-readable storage medium, the processor and the computer-readable storage medium being connected via a bus system, the communication unit being used to connect with other electronic devices to achieve mutual data interaction, the computer-readable storage medium being used to store programs, instructions or code, and the processor being used to execute the programs, instructions or code in the computer-readable storage medium to implement the cross-language environment keyword matching method in any possible implementation of the first aspect.
[0044] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed, cause an electronic device to perform the cross-language keyword matching method in the first aspect or any possible implementation thereof.
[0045] Based on any of the above aspects, embodiments of this application provide a keyword matching method, apparatus, and electronic device for cross-language environments. First, source language keywords for matching target language text are obtained. Next, the source language keywords are segmented into short keyword strings or long keyword strings. Then, when the source language keywords are short keyword strings, cross-language keyword matching is performed through semantic expansion to optimize the false negative problem of precise matching of source language keywords. When the source language keywords are long keyword strings, cross-language matching of source language keywords is performed based on semantic-level fuzzy matching technology to optimize the limitations and false negative problem of precise matching of source language keywords. The overall matching degree of the keywords is calculated by combining the semantic matching value with the overall relevance of the target text of the matched segment, so as to comprehensively consider the overall matching degree and local matching degree of the source language keywords. The above scheme can adopt different matching strategies based on the classification of source language keywords to ensure the accuracy of the matching results. Attached Figure Description
[0046] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings required in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A flowchart illustrating the keyword matching method across language environments provided in this application embodiment;
[0048] Figure 2 for Figure 1 A flowchart illustrating the sub-steps of step S13;
[0049] Figure 3 for Figure 1 A flowchart illustrating the sub-steps of step S14;
[0050] Figure 4 A schematic diagram of the functional modules of the keyword matching device for cross-language environments provided in the embodiments of this application;
[0051] Figure 5 A schematic diagram of a possible structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0053] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0054] To address the technical problems mentioned in the background section, the prior art offers the following two possible solutions.
[0055] The first approach is to translate the original target language text into a translated version in the source language, and then use a source language keyword matching method for matching. The second approach is to translate both the target language text and the source language keywords into an intermediate language, and then match the translated source language keywords with the translated target language text.
[0056] The inventors discovered that in the first approach, the target language text is often quite large in typical application environments, resulting in a significant workload. However, this approach maximizes the preservation of textual and contextual information within the target language text, aiding in translation disambiguation and improving accuracy. The advantages of this approach include: First, the language of the search results matches the language used for matching, facilitating user selection of the information they need for subsequent matching; second, the target language text translation retains a broader contextual information, further contributing to translation disambiguation. The disadvantages of this approach include: First, the large volume of target language text requiring translation leads to a substantial workload and high translation costs; second, the use of machine translation technology during the translation process is necessary, but current machine translation technology cannot guarantee accuracy for large-scale translations, potentially resulting in numerous translation errors, especially with larger volumes of content, which may lead to mismatches with source language keywords; third, the large workload also slows down the system's operation.
[0057] In the second approach, the intermediate language is chosen to be one of the most commonly used languages, such as the widely used English. This approach is suitable for situations where the source language keywords and the target language text are not mutually convertible; in other words, there is no direct correspondence between the source language keywords and the target language text in the translation resources. In this case, another intermediate language is needed to convert both the source and target languages before retrieving relevant information. Alternatively, the source language query can be translated into the target language text using this intermediate language before retrieving relevant information from the target language text. However, the second approach suffers from the same problems as the first approach and is less efficient.
[0058] To address the technical problems of high translation workload, high translation cost, and low matching efficiency in the above-mentioned solutions, this application provides a cross-language environment keyword matching method to solve the above-mentioned technical problems. Please refer to... Figure 1 , Figure 1 A flowchart illustrating the cross-language keyword matching method provided in this application embodiment is shown. This cross-language keyword matching method is executed by an electronic device. The order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The detailed steps of the cross-language keyword matching method are described below.
[0059] Step S11: Obtain source language keywords for matching target language text.
[0060] In this embodiment of the application, the electronic device can obtain source language keywords by having the user input source language keywords on the display interface, or by importing a table containing source language keywords.
[0061] The target language and the source language are different languages. For example, the target language can be English, and the source language can be Chinese.
[0062] Step S12: Perform word segmentation on the source language keywords, and divide the source language keywords into short keyword strings or long keyword strings based on the word segmentation results.
[0063] In this step, firstly, before word segmentation, non-searchable words (such as stop words) in the source language keywords can be removed; then, the source language keywords are segmented using the longest word segmentation strategy to obtain the source language keyword sequence; then, based on the number of words contained in the source language keyword sequence, the source language keywords are classified into short keyword strings or long keyword strings.
[0064] In this embodiment, general word segmentation tools or methods can be used for word segmentation. Taking Chinese as the source language as an example, word segmentation based on a double-array Trie tree can be used. A short keyword string is a keyword string containing one basic word, while a long keyword string is a keyword string containing at least two basic words.
[0065] Step S13: When the source language keyword is a short keyword string, obtain the target language synonym keyword group corresponding to the source language keyword based on the source language keyword, use the target language synonym keyword group to match the target language text, and take the target language text that includes the keywords in the target language synonym keyword group as the target language matching text.
[0066] Step S14: When the source language keyword is a long keyword string, the target language text is segmented to obtain a segment set of the target language text. The target language keyword corresponding to the source language keyword is matched with the segment in the segment set. The target language text corresponding to the segment that matches the target language keyword is taken as the target language matching text.
[0067] The proposed solution translates source language keywords into the target language for matching, taking advantage of the shorter translation time due to the smaller number of source language keywords. Furthermore, when the source language keywords are short strings, semantic expansion is used for cross-language keyword matching to mitigate the issue of missed detections in exact match. For long strings, semantic-level fuzzy matching is used to optimize cross-language matching, addressing the limitations and missed detections of exact match. The overall keyword matching degree is calculated by combining semantic matching values with the overall relevance of the target text in the matched segment, comprehensively considering both the overall and local matching degrees of the source language keywords. This solution can employ different matching strategies based on the source language keyword classification to ensure the accuracy of the matching results.
[0068] Further, please refer to Figure 2 In this embodiment of the application, step S13 can be implemented through the following sub-steps.
[0069] Sub-step S131: When the source language keyword is a short keyword string, a thesaurus is used to expand the meaning of the source language keyword to obtain a group of synonyms for the source language keyword.
[0070] A thesaurus can be a mature Natural Language Processing (NLP) auxiliary tool. For example, when the source language is Chinese, the thesaurus can be an auxiliary tool such as "Thesaurus of Synonyms". It is understood that in the embodiments of this application, the thesaurus can include source language keywords and synonyms of source language keywords, or it can only include the source language keywords themselves.
[0071] Sub-step S132 involves translating the keywords in the synonym keyword group using the target language to obtain the target language synonym keyword group corresponding to the synonym keyword group.
[0072] In this embodiment of the application, a machine translation tool can be used to translate the keywords in the synonym keyword group, and the duplicate results in the translated target language synonym keyword group can be deduplicated. The machine translation tool can be an existing mature translation tool, which will not be described in detail here.
[0073] Sub-step S133 involves sequentially inputting the keywords from the target language synonym keyword group into different target language texts for pattern matching, thereby obtaining matching information between the different target language texts and the keywords from the target language synonym keyword group.
[0074] In this step, exact matching is used for pattern matching. For example, the matching method can be an exact single-pattern or multi-pattern matching algorithm such as the AC algorithm or the BM algorithm. The matching information includes the number of times the target language text matches keywords in the target language synonym group, the position of the matched keywords in the target language text, and the number of different keywords matched in the target language text.
[0075] Sub-step S134: The target language text containing matching information is used as the target language matching text of the source language keywords.
[0076] Further, please refer to Figure 3 In this embodiment of the application, step S14 can be implemented through the following sub-steps.
[0077] Sub-step S141: When the source language keyword is the long keyword string, the target language text is segmented to obtain a segment set of the target language text.
[0078] Sub-step S142 involves translating the source language keywords into the target language to obtain the target language keywords.
[0079] In this sub-step, the target language text can first be denoised, and then the denoised target language text can be segmented using preset punctuation marks to obtain a set of segmented target language text. The length of each segment in the segmented set is within a certain length range. For example, in the embodiments of this application, when the target language is English or Chinese, the preset punctuation marks include one or more combinations of period, exclamation mark, question mark, tab, newline, semicolon, and comma.
[0080] Sub-step S143: Calculate the semantic matching parameters between the target language keywords and each segment in the segment set.
[0081] In the embodiments of this application, sub-step S143 can be implemented in the following ways.
[0082] First, semantic matching is performed segment by segment on the target language text using the same target language keyword, and the semantic similarity value between each segment in the segment set and the same target language keyword is calculated. The maximum semantic similarity value among the semantic similarity values between each segment in the segment set and the same target language keyword is taken as the maximum semantic similarity value between the segment in the segment set and the same target language keyword.
[0083] Next, the maximum semantic similarity value K between the segments in the segment set and the keywords of the same target language is normalized to obtain the maximum normalized semantic similarity value L. The maximum normalized semantic similarity value L is equal to the ratio of the difference between the maximum semantic similarity value K and the minimum value of the similarity theory to the difference between the maximum value of the similarity theory and the minimum value of the similarity theory.
[0084] Finally, the maximum normalized semantic similarity value L is compared with a preset normalized semantic similarity threshold P. When the maximum normalized semantic similarity value L is less than the preset normalized semantic similarity threshold P, it is determined that there is no segment in the segment set of the target language text that matches the target language keyword. When the maximum normalized semantic similarity value L is greater than or equal to the preset normalized semantic similarity threshold P, it is determined that there is a segment in the segment set of the target language text that matches the target language keyword, and the maximum normalized semantic similarity value L is used as the semantic matching parameter between the target language keyword and each segment in the segment set.
[0085] Sub-step S144: Calculate the overall relevance parameter between the target language keywords and the target language text.
[0086] In this embodiment, in the Vector Space Model (VSM), the cosine similarity N between the target language keywords and the target language text is calculated using the word frequency-inverse text frequency index (TF-IDF value) as weights. The cosine similarity is used as the overall relevance parameter between the target language keywords and the target language text. The Vector Space Model is constructed based on a corpus in the target language database. For example, when the target language is English, the Vector Space Model is constructed based on the Newsgroups corpus of the English corpus. The spatial dimension of the Vector Space Model can be set, for example, to 5000 dimensions.
[0087] Sub-step S145 calculates the matching degree parameter between the target language keywords and the target language text based on the semantic matching parameter and the overall relevance parameter.
[0088] In this embodiment of the application, the semantic matching parameter and the overall relevance parameter are weighted and summed to obtain the matching degree parameter between the target language keyword and the target language text.
[0089] The formula for calculating the matching degree parameter M is as follows:
[0090] M = α*L + β*N
[0091] Where α and β are empirical parameters, adjusted according to the algorithm used when semantically matching the segmented set of the target language text with the target language keywords, L is the semantic matching parameter, and N is the overall relevance parameter. In the above formula, α*L represents the highest degree of semantic matching between the source language keywords and the local part of the target language text, and β*N represents the rationality of the matching of the source language keywords in the target language text and the overall relevance.
[0092] Sub-step S146: Compare the matching degree parameter with the preset matching degree threshold. If the matching degree parameter is greater than the preset matching degree threshold, use the target language text as the target language matching text that matches the source language keyword.
[0093] For example, the matching degree parameter M is compared with a preset matching degree threshold Q. If the matching degree parameter M is greater than the preset matching degree threshold Q, the target language text is determined to match the source language keyword, and the target language text is taken as the target language matching text that matches the source language keyword. If the matching degree parameter M is less than or equal to the preset matching degree threshold Q, the target language text is determined not to match the source language keyword. The preset matching degree threshold Q is an empirical value, which can be adjusted based on α, β, and the specific algorithm used for semantic similarity calculation.
[0094] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the functional modules of a cross-language keyword matching device 200 provided in an embodiment of this application. This embodiment can divide the cross-language keyword matching device 200 into functional modules according to the method embodiments executed by the server. That is, the following functional modules corresponding to the cross-language keyword matching device 200 can be used to execute the above-mentioned method embodiments. The cross-language keyword matching device 200 may include an acquisition module 210, a word segmentation and partitioning module 220, and a matching module 230. The functions of each functional module of the cross-language keyword matching device 200 will be described in detail below.
[0095] The acquisition module 210 is used to acquire source language keywords for matching target language text.
[0096] In this embodiment of the application, the acquisition module 210 can obtain source language keywords by having the user input source language keywords on the display interface, or by importing a table containing source language keywords.
[0097] The target language and the source language are different languages. For example, the target language can be English, and the source language can be Chinese.
[0098] In this embodiment of the application, the acquisition module 210 can be used to perform the above-described step S11. For a detailed description of the implementation of the acquisition module 210, please refer to the above-described description of step S11.
[0099] The word segmentation and partitioning module 220 is used to perform word segmentation on source language keywords and divide source language keywords into short keyword strings or long keyword strings based on the word segmentation results.
[0100] In this embodiment of the application, the word segmentation and partitioning module 220 is implemented through the following process.
[0101] First, before word segmentation, non-searchable words (such as stop words) in the source language keywords can be removed. Next, the source language keywords are segmented using the longest word segmentation strategy to obtain a source language keyword sequence. Then, based on the number of words contained in the source language keyword sequence, the source language keywords are classified into short keyword strings or long keyword strings.
[0102] In this embodiment, general word segmentation tools or methods can be used for word segmentation. Taking Chinese as the source language as an example, word segmentation based on a double-array Trie tree can be used. A short keyword string is a keyword string containing one basic word, while a long keyword string is a keyword string containing at least two basic words.
[0103] In this embodiment of the application, the word segmentation and partitioning module 220 can be used to perform the above-described step S12. For a detailed description of the implementation of the word segmentation and partitioning module 220, please refer to the above-described detailed description of step S12.
[0104] The matching module 230 is used to obtain a target language synonym keyword group corresponding to the source language keyword when the source language keyword is a short keyword string, and to match the target language text using the target language synonym keyword group, and to take the target language text that includes the keywords in the target language synonym keyword group as the target language matching text.
[0105] The matching module 230 is used to segment the target language text to obtain a segment set of target language text when the source language keyword is a long keyword string, and to match the target language keyword corresponding to the source language keyword with the segments in the segment set, and to take the target language text corresponding to the segment that matches the target language keyword as the target language matching text.
[0106] In this embodiment of the application, the matching module 230 can be used to execute the above steps S13 or S14 under different circumstances. The functions implemented by the matching module 230 under different circumstances can be referred to the detailed description of steps S13 and S14 above.
[0107] It should be noted that the division of modules in the above-described device or system is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely as software (e.g., open-source software) via processor calls; they can also be implemented entirely as hardware; or some modules can be implemented via processor calls to software, while others are implemented in hardware. As an example, the matching module 230 can be implemented by a separate processor and can be stored as program code in the memory of the above-described device or system. The matching module 230 can be called and executed by a processor of the above-described device or system. The implementation of other modules is similar and will not be elaborated further here.
[0108] Please refer to Figure 5 , Figure 5 A schematic diagram of the hardware structure of an electronic device 100 for implementing the above-described cross-language keyword matching method, according to an embodiment of this disclosure, is shown. Figure 5 As shown, the electronic device 100 may include a processor 110, a computer-readable storage medium 120, a bus 130, and a communication unit 140.
[0109] In a specific implementation, the processor 110 executes computer-executable instructions (e.g., instructions stored in the computer-readable storage medium 120) stored in the computer-readable storage medium 120. Figure 4 The various modules in the cross-language keyword matching device 200 shown enable the processor 110 to execute the cross-language keyword matching method as described in the above method embodiment, wherein the processor 110 and the computer-readable storage medium 120 can be connected via a bus 130.
[0110] The specific implementation process of processor 110 can be found in the various method embodiments executed by the above-mentioned electronic device 100. The implementation principle and technical effect are similar, and will not be repeated here in the embodiments of this application.
[0111] The computer-readable storage medium 120 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The memory 110 is used to store programs or data.
[0112] Bus 130 can be divided into address bus, data bus, control bus, etc. For ease of illustration, the buses in the accompanying drawings of this application are not limited to only one bus or one type of bus.
[0113] In the interactive scenario provided in the embodiments of this application, the communication unit 140 can be used to communicate with the electronic device 100 and other electronic devices to realize data interaction between the electronic device 100 and other electronic devices. For example, the electronic device 100 can obtain matching target language text from other electronic devices through the communication unit 140.
[0114] Furthermore, this application embodiment also provides a readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the cross-language environment keyword matching method described above.
[0115] In summary, the keyword matching method, apparatus, and electronic device for cross-language environments provided in this application first obtain source language keywords for matching target language text; then, the source language keywords are segmented into short keyword strings or long keyword strings; next, when the source language keywords are short keyword strings, cross-language keyword matching is performed through semantic expansion to optimize the false negative problem of precise matching of source language keywords; when the source language keywords are long keyword strings, cross-language keyword matching is performed based on semantic-level fuzzy matching technology to optimize the limitations and false negative problem of precise matching of source language keywords. The overall matching degree of the keywords is calculated by combining the semantic matching value with the overall relevance of the target text of the matched segment, so as to comprehensively consider the overall matching degree and local matching degree of source language keywords. The above scheme can adopt different matching strategies based on the classification of source language keywords to ensure the accuracy of matching results.
[0116] The embodiments described above are merely some, not all, of the embodiments of this application. The components of the embodiments of this application typically described and illustrated in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of protection of this application, but merely to illustrate selected embodiments of this application. Based on this, the scope of protection of this application should be determined by the scope of the claims. Furthermore, all other embodiments that can be obtained by those skilled in the art based on the embodiments of this application without inventive effort should fall within the scope of protection of this application.
Claims
1. A keyword matching method for cross-language environments, characterized in that, The method includes: Retrieve source language keywords used to match target language text, where the target language and source language are different languages; The source language keywords are segmented into short keyword strings or long keyword strings based on the segmentation results. When the source language keyword is the short keyword string, a target language synonym keyword group corresponding to the source language keyword is obtained based on the source language keyword, and the target language text is matched using the target language synonym keyword group. The target language text including the keywords in the target language synonym keyword group is taken as the target language matching text. When the source language keyword is the long keyword string, the target language text is segmented to obtain a segment set of the target language text. The source language keyword is translated using the target language to obtain the target language keyword. The semantic matching parameters between the target language keyword and each segment in the segment set are calculated. The overall relevance parameter between the target language keyword and the target language text is calculated. Based on the semantic matching parameters and the overall relevance parameter, the overall matching degree parameter between the target language keyword and the target language text is calculated. The matching degree parameter is compared with a preset matching degree threshold. When the matching degree parameter is greater than the preset matching degree threshold, the target language text is taken as the target language matching text that matches the source language keyword. The step of calculating the semantic matching parameters between the target language keywords and each segment in the segment set includes: Semantic matching is performed segment by segment on the target language text using the same target language keyword. The semantic similarity value between each segment in the segment set and the same target language keyword is calculated, and the maximum value among the semantic similarity values between each segment in the segment set and the same target language keyword is taken as the maximum semantic similarity value between the segment in the segment set and the same target language keyword. The maximum semantic similarity value between the segment in the segment set and the keyword of the same target language is normalized to obtain the maximum normalized semantic similarity value. The maximum normalized semantic similarity value is equal to the ratio of the difference between the maximum semantic similarity value and the minimum value of the similarity theory to the difference between the maximum value of the similarity theory and the minimum value of the similarity theory. The maximum normalized semantic similarity value is compared with a preset normalized semantic similarity threshold. If the maximum normalized semantic similarity value is less than the preset normalized semantic similarity threshold, it is determined that there is no segment in the segment set of the target language text that matches the target language keyword. If the maximum normalized semantic similarity value is greater than or equal to the preset normalized semantic similarity threshold, it is determined that there is a segment in the segment set of the target language text that matches the target language keyword, and the maximum normalized semantic similarity value is used as the semantic matching parameter between the target language keyword and each segment in the segment set.
2. The keyword matching method across language environments as described in claim 1, characterized in that, The step of segmenting the source language keywords to obtain short keyword strings and long keyword strings includes: The source language keywords are segmented using the longest segmentation strategy to obtain a sequence of source language keywords. Based on the number of words contained in the source language keyword sequence, the source language keywords are classified into short keyword strings or long keyword strings.
3. The keyword matching method across language environments as described in claim 1, characterized in that, The step of obtaining a target language synonym keyword group corresponding to the source language keyword based on the source language keyword when the source language keyword is the short keyword string, matching the target language text using the target language synonym keyword group, and taking the target language text including the keywords in the target language synonym keyword group as the target language matching text includes: When the source language keyword is the short keyword string, a thesaurus is used to expand the meaning of the source language keyword to obtain a group of synonyms for the source language keyword; The keywords in the synonym keyword group are translated using the target language to obtain the target language synonym keyword group corresponding to the synonym keyword group; The keywords in the target language synonym keyword group are sequentially input into different target language texts for pattern matching to obtain matching information between different target language texts and the keywords in the target language synonym keyword group. The matching information includes the number of times the target language text matches the keywords in the target language synonym keyword group, the position of the matched keywords in the target language text, and the number of different keywords matched by the target language text. The target language text containing the matching information is used as the target language matching text for the source language keyword.
4. The keyword matching method across language environments as described in claim 1, characterized in that, The step of segmenting the target language text to obtain a segment set of the target language text includes: The target language text is denoised. The denoised target language text is segmented using preset punctuation marks to obtain a segment set of the target language text. When the target language is English or Chinese, the preset punctuation marks include one or more combinations of period, exclamation mark, question mark, tab, line break, semicolon, and comma.
5. The keyword matching method across language environments as described in claim 1, characterized in that, The step of calculating the overall relevance parameter between the target language keywords and the target language text includes: In the vector space model, the word frequency-inverse text frequency index is used as the weight to calculate the cosine similarity between the target language keyword and the target language text, and the cosine similarity is used as the overall relevance parameter between the target language keyword and the target language text; wherein, the vector space model is constructed based on the corpus in the target language library.
6. The keyword matching method across language environments as described in claim 5, characterized in that, The step of calculating the overall matching degree parameter between the target language keyword and the target language text based on the semantic matching parameter and the overall relevance parameter includes: The semantic matching parameters and the overall relevance parameters are weighted and summed to obtain the overall matching degree parameter between the target language keywords and the target language text; The formula for calculating the matching degree parameter M is as follows: M = α*L + β*N Wherein, α and β are empirical parameters, which are adjusted according to the algorithm used to perform semantic matching on the segment set of the target language text segment by segment based on the target language keywords, L is the semantic matching parameter, and N is the overall relevance parameter.
7. A keyword matching device for cross-language environments, characterized in that, The device includes: The acquisition module is used to acquire source language keywords for matching target language text, where the target language and the source language are different languages; The word segmentation and partitioning module is used to segment the source language keywords into short keyword strings or long keyword strings based on the word segmentation results. The matching module is used to obtain a target language synonym keyword group corresponding to the source language keyword based on the source language keyword when the source language keyword is the short keyword string, use the target language synonym keyword group to match the target language text, and take the target language text including the keywords in the target language synonym keyword group as the target language matching text. The matching module is configured to, when the source language keyword is the long keyword string, segment the target language text to obtain a segment set of the target language text, translate the source language keyword into the target language keyword using the target language, calculate the semantic matching parameters between the target language keyword and each segment in the segment set, calculate the overall relevance parameter between the target language keyword and the target language text, calculate the overall matching degree parameter between the target language keyword and the target language text based on the semantic matching parameters and the overall relevance parameter, compare the matching degree parameter with a preset matching degree threshold, and when the matching degree parameter is greater than the preset matching degree threshold, use the target language text as the target language matching text that matches the source language keyword. The matching module is further configured to perform semantic matching on each segment of the target language text using the same target language keyword, calculate the semantic similarity value between each segment in the segment set and the same target language keyword, and take the maximum value among the semantic similarity values between each segment in the segment set and the same target language keyword as the maximum semantic similarity value between the segment in the segment set and the same target language keyword; normalize the maximum semantic similarity value between the segment in the segment set and the same target language keyword to obtain the maximum normalized semantic similarity value, wherein the maximum normalized semantic similarity value is equal to the difference between the maximum semantic similarity value and the minimum value of similarity theory. The ratio of the difference between the theoretical maximum and the theoretical minimum similarity value; comparing the maximum normalized semantic similarity value with a pre-set normalized semantic similarity threshold; if the maximum normalized semantic similarity value is less than the pre-set normalized semantic similarity threshold, it is determined that there is no segment in the segment set of the target language text that matches the target language keyword; if the maximum normalized semantic similarity value is greater than or equal to the pre-set normalized semantic similarity threshold, it is determined that there is a segment in the segment set of the target language text that matches the target language keyword, and the maximum normalized semantic similarity value is used as the semantic matching parameter between the target language keyword and each segment in the segment set.
8. An electronic device, characterized in that, The electronic device includes a processor, a communication unit, and a computer-readable storage medium. The processor and the computer-readable storage medium are connected via a bus system. The communication unit is used to connect with other electronic devices to achieve data interaction. The computer-readable storage medium is used to store programs, instructions, or code. The processor is used to execute the programs, instructions, or code in the computer-readable storage medium to implement the cross-language environment keyword matching method according to any one of claims 1-6.