Dictionary updating method and device
By automatically generating a dictionary and using effective word segmentation and word group attribute scoring of search terms, the problems of high dictionary maintenance costs and lack of professionalism in the existing technology are solved, and more accurate and efficient user information recommendations are achieved.
Patent Information
- Application Number
- CN202011335384.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-25
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-11-25
AI Technical Summary
The dictionaries of existing financial search engines rely on manual collection and maintenance, resulting in insufficient professionalism, high maintenance costs, and poor results, which affects search performance.
Generate a dictionary through an automated method, obtain search terms within a preset period, determine effective word segments, construct word groups, and automatically update the dictionary based on word group attributes and frequency scores, and add word segments whose scores meet the threshold.
It improves the accuracy and relevance of the dictionary, reduces maintenance costs, achieves more objective and efficient dictionary updates, and improves the accuracy of user information recommendations.
Smart Images

Figure CN112434170B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of financial technology (Fintech), and in particular to a dictionary updating method and device. Background Art
[0002] With the development of computer technology, more and more technologies (such as big data or cloud computing) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology. In the context of big data technology, users can obtain massive amounts of information by entering search terms in search engines.
[0003] Currently popular search engines include Elasticsearch and Solr, both of which are based on Lucene. The key component of Lucene is the word segmenter. The word segmenter segments the search terms through a dictionary, so that the search terms can be segmented into multiple word units. Then, by passing the word units to the index component, the hit results can be obtained. Finally, information related to the search term can be pushed to the user based on the hit results.
[0004] However, the dictionary used by the above-mentioned word segmenters for word segmentation is usually formed by collecting word elements shared by others, and is manually added and expanded according to needs. Therefore, this type of dictionary usually has strong versatility but low professionalism, which seriously affects the search performance. In addition, since this type of dictionary needs to be maintained manually, the maintenance cost is high and the subjectivity is strong, and the effect is poor.
[0005] In summary, there is an urgent need for a method that uses a dictionary generated in an automated manner to push information that is strongly related to a search term to a user. Summary of the invention
[0006] The present application provides a dictionary updating method and device for realizing the use of a dictionary generated in an automated manner to push information strongly related to a search term to a user.
[0007] In a first aspect, an embodiment of the present application provides a dictionary updating method, the method comprising: obtaining each search term within a preset time period; for any search term, determining the valid participles of the search term; determining the same part of multiple valid participles as a root; for each root, constructing a word group of valid participles including the root; for each valid participle in each word group, determining a score for each valid participle, and adding the valid participles whose scores meet a threshold to the dictionary.
[0008] In this way, the dictionary is updated closely depending on time, and in the process of updating the dictionary, it is based on the search terms within the preset time period, that is, by collecting the search terms within the preset time period, and determining the effective segmentation of the search terms, further determining the root word, and establishing a word group based on the root word, and finally adding the effective segmentation words in the word group whose scores meet the threshold to the dictionary. This method of updating the dictionary is automatic, rather than manually adding the dictionary to update, so that the dictionary obtained in this way can have better accuracy when applied to user information recommendation.
[0009] In a possible implementation method, the determining the score of each valid participle in each word group includes: for each word group, determining the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determining the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; and determining the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
[0010] Based on this scheme, when determining the score of an effective participle, first determine the group attribute of the word group to which the effective participle belongs, then determine the frequency of the effective participle in the word group to which it belongs, and finally determine the score of the effective participle based on the group attribute and frequency. If the score corresponding to the effective participle determined in this way is large, it means that the importance of the effective participle is more important. By scoring the effective participle, the importance of an effective participle can be objectively measured, and the score can be used as a reference data for whether the effective participle can be added to the dictionary.
[0011] In a possible implementation method, the threshold is determined in the following manner, including: determining a mean group attribute according to group attributes of each word group; and determining the threshold according to a set adjustment parameter and the mean group attribute.
[0012] Based on this scheme, when measuring whether a valid participle can be added to the dictionary, on the one hand, the score of the valid participle can be determined, and on the other hand, the mean group attribute can be determined by the group attribute of each word group, and the (score) threshold that can add the valid participle to the dictionary is determined according to the set adjustment parameters and the mean group attribute. In this way, by comparing the score of the valid participle with the (score) threshold, it can be quickly determined whether the valid participle can be added to the dictionary. The (score) threshold in this method is determined based on the group attributes of each word group and the set adjustment parameters, so the (score) threshold can comprehensively measure whether a valid participle can truly be used as a word that can be added to the dictionary.
[0013] In one possible implementation method, determining the group attribute of the word group according to the number of different types of valid participles in the word group includes: determining a first number of different types of valid participles in each valid participle of each search term; determining a second number of different types of valid participles in the word group; and determining the group attribute of the word group according to the first number of types and the second number of types.
[0014] Based on this scheme, the group attribute of the current word group can be determined according to the first number of different valid participles in each valid participle of each search word and the second number of different valid participles in the current word group. The group attribute of the word group in this method is determined based on the valid participle types and the total types of valid participles constituting the word group, so the group attribute of the word group has strong objectivity, which indirectly indicates that the updated dictionary also has strong objectivity.
[0015] In one possible implementation method, for any search term, determining the effective word segmentation of the search term includes: segmenting the search term to obtain initial word units; filtering the initial word units according to preset filtering rules to obtain effective word units; and standardizing the effective word units to obtain the effective word segmentation.
[0016] Based on this solution, when determining the updated dictionary corresponding to the search term within the preset time period, the search term is segmented and the initialization word units obtained according to the preset filtering rules are screened to obtain valid word units, and the valid word units are standardized to obtain valid word segments. This method establishes standard valid word segments for the search term, which facilitates the recommendation of information to users based on the updated dictionary in the later stage, which can be both accurate and highly relevant.
[0017] In one possible implementation method, the initialization word-grams are screened according to preset filtering rules to obtain valid word-grams, including: for the initialization word-grams, if the word-gram length of the initialization word-grams meets the length deletion condition, deleting the initialization word-grams; if the initialization word-grams do not meet the length deletion condition and it is determined that the initialization word-grams are semantically non-semantic, deleting the initialization word-grams, thereby obtaining valid word-grams.
[0018] Based on this scheme, by deleting the initialization word-grams that meet the length deletion condition and the initialization word-grams that do not meet the length deletion condition but have no semantics, valid word-grams are obtained, which facilitates the subsequent standardization of the valid word-grams to obtain valid word segmentations.
[0019] In a possible implementation method, the standardization processing of the valid word-gram to obtain the valid word segmentation includes: determining whether the valid word-gram has a replacement word-gram in the wrong character template; if so, using the replacement word-gram as the valid word segmentation; wherein the wrong character template is obtained in the following manner: converting the valid word-grams into pictures one by one to obtain a picture set; determining from the picture set valid word-gram pairs whose similarity is greater than a first preset threshold; for the first valid word-gram and the second valid word-gram in the valid word-gram pair, respectively counting the first number of occurrences of the first valid word-gram in each valid word-gram and the second number of occurrences of the second valid word-gram in each valid word-gram; if the first number is greater than the second number, using the first valid word-gram as a replacement word-gram for the second valid word-gram.
[0020] Based on this solution, a method for standardizing valid word units is to determine whether there is a replacement word unit corresponding to the valid word unit in the wrong word template, and if so, use the replacement word unit as the valid word segmentation of the valid word unit. In this method, by adjusting the wrong word correction for the valid word unit, the words updated to the dictionary will not have wrong words, so that when recommending information to users based on the updated dictionary, the accuracy can be improved.
[0021] In one possible implementation method, determining the same part of multiple valid participles as word roots includes: for a first set consisting of the valid participles of the search term, matching any two valid participles in the first set, and if there are overlapping word symbols and the length of the overlapping word symbols meets a preset condition, adding the overlapping word symbols to a second set; the second set includes the word roots corresponding to the first set.
[0022] Based on this solution, in the process of determining the word root, by matching any two valid word segments in the first set formed by the valid word segments of the search term, the overlapping word symbols between the two that meet the preset conditions can be added to the second set, and the second set includes the word roots corresponding to the first set. This method determines the word root, and then determines the word group including the valid word segment of the word root based on the word root, which is convenient for subsequent analysis.
[0023] In a second aspect, the present application provides a dictionary updating device, which includes: an acquisition unit, used to acquire each search word within a preset time period; an effective participle determination unit, used to determine the effective participle of any search word; a root determination unit, used to determine the same part of multiple effective participles as a root; a word group determination unit, used to construct a word group of effective participles including the root for each root; an updating unit, used to determine the score of each effective participle in each word group, and add the effective participle whose score meets the threshold to the dictionary.
[0024] In this method, the dictionary is updated closely depending on time, and in the process of updating the dictionary, it is based on the search terms within the preset time period, that is, by collecting the search terms within the preset time period, and determining the effective segmentation of the search terms, further determining the root word, and establishing a word group based on the root word, and finally adding the effective segmentation words in the word group whose scores meet the threshold to the dictionary. This method of updating the dictionary is automatic, rather than manually adding the dictionary to update the dictionary, so that the dictionary obtained in this way can have better accuracy when applied to user information recommendation.
[0025] In a possible implementation method, the updating unit is specifically used to: for each word group, determine the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determine the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; and determine the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
[0026] Based on this scheme, when determining the score of an effective participle, first determine the group attribute of the word group to which the effective participle belongs, then determine the frequency of the effective participle in the word group to which it belongs, and finally determine the score of the effective participle based on the group attribute and frequency. If the score corresponding to the effective participle determined in this way is large, it means that the importance of the effective participle is more important. By scoring the effective participle, the importance of an effective participle can be objectively measured, and the score can be used as a reference data for whether the effective participle can be added to the dictionary.
[0027] In a possible implementation method, the device further includes a threshold determination unit; the threshold determination unit is used to: determine a mean group attribute based on group attributes of each word group; and determine the threshold based on a set adjustment parameter and the mean group attribute.
[0028] Based on this scheme, when measuring whether a valid participle can be added to the dictionary, on the one hand, the score of the valid participle can be determined, and on the other hand, the mean group attribute can be determined by the group attribute of each word group, and the (score) threshold that can add the valid participle to the dictionary is determined according to the set adjustment parameters and the mean group attribute. In this way, by comparing the score of the valid participle with the (score) threshold, it can be quickly determined whether the valid participle can be added to the dictionary. The (score) threshold in this method is determined based on the group attributes of each word group and the set adjustment parameters, so the (score) threshold can comprehensively measure whether a valid participle can truly be used as a word that can be added to the dictionary.
[0029] In one possible implementation method, the updating unit is specifically used to: determine a first number of different valid participles in each valid participle of each search term; determine a second number of different valid participles in the word group; and determine a group attribute of the word group based on the first number of categories and the second number of categories.
[0030] Based on this scheme, the group attribute of the current word group can be determined according to the first number of different valid participles in each valid participle of each search word and the second number of different valid participles in the current word group. The group attribute of the word group in this method is determined based on the valid participle types and the total types of valid participles constituting the word group, so the group attribute of the word group has strong objectivity, which indirectly indicates that the updated dictionary also has strong objectivity.
[0031] In a possible implementation method, the effective word segmentation determination unit is specifically used to: segment the search term to obtain initial word units; filter the initial word units according to preset filtering rules to obtain effective word units; and standardize the effective word units to obtain the effective word segments.
[0032] Based on this solution, when determining the updated dictionary corresponding to the search term within the preset time period, the search term is segmented and the initialization word units obtained according to the preset filtering rules are screened to obtain valid word units, and the valid word units are standardized to obtain valid word segments. This method establishes standard valid word segments for the search term, which facilitates the recommendation of information to users based on the updated dictionary in the later stage, which can be both accurate and highly relevant.
[0033] In one possible implementation method, the effective word segmentation determination unit is also used to: for the initialization word, if the word length of the initialization word meets the length deletion condition, delete the initialization word; if the initialization word does not meet the length deletion condition and it is determined that the initialization word has no semantics, delete the initialization word, so as to obtain a valid word.
[0034] Based on this scheme, by deleting the initialization word-grams that meet the length deletion condition and the initialization word-grams that do not meet the length deletion condition but have no semantics, valid word-grams are obtained, which facilitates the subsequent standardization of the valid word-grams to obtain valid word segmentations.
[0035] In a possible implementation method, the effective word segmentation determination unit is also used to: determine whether the effective word has a replacement word in the wrong character template; if so, use the replacement word as the effective word; wherein the wrong character template is obtained in the following manner: convert the effective word into pictures one by one to obtain a picture set; determine effective word pairs whose similarity is greater than a first preset threshold from the picture set; for the first effective word and the second effective word in the effective word pair, respectively count the first number of occurrences of the first effective word in each effective word and the second number of occurrences of the second effective word in each effective word; if the first number is greater than the second number, use the first effective word as a replacement word for the second effective word.
[0036] Based on this solution, a method for standardizing valid word units is to determine whether there is a replacement word unit corresponding to the valid word unit in the wrong word template, and if so, use the replacement word unit as the valid word segmentation of the valid word unit. In this method, by adjusting the wrong word correction for the valid word unit, the words updated to the dictionary will not have wrong words, so that when recommending information to users based on the updated dictionary, the accuracy can be improved.
[0037] In one possible implementation method, the root determination unit is specifically used to: for a first set consisting of each valid participle of the search term, match any two valid participles in the first set, and if there are overlapping word symbols and the length of the overlapping word symbols meets a preset condition, add the overlapping word symbols to a second set; the second set includes each root corresponding to the first set.
[0038] Based on this solution, in the process of determining the word root, by matching any two valid word segments in the first set formed by the valid word segments of the search term, the overlapping word symbols between the two that meet the preset conditions can be added to the second set, and the second set includes the word roots corresponding to the first set. This method determines the word root, and then determines the word group including the valid word segment of the word root based on the word root, which is convenient for subsequent analysis.
[0039] In a third aspect, an embodiment of the present application provides a computing device, including:
[0040] A memory for storing program instructions;
[0041] The processor is used to call the program instructions stored in the memory and execute any implementation method of the first aspect according to the obtained program.
[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0044] Figure 1 A dictionary updating method provided in an embodiment of the present application;
[0045] Figure 2 A dictionary updating device provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0048] At present, when search engines recommend relevant information based on the search terms entered by users, they mainly recommend based on dictionaries formed manually. The dictionaries in this method are mainly formed by manually collecting words shared by others, which is subjective, and the dictionaries need to be updated manually, which has the disadvantage of high maintenance costs.
[0049] Based on the above technical problems, the present application embodiment provides a dictionary updating method, such as Figure 1 As shown, the method comprises the following steps:
[0050] Step 101, obtaining each search term within a preset time period.
[0051] In this step, the preset time period can be a custom period of time. For example, if the dictionary update time point is November 15, 2020, the preset time period can be January 1, 2020 to June 30, 2020, that is, the historical data of every six months is used as the basis for the dictionary update in the next six months; in order to ensure that the words in the dictionary have stronger timeliness, the preset time period in the embodiment of the present application can also be a period of time closest to the dictionary update time point, such as the last seven days, ten days, or other custom time. For example, if the dictionary update time point is November 15, 2020, the dictionary can be updated based on the search words in the most recent historical 7 days from November 8, 2020 to November 14, 2020.
[0052] Step 102: for any search term, determine the valid word segments of the search term.
[0053] In this step, valid segmented words are determined for each search word within a preset time period, so as to determine which specific word roots the valid segmented words within the preset time period may include.
[0054] Step 103: determine the common parts of multiple valid participles as word roots.
[0055] In this step, by determining a portion common to a plurality of valid participles as a root, a word group corresponding to the root can be formed based on the root.
[0056] Step 104: for each word root, construct a word group including each valid word segment of the word root.
[0057] In this step, taking a root as a reference, valid segmented words having the root are selected from valid segmented words within a preset time period as elements constituting a word group, thereby constructing a word group for each root.
[0058] Step 105: for each valid segmentation in each word group, determine the score of each valid segmentation, and add the valid segmentation whose score meets the threshold into the dictionary.
[0059] In this step, by determining the score of each valid segmentation in each word group, and adding the valid segmentation that meets the threshold score to the dictionary, an updated dictionary is obtained, so that relevant information can be recommended for the search term entered by the user based on the updated dictionary. Since the updated dictionary is highly dependent on time, and the valid segmentation that can be updated to the dictionary is determined based on the objective scoring of the valid segmentation during the update process, the relevant information recommended to the user about the search term will also be more accurate.
[0060] It should be noted that the dictionary in this step is used to represent the most recent version of the dictionary before the current dictionary update.
[0061] In this method, the dictionary is updated closely depending on time, and in the process of updating the dictionary, it is based on the search terms within the preset time period, that is, by collecting the search terms within the preset time period, and determining the effective segmentation of the search terms, further determining the root word, and establishing a word group based on the root word, and finally adding the effective segmentation words in the word group whose scores meet the threshold to the dictionary. This method of updating the dictionary is automatic, rather than manually adding the dictionary to update the dictionary, so that the dictionary obtained in this way can have better accuracy when applied to user information recommendation.
[0062] The above steps will be described in detail below with reference to examples.
[0063] In one implementation of step 102, for any search term, determining the effective word segmentation of the search term includes: segmenting the search term to obtain initial word units; filtering the initial word units according to preset filtering rules to obtain effective word units; and standardizing the effective word units to obtain the effective word segmentation.
[0064] For example, if the dictionary update time point is November 15, 2020, the dictionary can be updated based on the search terms of the most recent 7 days from November 8, 2020 to November 14, 2020, and the number of search terms in this period is assumed to be 200. Then, for each of the 200 search terms, a word segmentation operation is performed, such as word segmentation according to some simple symbols, such as spaces, tabs, commas, etc., so as to obtain the initialization word element corresponding to each search term, and after counting the initialization word elements corresponding to the 200 search terms, it is determined that there are 300 initialization word elements in total. Then, these initialization word elements can be screened according to the preset filtering rules, and the effective word elements obtained after screening can be further standardized to obtain effective word segmentation.
[0065] In certain embodiments of the application, the initialization word-grams are screened according to preset filtering rules to obtain valid word-grams, including: for the initialization word-grams, if the word-gram length of the initialization word-grams meets the length deletion condition, deleting the initialization word-grams; if the initialization word-grams do not meet the length deletion condition and it is determined that the initialization word-grams are semantically non-semantic, deleting the initialization word-grams to obtain valid word-grams.
[0066] For example, for each of the 300 initialization word elements mentioned above, determine whether the word element length of the initialization word element meets the length deletion condition. If so, delete it. For example, the length deletion condition can be set to 1 and 10, wherein, for the initialization word element with a word element length of 1, it can be directly deleted; for the initialization word element with a word element length greater than 10, it can also be directly deleted. Such initialization word elements with a word element length greater than 10 are most likely caused by user misoperation, so they need to be deleted. If the word element length of the initialization word element does not meet the length deletion condition, determine whether the initialization word element is a semantic word element. If not, it is also necessary to delete the initialization word element with an appropriate word element length. Among them, the process of determining whether the initialization word element is a semantic word element can refer to the following scoring model:
[0067] Step 1: For the initialization tokens that do not meet the length deletion condition, 12 parts of speech (noun, verb, adjective, numeral, quantifier, pronoun, adverb, preposition, conjunction, auxiliary word, interjection and onomatopoeia) can be used as annotators to mark them and generate a hidden Markov chain.
[0068] Step 2, based on the hidden Markov model and the Viterbi algorithm, calculate the optimal hidden Markov chain probability. The specific implementation can be: initialize the probability of the first initialization unit, and determine the next initialization unit, and obtain the optimal probability of the observed state according to the probability transfer matrix of the part of speech; iterate these steps to determine the optimal probability P of the last initialization unit.
[0069] Step 3: When the optimal probability P<0.3, the initialization word is considered to have no semantics and can be deleted.
[0070] Assume that after filtering 300 initialization tokens based on the above filtering rules, 100 valid tokens are obtained.
[0071] In certain embodiments of the present application, the standardization of the valid word-grams to obtain the valid word segmentation includes: determining whether the valid word-gram has a replacement word-gram in the wrong character template; if so, using the replacement word-gram as the valid word segmentation; wherein the wrong character template is obtained in the following manner: converting the valid word-grams into pictures one by one to obtain a picture set; determining from the picture set a valid word-gram pair whose similarity is greater than a first preset threshold; for the first valid word-gram and the second valid word-gram in the valid word-gram pair, respectively counting the first number of occurrences of the first valid word-gram in each valid word-gram and the second number of occurrences of the second valid word-gram in each valid word-gram; if the first number is greater than the second number, using the first valid word-gram as a replacement word-gram for the second valid word-gram.
[0072] For example, operations for normalizing valid tokens may include:
[0073] 1. For English, the following processing can be done:
[0074] (1) Changing uppercase letters to lowercase letters, such as changing "D" to "d", is called Lowercase.
[0075] (2) Reduce a word to its root form, such as changing "cars" to "car". This operation is called stemming.
[0076] (3) Converting a word into its root form, such as changing "drove" to "drive", is called Lemmatization.
[0077] 2. For Chinese, the following processing can be done:
[0078] Chinese numerals are converted to Arabic numerals, such as changing "100,000" to "100000".
[0079] 3. For a valid word, determine whether there is a typo in the valid word, that is, determine whether there is a replacement word for the valid word in the typo template; if there is, use the replacement word as a valid word segmentation. The typo template can be formed in the following way:
[0080] Step 1, convert valid words into pictures one by one;
[0081] Step 2, use the openCV library to determine the valid word pairs with a similarity greater than 80%;
[0082] Step 3, count the number of times each valid word in the valid word pair in step 2 is counted, and the valid word with the largest number of times is used as the correct expression of the valid word pair. Further, if the similarity of the valid word with the largest number of times is greater than 95%, the valid word can be directly used as the correct expression of the valid word pair. If the similarity of the valid word with the largest number of times is between 80% and 95%, it can be manually determined which valid word in the valid word pair is the correct expression of the valid word pair.
[0083] It is noted that when determining valid word pairs, the first preset threshold is set to 80% in the embodiment of the present application. Of course, the first preset threshold can also be adjusted based on actual needs, such as being set to 75%, 85%, or other values, and the present application does not make specific limitations. In addition, for the correct expression of directly determining the valid word with the largest number of times as a valid word pair when the similarity is greater than 95%, the present application does not limit it to 95%. For example, the similarity can also be 93%, 98%, or other values.
[0084] Assume that after processing 100 valid word units using the above standardization processing method, 100 valid participles are obtained, and the valid participles correspond to the valid word units one by one. It can be understood that in some cases, the valid participles are the same as the valid word units.
[0085] In one implementation of the above step 103, determining the same part of multiple valid participles as word roots includes: for a first set consisting of the valid participles of the search term, matching any two valid participles in the first set, and if there are overlapping word symbols and the length of the overlapping word symbols meets a preset condition, adding the overlapping word symbols to a second set; the second set includes the word roots corresponding to the first set.
[0086] For example, if the valid segment words corresponding to the search term include "Qianhai Weizhong", "Weizhong Bank", "Weizhong" and "Industrial and Commercial Bank of China", these four valid segment words constitute a first set; then, the root of the first set can be determined in the following way:
[0087] Step 1. Take "Qianhai Weizhong" from the first set as the benchmark for this round of word root determination process, and compare it with "Weizhong Bank", "Weizhong" and "ICBC" in the first set one by one. For example, when "Qianhai Weizhong" is compared with "Weizhong Bank", "Weizhong" is the common part of the two, that is, "Weizhong" can be called an overlapping word symbol, and the length of "Weizhong" meets the preset condition (the preset condition here is set to the length of the overlapping word symbol is not less than 2). In this way, "Weizhong" can be added to the second set (at this time, the second set is initialized to an empty set), so that the second set has the word root "Weizhong"; based on the same reason, when "Qianhai Weizhong" is compared with "Weizhong", "Weizhong" is the common part of the two, and the length of "Weizhong" meets the preset condition, so it ... "Weizhong" is added to the second set. However, the root word "Weizhong" already exists in the second set. Therefore, adding "Weizhong" to the second set can be ignored this time (to avoid repeated addition); based on the same reason, when comparing "Qianhai Weizhong" and "Industrial and Commercial Bank of China", the two have no common parts, so the process of determining the root word based on "Qianhai Weizhong" ends here; next, "Weizhong Bank" in the first set is used as the basis for a new round of root word determination process, and it is compared one by one with "Weizhong" and "Industrial and Commercial Bank of China" in the first set (because "Qianhai Weizhong" and "Weizhong Bank" have been compared in the previous round, so in order to avoid repeated comparison, there is no need to compare "Weizhong Bank" with "Qianhai Weizhong" at this time), and the logic of determining the root word is not repeated. After "Weizhong" in the first set is used as the basis for determining the root and the root is determined, the roots determined for the effective participles in the first set include "Weizhong" and "Bank", and "Weizhong" and "Bank" are placed in the second set.
[0088] It should be noted that in the embodiments of the present application, only the length of the overlapping word symbols is not less than 2 as an example for explanation, wherein the length of the overlapping word symbols can also be set to 3, or other values, and the present application does not limit this.
[0089] Assume that after determining the roots of the above 100 valid participles, three roots are obtained, which are respectively called root 1, root 2 and root 3. For root 1, its corresponding word group 1 includes {A1(10), A2(8), A3(2)}, for root 2, its corresponding word group 2 includes {B1(10), B2(15), B3(5), B4(10), B5(5), B6(5)}, and for root 3, its corresponding word group 3 includes {C1(20), C2(10)}. It should be noted that the letters in the curly brackets represent valid participles, and the numbers in the parentheses adjacent to the letters represent the number of times the valid participles appear.
[0090] In an implementation of the above step 105, the step of determining the score of each valid participle in each word group includes: for each word group, determining the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determining the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; and determining the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
[0091] In certain embodiments of the present application, the threshold is determined in the following manner, including: determining a mean group attribute according to group attributes of each word group; and determining the threshold according to a set adjustment parameter and the mean group attribute.
[0092] In certain embodiments of the present application, determining the group attribute of the word group according to the number of different types of valid participles in the word group includes: determining a first number of different types of valid participles in each valid participle of each search term; determining a second number of different types of valid participles in the word group; and determining the group attribute of the word group according to the first number of types and the second number of types.
[0093] For example, the group attribute of each word group is first determined, and the basic score is used to represent the group attribute in this application.
[0094] For example, the basic score of word group 1 can be expressed as: (10+8+2) / 100=0.2; the basic score of word group 2 can be expressed as: (10+15+5+10+5+5) / 100=0.5; the basic score of word group 3 can be expressed as: (20+10) / 100=0.3.
[0095] Next, score each valid word in the word cluster.
[0096] For example, for the effective participle A1 in word group 1, its score is: [10 / (10+8+2)]*0.2=0.1; for the effective participle A2 in word group 1, its score is: [8 / (10+8+2)]*0.2=0.08; for the effective participle A3 in word group 1, its score is: [2 / (10+8+2)]*0.2=0.02;
[0097] For the effective participle B1 in word group 2, its score is: [10 / (10+15+5+10+5+5)]*0.5=0.1; for the effective participle B2 in word group 2, its score is: [15 / (10+15+5+10+5+5)]*0.5=0.15; for the effective participle B3 in word group 2, its score is: [5 / (10+15+5+10+5+5)]*0.5=0.05 ; For the effective participle B4 in word group 2, its score is: [10 / (10+15+5+10+5+5)]*0.5=0.1; For the effective participle B5 in word group 2, its score is: [5 / (10+15+5+10+5+5)]*0.5=0.05; For the effective participle B6 in word group 2, its score is: [5 / (10+15+5+10+5+5)]*0.5=0.05;
[0098] For the effective participle C1 in word group 3, its score is: [20 / (20+10)]*0.3=0.2; for the effective participle C2 in word group 3, its score is: [10 / (20+10)]*0.3=0.1.
[0099] Next, determine the (scoring) threshold.
[0100] If the adjustment parameter is set to 2 in the present application, the (scoring) threshold can be determined as [(0.2+0.5+0.3) / 3] / 2=1 / 6.
[0101] Finally, the score of each valid word segmentation is compared with the (score) threshold, and the valid word segmentation with a score not less than the (score) threshold is updated to the dictionary.
[0102] For example, the score 0.2 of the effective participle C2 in the word group 3 in the embodiment of the present application is greater than the (scoring) threshold 1 / 6, so the effective participle C2 can be added to the dictionary.
[0103] It should be noted that in the embodiment of the present application, there is no limit on the size of the adjustment parameter. When the value of the adjustment parameter is larger, it means that the degree of effective word segmentation that can be updated to the dictionary is relaxed. When the value of the adjustment parameter is smaller, it means that the degree of effective word segmentation that can be updated to the dictionary is strengthened.
[0104] Based on the same concept, the embodiment of the present application provides a dictionary updating device, such as Figure 2 As shown, the device comprises:
[0105] The acquisition unit 201 is used to acquire each search word within a preset time period.
[0106] The effective word segmentation determination unit 202 is used to determine the effective word segmentation of any search word.
[0107] The root determination unit 203 is used to determine the same part of multiple valid participles as a root.
[0108] The word group determination unit 204 is used to construct, for each word root, a word group including each valid word segment of the word root.
[0109] The updating unit 205 is used to determine the score of each valid participle in each word group, and add the valid participle whose score meets the threshold into the dictionary.
[0110] Further, for the device, the updating unit 205 is specifically used to: for each word group, determine the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determine the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; determine the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
[0111] Furthermore, the device further comprises a threshold determination unit 206, which is used to: determine the mean group attribute according to the group attribute of each word group; and determine the threshold according to the set adjustment parameter and the mean group attribute.
[0112] Further, for the device, the updating unit 205 is specifically used to: determine the first number of different valid participles in each valid participle of each search word; determine the second number of different valid participles in the word group; and determine the group attribute of the word group based on the first number of categories and the second number of categories.
[0113] Further, for the device, the effective word segmentation determination unit 202 is specifically used to: segment the search term to obtain initial word units; filter the initial word units according to preset filtering rules to obtain effective word units; and standardize the effective word units to obtain the effective word segments.
[0114] Furthermore, for the device, the effective word segmentation determination unit 202 is also used to: for the initialization word, if the word length of the initialization word meets the length deletion condition, delete the initialization word; if the initialization word does not meet the length deletion condition and it is determined that the initialization word has no semantics, delete the initialization word, so as to obtain a valid word.
[0115] Furthermore, for the device, the effective word segmentation determination unit 202 is also used to: determine whether there is a replacement word for the effective word in the wrong character template; if so, use the replacement word as the effective word; wherein the wrong character template is obtained in the following manner: convert the effective word into pictures one by one to obtain a picture set; determine effective word pairs whose similarity is greater than a first preset threshold from the picture set; for the first effective word and the second effective word in the effective word pair, respectively count the first number of occurrences of the first effective word in each effective word and the second number of occurrences of the second effective word in each effective word; if the first number is greater than the second number, use the first effective word as a replacement word for the second effective word.
[0116] Further, for the device, the root determination unit 203 is specifically used to: for a first set consisting of each valid participle of the search term, match any two valid participles in the first set, and if there are overlapping word symbols and the length of the overlapping word symbols meets a preset condition, add the overlapping word symbols to a second set; the second set includes each root corresponding to the first set.
[0117] The embodiment of the present application also provides a computing device, which may be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. The computing device may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.
[0118] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In an embodiment of the present application, the memory may be used to store program instructions of the dictionary update method;
[0119] The processor is used to call the program instructions stored in the memory and execute the dictionary updating method according to the obtained program.
[0120] like Figure 3 FIG. 1 is a schematic diagram of a computing device provided in an embodiment of the present application, wherein the computing device includes:
[0121] Processor 301, memory 302, transceiver 303, bus interface 304; wherein the processor 301, memory 302 and transceiver 303 are connected via bus 305;
[0122] The processor 301 is used to read the program in the memory 302 and execute the dictionary updating method;
[0123] The processor 301 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP. It may also be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0124] The memory 302 is used to store one or more executable programs and can store data used by the processor 301 when performing operations.
[0125] Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 302 may include volatile memory, such as random-access memory (RAM); the memory 302 may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 302 may also include a combination of the above-mentioned types of memory.
[0126] The memory 302 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
[0127] Operation instructions: include various operation instructions, used to implement various operations.
[0128] Operating system: includes various system programs used to implement various basic businesses and handle hardware-based tasks.
[0129] The bus 305 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0130] The bus interface 304 may be a wired communication access port, a wireless bus interface or a combination thereof, wherein the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.
[0131] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the dictionary updating method.
[0132] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0134] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0136] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0137] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A dictionary updating method, characterized in that: include: Obtain each search term within a preset time period; For any search term, determining a valid participle of the search term; Determine the same part of multiple valid participles as a root; For each word root, construct a word group including each valid participle of the word root; For each valid participle in each word group, determine the score of each valid participle, and add the valid participle whose score meets the threshold into the dictionary; The step of determining the score of each valid participle in each word group includes: for each word group, determining the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determining the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; and determining the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
2. The method according to claim 1, characterized in that The threshold is determined by: According to the group attributes of each word group, determine the mean group attribute; The threshold is determined according to the set adjustment parameter and the mean group attribute.
3. The method according to claim 1, characterized in that The determining the group attribute of the word group according to the number of different types of valid word segments in the word group includes: Determine a first number of different valid participles in each valid participle of each search term; Determining a second number of different valid participles in the word group; The group attribute of the word group is determined according to the first number of categories and the second number of categories.
4. The method according to any one of claims 1 to 3, characterized in that: The step of determining, for any search term, a valid word segment of the search term includes: Segmenting the search term to obtain initialization tokens; Filter the initialization word element according to the preset filtering rules to obtain a valid word element; The effective word-units are standardized to obtain the effective word segmentations.
5. The method according to claim 4, characterized in that The step of filtering the initialization word element according to the preset filtering rules to obtain a valid word element includes: For the initialization word, if the word length of the initialization word satisfies the length deletion condition, the initialization word is deleted; If the initialization word element does not meet the length deletion condition and it is determined that the initialization word element has no semantics, the initialization word element is deleted to obtain a valid word element.
6. The method according to claim 4, characterized in that The step of performing standardization processing on the valid word element to obtain the valid word segmentation includes: Determine whether the valid word has a replacement word in the wrong character template; If it exists, the replacement word is used as a valid participle; Wherein, the typo template is obtained in the following manner: Convert the valid word units into pictures one by one to obtain a picture set; Determine, from the picture set, valid word pairs whose similarity is greater than a first preset threshold; For the first valid word-gram and the second valid word-gram in the valid word-gram pair, the first number of occurrences of the first valid word-gram in each valid word-gram and the second number of occurrences of the second valid word-gram in each valid word-gram are counted respectively; if the first number is greater than the second number, the first valid word-gram is used as a replacement word-gram for the second valid word-gram.
7. The method according to claim 1, characterized in that The step of determining the same part of the plurality of valid participles as a root word comprises: For the first set consisting of the valid participles of the search term, any two valid participles in the first set are matched. If there are overlapping word symbols and the length of the overlapping word symbols meets the preset conditions, the overlapping word symbols are added to the second set; the second set includes the word roots corresponding to the first set.
8. A dictionary updating device, characterized in that: An acquisition unit, used to acquire each search term within a preset time period; An effective word segmentation determination unit, used for determining, for any search word, an effective word segmentation of the search word; A root determination unit, used for determining the same part of a plurality of valid participles as a root; A word group determination unit, for constructing, for each word root, a word group including each valid word segment of the word root; An updating unit, for determining the score of each valid segmentation in each word group, and adding the valid segmentation whose score meets the threshold into the dictionary; The updating unit is specifically used to: for each word group, determine the group attribute of the word group according to the number of different types of valid participles in the word group; for each valid participle, determine the frequency of the valid participle in the word group according to the number of times the valid participle appears in the word group; and determine the score of the valid participle according to the frequency of the valid participle in the word group and the group attribute of the word group where the valid participle is located.
9. A computer-readable storage medium, characterized in that: The storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.
