Error correction method and error correction device for medical e-commerce search terms
By using character obfuscation sets and N-element models in medical e-commerce platforms to generate candidate search terms, and screen them in combination with feature engineering and SVM discriminant models, the problem of insufficient confidence in keyword error correction in medical e-commerce scenarios is solved, and higher error correction accuracy and user experience are achieved.
Patent Information
- Application Number
- CN202411564998.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-04-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has the problem of insufficient confidence in keyword error correction in medical e-commerce scenarios, which is difficult to meet the demand for high accuracy in medical e-commerce scenarios.
Candidate search terms are generated through character obfuscation sets, and the N-member model is used for smoothness calculations to filter out candidate search terms that exceed an error correction threshold. Then, text features, cross features and statistical features are extracted through feature engineering, and secondary screening is performed in combination with the SVM discriminant model, and priority calculation is made to determine the most suitable search term.
It significantly improves the accuracy and professionalism of medical e-commerce search terms correction, enhances users' trust and willingness to use search results, reduces misjudgments, and improves the platform's sales conversion rate.
Smart Images

Figure CN119784456A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language text error correction, and in particular to a medical e-commerce search term error correction method, an error correction device, an electronic device and a computer storage medium. Background Art
[0002] When searching for medicines, medical devices or health products on medical e-commerce platforms, users are prone to enter incorrect keywords due to spelling errors, automatic replacement of high-frequency words in the input method, or unfamiliarity with the product name. Such input errors can lead to inaccurate search results or even failure to display related products, which seriously affects the user experience, reduces the sales conversion rate of the platform, and affects users' trust in the platform and willingness to use it.
[0003] In order to solve the problem of users entering incorrect keywords, traditional technologies generally use regular expressions and fuzzy search methods to expand the keywords entered by users to more possible search items. Although this can improve the search matching degree, it is easy to generate a lot of noise information of irrelevant products, resulting in products that do not meet user needs frequently appearing in the search results, reducing the user's search experience.
[0004] Based on this, in order to improve the accuracy of search results, the prior art further introduces character confusion sets and n-gram language models to correct keywords entered by users. Specifically, the character confusion sets are used to replace the keyword characters entered by users one by one to generate multiple candidate search terms; then, the n-gram language model is used to score the fluency of the candidate search terms, and the candidate search terms with higher scores are selected as replacement keywords. However, the n-gram model mainly relies on statistical co-occurrence frequency, and has limited processing effect on Chinese medical professional vocabulary. In particular, medical product vocabulary is not only highly professional, but also usually involves specific applicable populations, efficacy, and disease symptoms. Simple replacement based on word frequency co-occurrence may lead to misleading results. Due to the particularity of medical products, misselection may even bring safety hazards, and users have higher requirements for the accuracy and professionalism of search results. Therefore, the prior art keyword correction in medical scenarios has the problem of insufficient confidence, and it is difficult to meet the demand for high accuracy in medical e-commerce scenarios. Summary of the invention
[0005] Based on this, the purpose of the present invention is to provide a method for correcting medical e-commerce search terms.
[0006] A method for correcting errors in medical e-commerce search terms, comprising the following steps:
[0007] S1. Replace the original search term multiple times according to the character confusion set to obtain several candidate search terms;
[0008] S2, using the N-gram model to calculate the fluency of all candidate search terms and original search terms, and obtain a number of fluency scores and original scores;
[0009] S3, determining whether a number of fluency scores exceed the original score and exceed an error correction threshold: if not, it is considered that the original search term is error-free and error correction is completed; if yes, executing step S4;
[0010] S4, performing text feature extraction, cross feature extraction and statistical feature extraction on the potential correct search words exceeding the threshold, obtaining a number of text features, a number of cross features and a number of statistical features, and merging all the features into a feature vector to obtain a feature group of candidate search words;
[0011] S5, using the SVM discriminant model to accurately discriminate the feature group of the candidate search term, and obtain the discrimination result corresponding to the candidate search term;
[0012] S6. Calculate the priority of the candidate search terms according to the discrimination result, and use the high priority as the current search term to complete error correction.
[0013] Compared with the prior art, the error correction method for medical e-commerce search terms described in the present invention respectively extracts the text features, cross features and statistical features of the candidate search terms and the original search terms after the initial screening through feature engineering, and enables SVM to use these features to determine the accuracy and adaptability of the candidate search terms after the initial screening of fluency, so as to ensure that the candidate search terms after the secondary screening are more in line with the intended vocabulary of users in the field of medical e-commerce. Accordingly, the present invention shows higher reliability and accuracy in text error correction in the field of medical e-commerce through comprehensive feature extraction and refined secondary screening of SVM, thereby better meeting the accuracy requirements of medical e-commerce search text error correction.
[0014] Further, the text features include the character length of the original search term, the character length of the candidate search term, the pinyin length of the original search term, and the pinyin length of the candidate search term;
[0015] The cross features include shape similarity, stroke similarity, number of similar subwords, phonetic similarity, different proportions of characters and phonetic equality features;
[0016] The statistical features include the number of searches for the original search term, the number of searches for the candidate search term, the number of clicks on the original search term, the number of clicks on the candidate search term, the click rate of the original search term and the click rate of the candidate search term.
[0017] The present invention describes the characteristics of Chinese characters in terms of text structure and pronunciation through text features, providing the SVM discriminant model with the ability to initially distinguish features. The cross-features analyze the slight differences in user input from a fine-grained perspective, improving the accuracy of the SVM model in determining whether the current error correction candidate search term is reasonable. In addition, statistical features can provide additional semantic context support for the SVM discriminant model to enhance the adaptability of the SVM discriminant model in medical e-commerce search scenarios.
[0018] Accordingly, through comprehensive feature extraction and combination, the present invention can more systematically analyze the user's search term deviations, thereby reducing misjudgments and improving the accuracy and professionalism of search term correction in medical e-commerce scenarios.
[0019] Furthermore, the specific calculation of the shape similarity is expressed as follows:
[0020] Shape=SSIM(img(Q),img(Q′ i ))
[0021] In the formula, Shape is the shape similarity; img(Q) and img(Q′ i ) represent the font structure images of the original search word and the candidate search word respectively; SSIM is a structural similarity calculation method;
[0022] The specific calculation of the stroke similarity is as follows:
[0023]
[0024] Where Stroke is the stroke similarity, EdDistance(Radical(Q),Radical(Q′ i )) represents the edit distance between the radical sequence of the original search term and the candidate search term; max(len(Radical(Q)),len(Radical(Q′ i ))) means to obtain the maximum length of radical sequence;
[0025] The number of similar subwords is specifically expressed as follows:
[0026] Subword=Count(Q∩Q′ i )
[0027] In the formula, Subword is the number of similar subwords, Count(Q∩Q′ i ) represents the number of intersections between the original search term and the candidate search term;
[0028] The specific calculation of the pinyin similarity is as follows:
[0029]
[0030] Where, Spinyin is the pinyin similarity, Count(pinyin(Q)∩pinyin(Q′ i )) represents the total number of identical pinyins of the original search term and the candidate search term;
[0031] The specific calculation of different proportions of the characters is as follows:
[0032]
[0033] Where CharDiff is the ratio of different characters, max(len(Q),len(Q′ i )) represents the maximum number of characters of the original search term and the candidate search term;
[0034] The specific judgment of the pinyin equality feature is as follows:
[0035]
[0036] Where PinyinEqual is the pinyin equality feature, pinyin(Q) and pinyin(Q′ i ) represent the pinyin strings of the original search term and the candidate search term respectively.
[0037] Furthermore, the priority calculation is expressed as follows:
[0038]
[0039] In the formula, Priority i represents the i-th candidate search term Q′ i The priority score of i is the candidate search term Q′ i The discrimination weights are assigned according to the discrimination results of SVM, corresponding to: 0 for confidence abnormality, 1 for confidence potential abnormality, and 2 for confidence no abnormality; Denoted as Q′ i Fluency score.
[0040] For scenarios with multiple potential candidate search terms, the present invention combines the SVM's discrimination results as weight coefficients with the fluency scores of the candidate search terms, performs priority calculations to comprehensively evaluate the relevance and accuracy of the candidate search terms, and thus accurately selects the best candidate search term to replace the original search term based on the priority level, thereby improving the accuracy and reliability of error correction.
[0041] Furthermore, after the search term error correction is completed, the following steps are also included:
[0042] Search products in the medical e-commerce database based on the current high-priority search terms, and display the product information corresponding to the search results;
[0043] The product search specifically includes the following sub-steps:
[0044] SA1. Perform a preliminary search on the medical e-commerce database based on the current high-priority search terms to obtain a search term-related product set, which is specifically expressed as follows:
[0045] KeyProduct = {Q i ,{P j |j∈[1,m]}|i∈[1,n]}
[0046] In the formula, KeyProduct is represented by the set of search terms and related products; Q i represents the i-th search term, {P j |j∈[1,m]} is the set of search products corresponding to the i-th search term; n is the total number of high-priority search terms; m is the number of products corresponding to the current search term Q i Total number of products searched;
[0047] SA2. Perform multi-dimensional similarity calculation on several related products based on the current high-priority search term to obtain a proximity score set. The specific calculation of the proximity score of a search product is as follows:
[0048]
[0049] Where FinalScore P It is represented as the proximity score corresponding to product P; w i is a dynamic weight parameter; Similarity i is a similarity evaluation function, including product name similarity, product efficacy similarity and product applicable symptom similarity;
[0050] The specific calculation of the product name similarity is as follows:
[0051]
[0052] Where, EdDistance(Q i ,P Name ) indicates the current candidate product name P Name The corresponding search term Q i The edit distance between len(Q i ) and len(P Name ) represent the corresponding search terms Q i and candidate product name P Name The character length of
[0053] The specific calculation of the product efficacy similarity is as follows:
[0054]
[0055] In the formula, For the search term Q i The word vector representation of ; The word vector representation of the efficacy description of the candidate product P; and are the norms of the word vector of the search term and the word vector of the description of the efficacy of the candidate product;
[0056] The specific calculation of the similarity of the symptoms applicable to the product is as follows:
[0057]
[0058] In the formula, The word vector representation of the symptom description applicable to the candidate product P;
[0059] The w i Use a classification algorithm to judge the current search term:
[0060] If the current search term belongs to the name description, then increase w Name The weight value of
[0061] If the current search term belongs to the description of efficacy, then increase w Effect The weight value of
[0062] If the current search term belongs to the symptom description, then increase w Symptom The weight value of
[0063] Among them, the total weight value satisfies ∑w i =1;
[0064] SA3. Filter the proximity score set according to an alternative threshold value to obtain an accurate list of related products, and display the corresponding product information.
[0065] The present invention aims at users' demand for high-precision product recommendations in medical e-commerce search scenarios, and further accurately matches the corrected search terms through multi-dimensional similarity evaluation and dynamic weight adjustment, thereby screening out products that best meet users' actual needs from highly relevant candidate products, and better assisting users in searching for products with greater accuracy in medical e-commerce scenarios.
[0066] A medical e-commerce search word error correction device includes a candidate search word acquisition unit, a fluency calculation unit, a fluency score judgment unit, a search word feature extraction unit, a candidate search word analysis unit and a related candidate search word acquisition unit;
[0067] The candidate search word acquisition unit is used to replace the original search word multiple times according to the character confusion set to obtain a number of candidate search words;
[0068] The fluency calculation unit is used to calculate the fluency of all candidate search terms and original search terms using an N-gram model to obtain a number of fluency scores and original scores;
[0069] The fluency score judgment unit is used to judge whether a number of fluency scores exceed the original score and exceed an error correction threshold: if not, the original search term is considered to be error-free and error correction is completed; if so, the search term feature extraction unit is called;
[0070] The search term feature extraction unit is used to perform text feature extraction, cross feature extraction and statistical feature extraction on potential correct search terms exceeding the threshold, obtain a number of text features, a number of cross features and a number of statistical features, and merge all the features into a feature vector to obtain a feature group of candidate search terms;
[0071] The candidate search word analysis unit is used to accurately discriminate the feature group of the candidate search word using the SVM discriminant model to obtain the discrimination result corresponding to the candidate search word;
[0072] The related candidate search word acquisition unit is used to calculate the priority of the candidate search words according to the discrimination result, and use the high priority as the current search word to complete error correction.
[0073] Further, the text features include the character length of the original search term, the character length of the candidate search term, the pinyin length of the original search term, and the pinyin length of the candidate search term;
[0074] The cross features include shape similarity, stroke similarity, number of similar subwords, pinyin similarity, different character proportions and pinyin equality features; wherein the specific calculation of the shape similarity is as follows:
[0075] Shape=SSIM(img(Q),img(Q′ i ))
[0076] In the formula, Shape is the shape similarity; img(Q) and img(Q′ i ) represent the font structure images of the original search word and the candidate search word respectively; SSIM is a structural similarity calculation method;
[0077] The specific calculation of the stroke similarity is as follows:
[0078]
[0079] Where Stroke is the stroke similarity, EdDistance(Radical(Q),Radical(Q′ i )) represents the edit distance between the radical sequence of the original search term and the candidate search term; max(len(Radical(Q)),len(Radical(Q′ i ))) means to obtain the maximum length of radical sequence;
[0080] The number of similar subwords is specifically expressed as follows:
[0081] Subword=Count(Q∩Q′ i )
[0082] In the formula, Subword is the number of similar subwords, Count(Q∩Q′ i ) represents the number of intersections between the original search term and the candidate search term;
[0083] The specific calculation of the pinyin similarity is as follows:
[0084]
[0085] Where, Spinyin is the pinyin similarity, Count(pinyin(Q)∩pinyin(Q′ i )) represents the total number of identical pinyins of the original search term and the candidate search term;
[0086] The specific calculation of different proportions of the characters is as follows:
[0087]
[0088] Where CharDiff is the ratio of different characters, max(len(Q),len(Q′ i )) represents the maximum number of characters of the original search term and the candidate search term;
[0089] The specific judgment of the pinyin equality feature is as follows:
[0090]
[0091] Where PinyinEqual is the pinyin equality feature, pinyin(Q) and pinyin(Q′ i ) represent the pinyin strings of the original search term and the candidate search term respectively;
[0092] The statistical features include the number of searches for the original search term, the number of searches for the candidate search term, the number of clicks on the original search term, the number of clicks on the candidate search term, the click rate of the original search term and the click rate of the candidate search term.
[0093] Furthermore, the priority calculation is expressed as follows:
[0094] The priority calculation is expressed as follows:
[0095]
[0096] In the formula, Priority i represents the i-th candidate search term Q′ i The priority score of i is the candidate search term Q′ i The discrimination weights are assigned according to the discrimination results of SVM, corresponding to: 0 for confidence abnormality, 1 for confidence potential abnormality, and 2 for confidence no abnormality; Denoted as Q′ i Fluency score.
[0097] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] Figure 1 It is a simplified structural diagram of the medical e-commerce search term correction device of the present invention;
[0099] Figure 2 A simplified flowchart of the method for correcting medical e-commerce search terms according to the present invention;
[0100] Figure 3 The figure is a simplified example diagram of the process of replacing the original search term with a character confusion set. DETAILED DESCRIPTION
[0101] In order to solve the problem of low confidence in keyword error correction in medical scenarios in the prior art, the present invention replaces the search terms by using a character confusion set to obtain several candidate search terms, and uses an N-gram model to score the fluency of all candidate search terms, and judges whether it exceeds an error correction threshold based on the score: if not, directly use the candidate search terms with high scores to find the corresponding product information; if so, use the SVM discriminant model to discriminate and screen the candidate search terms that exceed the threshold, obtain the relevant candidate search terms, and find the corresponding product information of the search terms. Accordingly, the present invention improves the confidence of the keyword error correction task through the collaborative processing of the n-gram model and SVM, especially through feature engineering, the SVM can perform secondary screening in combination with multi-dimensional features, and meet the requirements of medical scenarios for search accuracy at a low cost, thereby significantly improving the accuracy and professionalism of search results, thereby improving user experience and indirectly improving platform conversion rate.
[0102] Based on the above design, the present invention proposes a medical e-commerce search term error correction method, and based on this method proposes a medical e-commerce search term error correction device.
[0103] Please also see Figure 1 and Figure 2 , Figure 1 This is a simplified structural diagram of the medical e-commerce search term correction device of the present invention. Figure 2 The figure is a simplified flowchart of the method for correcting medical e-commerce search terms according to the present invention.
[0104] The medical e-commerce search term error correction device includes a candidate search term acquisition unit 1, a fluency calculation unit 2, a fluency score judgment unit 3, a search term feature extraction unit 4, a candidate search term analysis unit 5, a related candidate search term acquisition unit 6 and a related product information acquisition unit 7.
[0105] The candidate search word acquisition unit 1 is used to execute step S1: multiple replacements are performed on the original search word according to the character confusion set to obtain a number of candidate search words.
[0106] Specifically, a character confusion set is used to replace characters with similar pinyin or fonts in the original search term one by one to obtain several candidate search terms. The specific replacement process is shown as follows:
[0107] Suppose the search term entered by the user is q=q1,q2,…,q n , where n is the total string length of the search term;
[0108] The replacement process can be found in Figure 3 , which can be expressed as:
[0109] Q′={q′ i |q′ i ∈C(q i )}
[0110] In the formula, C(q i ) is a character confusion set, by replacing the i-th character q of Q i Replace with similar character q′ i , generate candidate search term Q′.
[0111] Based on this, all potential candidate search terms can be expressed as:
[0112] {Q′ i |i∈[1,k]}
[0113] In the formula, each candidate search word Q′ i It is obtained by replacing the characters in the original search term Q one by one;
[0114] For example: for the original search term Q = q1, q2, ..., q n The character q in i , its character confusion set C(q i ) There exists {c1,c2,…,c j} then character q i By replacing the character confusion set j times, j candidate characters can be obtained, and corresponding j candidate search terms Q′ can be generated. Based on this, the final total number of candidate search terms k is expressed as
[0115]
[0116] In the formula, j i Represented as the i-th character q i The corresponding number of replacements.
[0117] The fluency calculation unit 2 is used to execute step S2: using the N-gram model to perform fluency calculation on all candidate search terms and original search terms to obtain a number of fluency scores and original scores.
[0118] Specifically, the N-gram model adopts the KenLM model, which calculates the joint conditional probability of the candidate search term Q′ and the search term Q, and takes the logarithm of the corresponding probability value to obtain the fluency score corresponding to the candidate search term and the original score corresponding to the search term, thereby measuring the rationality and fluency of each candidate search term Q′ and search term Q under a given training corpus.
[0119] The fluency score calculation for a candidate search term Q′ is expressed as follows:
[0120]
[0121] In the formula, Q′=q′1,q′2,…,q′ n is a candidate search term, P(Q′) represents the joint conditional probability of the candidate search term Q′; where, for P(q′ i |q′ i-1 ,q′ i-2 ,…), the specific calculation is as follows:
[0122]
[0123] In the formula, Count(q′ i ,q′ i-1 ,q′ i-2 ,q′ i-3 ) represents the sequence (q′ i ,q′ i-1 ,q′ i-2 ,q′ i-3 ) appears in the training corpus; Count(q′i-1 ,q′ i-2 ,q′ i-3 ) represents the sequence (q′ i-1 ,q′ i-2 ,q′ i-3 ) in the training corpus;
[0124] Next, the joint conditional probability P(Q′) of the candidate search term Q′ is logarithmically calculated to obtain the fluency score corresponding to the candidate search term Q′, which is specifically expressed as follows:
[0125] Score Q′ =logP(Q′)
[0126] Among them, the present invention sets the maximum n value (hyperparameter) of the n-gram of the KenLM model to 4. Therefore, when calculating the conditional probability, the KenLM model takes into account the first three words of each word at most (tetragram model), so that the frequency calculation of the numerator and denominator contains the co-occurrence frequency of up to 4 words.
[0127] Since the search terms of medical e-commerce platforms often involve a large number of professional terms and vocabulary in specific fields, the present invention uses the search keyword data on the e-commerce platform and repeatedly writes it according to its search frequency, and writes the training corpus in combination with specific information in the fields of drug description, symptom description, and medical ingredients to fine-tune the KenLM model, thereby improving the adaptability of the KenLM model in the medical e-commerce scenario, so that the fluency calculation can more accurately characterize the rationality of the candidate search term in the field of medical e-commerce.
[0128] The fluency score judgment unit 3 is used to execute step S3: judging whether a number of fluency scores exceed the original score and exceed an error correction threshold: if not, calling the related product information acquisition unit 7; if so, calling the search term feature extraction unit 4.
[0129] Specifically, the fluency scores of all candidate search terms are used to determine whether there is a potential correct search term. The specific judgment logic is as follows:
[0130]
[0131] In the formula, Correct represents the set of potential correct search terms; Score is the fluency score of the i-th candidate search term; Q is the original score of the search term; Th is the error correction threshold, which is used for secondary screening to confirm the rigor of the screening of candidate search terms in the language model and reduce the risk of inaccurate replacement.
[0132] The error correction threshold is calculated based on the fluency scores of several high-frequency correct search terms, and the specific calculation method is as follows:
[0133] Th=μ-σ
[0134] Wherein, μ represents the mean of the fluency scores of the high-frequency correct search words in the training corpus of the KenLM model after training; σ represents the standard deviation of the fluency scores of the high-frequency correct search words in the training corpus of the KenLM model after training; wherein, the standard deviation can be calculated according to the actual fluency score distribution of the high-frequency words in the training process of the KenLM model based on the training corpus, and the ratio of its mean to the standard deviation is analyzed to ensure that the standard deviation is selected reasonably.
[0135] Furthermore, in the medical e-commerce search scenario, the differences in search terms are relatively large, and the candidate search terms often cover a variety of drug names, symptoms or efficacy descriptions. Therefore, the candidate term with the highest fluency score is usually the most consistent with the user's search intent. Based on this, in order to reduce the computational complexity of feature extraction and SVM discrimination, to increase the real-time performance of search term correction, and thus to enhance the user's search experience, the present invention uses the candidate search term with the highest fluency score in the current set of potential correct search terms Correct as the only potentially correct candidate search term, and executes step S4.
[0136] The search term feature extraction unit 4 is used to execute step S4: extracting features from the candidate search terms exceeding the threshold and the original search terms to obtain a feature group of the candidate search terms.
[0137] Specifically, text feature extraction, cross feature extraction and statistical feature extraction are performed on the potential correct search words exceeding the threshold value to obtain a number of text features, a number of cross features and a number of statistical features; then, all the features are merged into a feature vector to obtain a feature group of candidate search words.
[0138] Among them, the text features include the character length of the original search term, the character length of the candidate search term, the pinyin length of the original search term and the pinyin length of the candidate search term; the character length and pinyin length can be obtained by using the pinyin conversion function of the pypinyin library of Python combined with the len() function. Since the acquisition method is a conventional means in the field, the present invention will not specifically limit or elaborate on it here.
[0139] The cross features include shape similarity, stroke similarity, number of similar subwords, pinyin similarity, different character ratios and pinyin equality features; the shape similarity is used to measure the similarity between the original search term and the candidate search term in appearance, and the specific calculation is as follows:
[0140] Shape=SSIM(img(Q),img(Q′ i ))
[0141] In the formula, Shape is the shape similarity; img(Q) and img(Q′ i ) represent the font structure images of the original search word and the candidate search word respectively; SSIM is a structural similarity calculation method used to calculate shape similarity.
[0142] The stroke similarity is used to measure the similarity between the number of strokes of the original search term and the candidate search term characters, thereby reflecting the proximity of the original search term and the candidate search term in writing features. The specific calculation expression is as follows:
[0143]
[0144] Where Stroke is the stroke similarity, EdDistance(Radical(Q),Radical(Q′ i )) represents the edit distance between the radical sequence of the original search word and the candidate search word; Radical(Q) and Radical(Q′ i ) represent the radical sequence of the original search term and the candidate search term respectively, and the radical sequence is to split the Chinese characters into radicals and radicals, and arrange them into a sequence according to the writing order; max(len(Radical(Q)),len(Radical(Q′ i ))) indicates obtaining the maximum length of the radical sequence, which is used to normalize the edit distance between the radical sequences of the original search term and the candidate search term.
[0145] The number of similar subwords is used to calculate the number of identical characters between the original search term and the candidate search term, thereby identifying whether the replacement characters overlap, which is specifically expressed as follows:
[0146] Subword=Count(Q∩Q′ i )
[0147] In the formula, Subword is the number of similar subwords, Count(Q∩Q′ i ) represents the number of intersections between the original search term and the candidate search term.
[0148] The pinyin similarity is used to characterize the situation of pinyin mis-input by comparing the pinyin similarity between the original search term and the candidate search term. The specific calculation expression is as follows:
[0149]
[0150] Where, Spinyin is the pinyin similarity, Count(pinyin(Q)∩pinyin(Q′ i)) represents the total number of identical pinyins of the original search term and the candidate search term. The pinyin similarity can be calculated using edit distance, such as Levenshtein distance, to further measure the slight differences in similar-sounding characters.
[0151] The character difference ratio is used to measure the ratio of the character differences between the original search term and the candidate search term, and its specific calculation is as follows:
[0152]
[0153] Where CharDiff is the ratio of different characters, max(len(Q),len(Q′ i )) represents the maximum number of characters of the original search term and the candidate search term.
[0154] The pinyin equality feature is a consistency judgment of the pinyin of the original search term and the candidate search term, which is used to characterize the error of the same pinyin but different fonts. The specific judgment is as follows:
[0155]
[0156] Where PinyinEqual is the pinyin equality feature.
[0157] The statistical features include the number of searches for the original search term, the number of searches for the candidate search term, the number of clicks on the original search term, the number of clicks on the candidate search term, the click-through rate of the original search term and the click-through rate of the candidate search term; wherein, the statistical features are extracted through historical logs or records in the search database of the current medical e-commerce platform, and the specific acquisition method may vary due to differences in database configuration. Therefore, the present invention does not specifically limit the method for extracting its statistical features.
[0158] The present invention extracts independent features of original search terms and candidate search terms through text features, such as character structure and pinyin length, as the analysis basis of the SVM discriminant model, thereby characterizing the basic lexical characteristics of the original search terms and candidate search terms, so that the SVM discriminant model can recognize the preliminary differences composed of pinyin or characters.
[0159] Secondly, the present invention uses cross-features to perform fine-grained analysis from the perspective of character morphology and pinyin similarity, and further compares the degree of similarity in shape or sound between the original search term and the candidate search term, thereby providing more detailed structural and phonetic information for the SVM discriminant model, enabling the SVM discriminant model to more accurately determine whether the candidate search term is the correct search term, thereby effectively improving the accuracy of the SVM discriminant model.
[0160] Ultimately, the present invention uses the statistical features to characterize the specific scenarios of medical e-commerce with user search behavior data, and provides supplementary information related to medical e-commerce for the SVM discriminant model, thereby making up for the limitations of the SVM discriminant model in context understanding, and then enabling the SVM discriminant model to identify the relevance of search terms in medical e-commerce search scenarios from user behavior data, thereby enhancing the applicability and accuracy of search term error correction.
[0161] The candidate search word analysis unit 5 is used to execute step S5: using the SVM discriminant model to accurately discriminate the candidate search word feature group to obtain the discrimination result corresponding to the candidate search word.
[0162] Specifically, the discrimination results include confidence no anomaly, confidence potential anomaly and confidence anomaly. The confidence no anomaly indicates that the SVM discrimination model believes that the candidate search term generated by KenLM is highly accurate, and the current candidate search term can be directly replaced with the correct search term.
[0163] The potential abnormality of confidence indicates that the SVM discriminant model believes that the candidate search terms generated by KenLM may have some deviations and are not completely accurate, and the candidate search terms need to be further verified or listed as priority candidates for subsequent selection or verification;
[0164] The confidence anomaly indicates that the SVM discriminant model believes that the candidate search term generated by KenLM is less reasonable and is not suitable as a replacement, and the candidate search term needs to be removed from the candidate search term list or set.
[0165] In order to make the SVM discriminant model more accurate, the present invention further trains the SVM discriminant model through the following steps:
[0166] T1 collects several original search terms and their candidate search terms, labels each candidate search term, associates the labeled label with the candidate search term, and generates an error correction confidence dataset.
[0167] The labels include confidence level no anomaly, confidence level potential anomaly, and confidence level anomaly.
[0168] T2: Extract features from the original search terms and the corresponding candidate search terms in the error correction confidence dataset to form a feature group of the candidate search terms, and associate the feature group with the error correction confidence dataset.
[0169] The feature extraction is consistent with the feature extraction in the aforementioned step S4, and the present invention will not be described in detail here.
[0170] T3: Divide the current error correction confidence data set into training set, validation set and test set.
[0171] The default division ratio is 70% for training set, 15% for validation set and 15% for test set.
[0172] T4: Use the training set to train the current SVM discriminant model, and use the test set to evaluate the training effect to obtain the trained SVM discriminant model.
[0173] Among them, the hyperparameters of the SVM discriminant model include the regularization parameter C, the kernel function kernel and the kernel function influence range Gamma, etc. By tuning the hyperparameters, the output of the SVM discriminant model can be more accurate. The specific details are conventional content in this field and will not be elaborated in detail in the present invention.
[0174] T5: Input the feature group of the candidate search terms in the validation set into the SVM discriminant model for discrimination, and perform error calculation between the discrimination result and the corresponding label in the validation set to obtain the error value.
[0175] Among them, the error calculation can be calculated by selective classification error rate or cross entropy loss, which is used to evaluate the classification accuracy of the current SVM discriminant model on the validation set. Since the error calculation method can be selected according to actual conditions, the present invention does not specifically limit the error calculation method.
[0176] T6: Determine whether the error value is lower than the set error threshold: if so, complete the training and obtain the optimized SVM discriminant model; if not, tune the hyperparameters of the SVM discriminant model according to the error value, and return to step T4 to continue training.
[0177] The hyperparameter tuning of the SVM discriminant model can adopt the GridSearchCV function in the sklearn library, so as to select the best parameter combination through cross-validation, accelerate training and improve model performance.
[0178] The related candidate search word acquisition unit 6 is used to execute step S6: calculate the priority of the candidate search words according to the discrimination result, and use the high priority as the current search word to complete error correction.
[0179] Specifically, the priority calculation is expressed as follows:
[0180]
[0181] In the formula, Priority i represents the i-th candidate search term Q′ i The priority score of i is the candidate search term Q′ i The discrimination weights are assigned according to the discrimination results of SVM, corresponding to: 0 for confidence abnormality, 1 for confidence potential abnormality, and 2 for confidence no abnormality; Denoted as Q′ i Fluency score.
[0182] Furthermore, the highest priority score after priority calculation is Priority i Candidate search term Q′ i As the current search term, complete error correction.
[0183] Since there may be several candidate search terms in the set of potential correct search terms, the present invention further performs priority calculation and screening in combination with SVM discrimination weights and fluency scores to ensure that the words that best meet the user's actual needs can be selected from all candidate search terms, thereby improving the search term replacement accuracy and user experience.
[0184] The related product information acquisition unit 7 is used to execute step S7: search for products in the medical e-commerce database according to the current high-priority search term, and display product information corresponding to the search result.
[0185] Specifically, the product search includes the following steps:
[0186] A preliminary search is performed on the medical e-commerce database based on the current high-priority search terms to obtain a search term-related product set, which is specifically expressed as follows:
[0187] KeyProduct = {Q o ,{P j |j∈[1,m]}|i∈[1,n]}
[0188] In the formula, KeyProduct is represented by the set of search terms and related products; Q i represents the i-th search term, {P j |j∈[1,m]} is the set of search products corresponding to the i-th search term; n is the total number of high-priority search terms; m is the number of products corresponding to the current search term Q i The total number of products found.
[0189] According to the current high-priority search term, a multi-dimensional similarity calculation is performed on several related products to obtain a proximity score set. The specific calculation of the proximity score of a search product is as follows:
[0190]
[0191] Where FinalScore P It is represented as the proximity score corresponding to product P; w i Similarity is a dynamic weight parameter used to adjust the relative importance of each similarity dimension and is dynamically adjusted according to the type of search term; iIt is a similarity evaluation function, including product name similarity, product efficacy similarity and product applicable symptom similarity.
[0192] The product name similarity is used to measure the current candidate product P and the corresponding search term Q i The name similarity between them is calculated as follows:
[0193]
[0194] Where, Eddistance(Q i ,P Name ) indicates the current candidate product name P Name The corresponding search term Q i The edit distance between them can be calculated with optional Levenshtein distance; len(Q i ) and len(P Name ) represent the corresponding search terms Q i and candidate product name P Name The character length of is used to normalize the similarity.
[0195] The product efficacy similarity is used to measure the efficacy of the current candidate product P and the corresponding search term Q i The similarity score of the efficacy description between is calculated using cosine similarity, and its specific calculation is as follows:
[0196]
[0197] In the formula, For the search term Q i The word vector representation of ; The word vector representation of the efficacy description of the candidate product P; and They are the norms of the word vectors of the search term and the word vectors of the candidate product efficacy description, respectively, representing the length of their word vectors and used for normalization of similarity calculation.
[0198] Among them, the word vector can be calculated through a pre-trained model or a custom word embedding. The method of obtaining the word vector is a conventional technical means in this field and can be flexibly selected according to actual needs. The present invention does not specifically describe and limit the method of obtaining the word vector.
[0199] The product applicable symptom similarity is used to measure the applicable symptoms of the current candidate product P and the corresponding search term Q i The similarity of the symptom descriptions between the two is calculated using cosine similarity, and the specific calculation is as follows:
[0200]
[0201] In the formula, The word vector representation of the symptom description applicable to the candidate product P.
[0202] And w i Use a classification algorithm to judge the current search term:
[0203] If the current search term belongs to the name description, then increase w Name The weight value of the current weight value is prioritized to account for 0.5 to 0.7;
[0204] If the current search term belongs to the description of efficacy, we Effect The weight value of the current weight value is prioritized to account for 0.5 to 0.7;
[0205] If the current search term belongs to the symptom description, we SSnptoim The weight value of the current weight value is prioritized to account for 0.5 to 0.7.
[0206] Among them, the total weight value satisfies ∑w i = 1. The classification algorithm can select a variety of machine learning methods such as decision trees or random forests, and can be flexibly adjusted according to actual needs. Therefore, the present invention does not specifically limit the selection of its classification algorithm.
[0207] The proximity score set is filtered according to an alternative threshold value to obtain an accurate list of related products, and the corresponding product information is displayed.
[0208] The alternative threshold may be selected as 60% of the current highest proximity score to filter out products with low proximity scores, ensuring that the displayed products are more closely matched with the user's search intent, thereby improving search accuracy and user experience.
[0209] It should be noted that in order to ensure the user's true search intention and user experience, generally after the user client displays the corrected search results, it will display the words "Still search: (original search term)", so as to prevent the user's search experience from being affected by the current platform's mandatory error correction search terms, or the forced error correction behavior from causing user disgust.
[0210] Compared with the prior art, the present invention is based on the preliminary screening of the N-gram model, and further performs comprehensive feature extraction and SVM discriminant model on the preliminary screened error correction candidate search terms to achieve secondary screening, thereby improving the accuracy of search term error correction and significantly reducing the risk of miscorrection in the medical e-commerce field. Next, the present invention combines the SVM discrimination result with the fluency score to perform priority calculation, and ensures that the final recommended error correction word is more in line with the user's actual search needs according to the priority level.
[0211] In addition, the present invention further combines multi-dimensional similarity evaluation and dynamic weight adjustment to achieve multi-level matching analysis of product recommendations, improves the accuracy and optimization effect of recommendations, and optimizes the user's search assistance experience on the medical e-commerce platform.
[0212] Based on the same inventive concept, the present application also provides an electronic device, which may be a terminal device such as a server, a desktop computing device or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the control method for automatic winding of a lithium battery pole piece according to an embodiment of the present invention; and the memory is used to store a computer program executable by the processor.
[0213] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the embodiment of the control method for automatic winding of lithium battery pole pieces mentioned above, and the computer-readable storage medium stores a computer program thereon, and when the program is executed by the processor, the steps of the control method for automatic winding of lithium battery pole pieces recorded in any of the above embodiments are implemented.
[0214] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0215] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, and the present invention is also intended to include these modifications and modifications.
Claims
1. A method for correcting medical e-commerce search terms, characterized in that: The following steps are involved: S1. Replace the original search term multiple times according to the character confusion set to obtain several candidate search terms; S2, using the N-gram model to calculate the fluency of all candidate search terms and original search terms, and obtain a number of fluency scores and original scores; S3, determining whether a number of fluency scores exceed the original score and exceed an error correction threshold: if not, it is considered that the original search term is error-free and error correction is completed; If yes, execute step S4; S4, performing text feature extraction, cross feature extraction and statistical feature extraction on the potential correct search words exceeding the threshold, obtaining a number of text features, a number of cross features and a number of statistical features, and merging all the features into a feature vector to obtain a feature group of candidate search words; S5, using the SVM discriminant model to accurately discriminate the feature group of the candidate search term, and obtain the discrimination result corresponding to the candidate search term; S6. Calculate the priority of the candidate search terms according to the discrimination result, and use the high priority as the current search term to complete error correction.
2. The method for correcting medical e-commerce search terms according to claim 1, characterized in that: The text features include the original search word character length, the candidate search word character length, the original search word pinyin length and the candidate search word pinyin length; The cross features include shape similarity, stroke similarity, number of similar subwords, phonetic similarity, different proportions of characters and phonetic equality features; The statistical features include the number of searches for the original search term, the number of searches for the candidate search term, the number of clicks on the original search term, the number of clicks on the candidate search term, the click rate of the original search term and the click rate of the candidate search term.
3. The method for correcting medical e-commerce search terms according to claim 2, characterized in that: The specific calculation of the shape similarity is as follows: The specific calculation of the shape similarity is as follows: Shape=SSIM(img(Q),img(Q′ i )) In the formula, Shape is the shape similarity; img(Q) and img(Q′ i ) represent the font structure images of the original search word and the candidate search word respectively; SSIM is a structural similarity calculation method; The specific calculation of the stroke similarity is as follows: Where Stroke is the stroke similarity, EdDistance(Radical(Q),Radical(Q′ i )) represents the edit distance between the radical sequence of the original search term and the candidate search term; max(len(Radical(Q)),len(Radical(Q′ i ))) means to obtain the maximum length of radical sequence; The number of similar subwords is specifically expressed as follows: Subword=Count(Q∩Q′ i ) In the formula, Subword is the number of similar subwords, Count(Q∩Q′ i ) represents the number of intersections between the original search term and the candidate search term; The specific calculation of the pinyin similarity is as follows: Where, Spinyin is the pinyin similarity, Count(pinyin(Q)∩pinyin(Q′ i )) represents the total number of identical pinyins of the original search term and the candidate search term; The specific calculation of different proportions of the characters is as follows: Where CharDiff is the ratio of different characters, max(len(Q),len(Q′ i )) represents the maximum number of characters of the original search term and the candidate search term; The specific judgment of the pinyin equality feature is as follows: Where PinyinEqual is the pinyin equality feature, pinyin(Q) and penyin(Q′ i ) represent the pinyin strings of the original search term and the candidate search term respectively.
4. The method for correcting medical e-commerce search terms according to claim 3, characterized in that: The priority calculation is expressed as follows: In the formula, priority i represents the i-th candidate search term Q′ i Priority score; w i is the candidate search term Q′ i The discrimination weights are assigned according to the discrimination results of SVM, corresponding to: 0 for confidence abnormality, 1 for confidence potential abnormality, and 2 for confidence no abnormality; Denoted as Q′ i Fluency score.
5. The method for correcting medical e-commerce search terms according to claim 4, characterized in that: After completing the search term correction, the following steps are also included: Search products in the medical e-commerce database based on the current high-priority search terms, and display the product information corresponding to the search results; The product search specifically includes the following sub-steps: SA1. Perform a preliminary search on the medical e-commerce database based on the current high-priority search terms to obtain a search term-related product set, which is specifically expressed as follows: KeyProduct={Q i ,{P j |j∈[1,m]}|i∈[1,n]} In the formula, KeyProduct is represented by the set of search terms and related products; Q i represents the i-th search term, {P j |j∈[1,m]} is the set of search products corresponding to the i-th search term; n is the total number of high-priority search terms; m is the number of products corresponding to the current search term Q i Total number of products searched; SA2. Perform multi-dimensional similarity calculation on several related products based on the current high-priority search term to obtain a proximity score set. The specific calculation of the proximity score of a search product is as follows: Where FinalScore P It is represented as the proximity score corresponding to product P; w i is a dynamic weight parameter; Similarity i is a similarity evaluation function, including product name similarity, product efficacy similarity and product applicable symptom similarity; The specific calculation of the product name similarity is as follows: Where, EdDistance(Q i ,P Name ) indicates the current candidate product name P Name The corresponding search term Q i The edit distance between i ) and len(P Name ) represent the corresponding search terms Q i and candidate product name P Name The character length of The specific calculation of the product efficacy similarity is as follows: In the formula, For the search term Q i The word vector representation of ; The word vector representation of the efficacy description of the candidate product P; and are the norms of the word vector of the search term and the word vector of the description of the efficacy of the candidate product; The specific calculation of the similarity of the symptoms applicable to the product is as follows: In the formula, The word vector representation of the symptom description applicable to the candidate product P; The w i Use a classification algorithm to judge the current search term: If the current search term belongs to the name description, then increase w Name The weight value of If the current search term belongs to the description of efficacy, then increase w Effect The weight value of If the current search term belongs to the symptom description, then increase w Symptom The weight value of Among them, the total weight value satisfies ∑w i =1; SA3. Filter the proximity score set according to an alternative threshold value to obtain an accurate list of related products, and display the corresponding product information.
6. A device for correcting medical e-commerce search terms, characterized in that: It includes a candidate search word acquisition unit, a fluency calculation unit, a fluency score judgment unit, a search word feature extraction unit, a candidate search word analysis unit and a related candidate search word acquisition unit; The candidate search word acquisition unit is used to replace the original search word multiple times according to the character confusion set to obtain a number of candidate search words; The fluency calculation unit is used to calculate the fluency of all candidate search terms and original search terms using an N-gram model to obtain a number of fluency scores and original scores; The fluency score judging unit is used to judge whether a number of fluency scores exceed the original scores and exceed an error correction threshold: if not, it is considered that the original search term has no errors and error correction is completed; If yes, calling the search term feature extraction unit; The search term feature extraction unit is used to perform text feature extraction, cross feature extraction and statistical feature extraction on potential correct search terms exceeding the threshold, obtain a number of text features, a number of cross features and a number of statistical features, and merge all the features into a feature vector to obtain a feature group of candidate search terms; The candidate search word analysis unit is used to accurately discriminate the feature group of the candidate search word using the SVM discriminant model to obtain the discrimination result corresponding to the candidate search word; The related candidate search word acquisition unit is used to calculate the priority of the candidate search words according to the discrimination result, and use the high priority as the current search word to complete error correction.
7. The medical e-commerce search term error correction device according to claim 6, characterized in that: The text features include the original search word character length, the candidate search word character length, the original search word pinyin length and the candidate search word pinyin length; The cross features include shape similarity, stroke similarity, number of similar subwords, pinyin similarity, different character proportions and pinyin equality features; wherein the specific calculation of the shape similarity is as follows: The specific calculation of the shape similarity is as follows: Shape=SSIM(img(Q),img(Q′ i )) In the formula, Shape is the shape similarity; img(Q) and img(Q′ i ) represent the font structure images of the original search word and the candidate search word respectively; SSIM is a structural similarity calculation method; The specific calculation of the stroke similarity is as follows: Where Stroke is the stroke similarity, EdDistance(Radical(Q),Radical(Q′ i )) represents the edit distance between the radical sequence of the original search term and the candidate search term; max(len(Radical(Q)),len(Radical(Q′ i ))) means to obtain the maximum length of radical sequence; The number of similar subwords is specifically expressed as follows: Subword=Count(Q∩Q′ i ) In the formula, Subword is the number of similar subwords, Count(Q∩Q′ i ) represents the number of intersections between the original search term and the candidate search term; The specific calculation of the pinyin similarity is as follows: Where, Spinyin is the pinyin similarity, Count(pinyin(Q)∩pinyin(Q′ i )) represents the total number of identical pinyins of the original search term and the candidate search term; The specific calculation of different proportions of the characters is as follows: Where CharDiff is the ratio of different characters, max(len(Q),len(Q′ i )) represents the maximum number of characters of the original search term and the candidate search term; The specific judgment of the pinyin equality feature is as follows: Where PinyinEqual is the pinyin equality feature, pinyin(Q) and pinyin(Q′ i ) represent the pinyin strings of the original search term and the candidate search term respectively; The statistical features include the number of searches for the original search term, the number of searches for the candidate search term, the number of clicks on the original search term, the number of clicks on the candidate search term, the click rate of the original search term and the click rate of the candidate search term.
8. The medical e-commerce search term error correction device according to claim 7, characterized in that: The priority calculation is expressed as follows: In the formula, Priority i represents the i-th candidate search term Q′ i Priority score; w i is the candidate search term Q′ i The discrimination weights are assigned according to the discrimination results of SVM, corresponding to: 0 for confidence abnormality, 1 for confidence potential abnormality, and 2 for confidence no abnormality; Denoted as Q′ i Fluency score.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the error correction method for medical e-commerce search terms as described in any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by the processor, the medical e-commerce search term error correction method as described in any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Speech text error correction method, system and equipment based on vertical field and medium
CN110210029A
Text processing method and device
CN111368506A
Drug recommendation recall method and system
CN111966819A
Search text processing method, device, electronic equipment and medium
CN113535895A
Text error correction method and device, computer equipment and computer readable storage medium
CN113569561A