Text error correction method and device

By combining a hybrid dictionary tree with multiple error correction models, the problem of error correction in Chinese, English, and Pinyin mixed texts is solved, the coverage and applicability of error correction are improved, and the processing speed of long-tail words is accelerated to ensure Improve the timeliness of error correction.

CN110032722BActive Publication Date: 2024-09-24BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201810030108.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-01-12
Publication Date
2024-09-24
Estimated Expiration
2038-01-12

AI Technical Summary

Technical Problem

Existing query error correction technology is difficult to correct errors in mixed Chinese, English, and Pinyin texts, and the processing speed and timeliness of long-tail words are poor.

Method used

Using a hybrid dictionary tree and multiple error correction models (noise channel error correction model, edit distance error correction model, pinyin distance error correction model) combined with forward maximum matching and reverse maximum matching algorithms to obtain the pinyin sequence of the text to be corrected, Calculate the evaluation value of the candidate text to determine the error correction result.

Benefits of technology

Effectively handles error correction of Chinese, English, and Pinyin mixed text, improves the coverage and applicability of error correction, and significantly improves processing speed and timeliness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110032722B
    Figure CN110032722B
Patent Text Reader

Abstract

The present invention discloses a text error correction method and device, and relates to the field of computer technology. The method comprises: obtaining a pinyin sequence of a text to be corrected; searching a hybrid dictionary tree to obtain a candidate text set matching the pinyin sequence of the text to be corrected; the hybrid dictionary tree includes a correspondence between pinyin and Chinese words and English words; and determining the error correction result of the text to be corrected according to an error correction model and the candidate text set. Through the above steps, the text error correction of Chinese, English and pinyin mixture can be well processed, and the coverage and applicability of text error correction are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a text error correction method and device. Background Art

[0002] In recent years, query error correction technology has been widely used in retrieval systems and has achieved good results. With the development of the Internet industry, query error correction technology has also received more and more attention in other Internet fields (such as e-commerce).

[0003] Existing query error correction technologies are mainly divided into the following two types: text error correction methods based on user conversations and text error correction methods based on probability models. In the first text error correction method, the main focus is on mining candidate error correction pairs that users actively rewrite based on user search conversation logs, and using them as the correct search terms after error correction. In the second text error correction method, the main focus is on using user search terms with high click volume as the error correction candidate set, and then using statistical models to calculate the probability of candidate texts, and using the one with the highest probability as the correct search term after error correction.

[0004] In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: first, the prior art cannot handle the query correction of mixed Chinese, English and Pinyin well; second, the prior art has a slow speed and poor timeliness in processing query correction for long-tail words. Summary of the invention

[0005] In view of this, the present invention provides a text error correction method and device, which can well handle the correction of mixed Chinese, English and Pinyin texts, thereby improving the coverage and applicability of text error correction.

[0006] To achieve the above objective, according to a first aspect of the present invention, a text error correction method is provided.

[0007] The text error correction method of the present invention comprises: obtaining the pinyin sequence of the text to be corrected; searching a hybrid dictionary tree to obtain a candidate text set matching the pinyin sequence of the text to be corrected; the hybrid dictionary tree comprises the correspondence between pinyin and Chinese words and English words; and determining the error correction result of the text to be corrected according to the error correction model and the candidate text set.

[0008] Optionally, the step of obtaining the pinyin sequence of the text to be corrected includes: if the text to be corrected is composed of Chinese characters, then the pinyin of the Chinese characters is used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of non-Chinese characters, then the non-Chinese characters themselves are used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of Chinese characters and non-Chinese characters, then the whole consisting of the pinyin of the Chinese characters and the non-Chinese characters themselves is used as the pinyin sequence of the text to be corrected; wherein the non-Chinese characters include: numbers, English words and / or pinyin.

[0009] Optionally, the step of searching the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected includes: searching the hybrid dictionary tree based on a forward maximum matching algorithm and a reverse maximum matching algorithm, and determining the candidate text set that matches the pinyin sequence based on the forward maximum matching result and the reverse maximum matching result.

[0010] Optionally, the step of determining the error correction result of the text to be corrected based on the error correction model and the candidate text set includes: calculating the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; fusing multiple evaluation factors to obtain the evaluation value of the candidate text; and determining the error correction result of the text to be corrected based on the evaluation value.

[0011] Optionally, the multiple error correction models include at least two of the following: a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model.

[0012] Optionally, in the case where the multiple error correction models include a noise channel error correction model, an edit distance error correction model and a pinyin distance error correction model, the step of calculating the evaluation factor of each candidate text in the candidate text set based on the multiple error correction models includes: calculating the noise channel probability of the candidate text based on the noise channel error correction model, and using it as the first evaluation factor of the candidate text; calculating the edit distance of the candidate text based on the edit distance error correction model, and determining the second evaluation factor of the candidate text according to the edit distance; calculating the pinyin distance of the candidate text based on the pinyin distance error correction model, and determining the third evaluation factor of the candidate text according to the pinyin distance.

[0013] Optionally, the step of calculating the pinyin distance of the candidate text based on the pinyin distance error correction model includes: comparing the characters in the error correction text and the candidate text one by one to see whether their pinyin component letters are the same and whether their tones are the same; determining the pinyin distance of each character based on the comparison result, and taking the sum of the pinyin distances of each character as the pinyin distance of the candidate text.

[0014] Optionally, the forward maximum matching result and the reverse maximum matching result include: at least one candidate text fragment; the method also includes: editing the pinyin sequence of the candidate text fragment; searching the hybrid dictionary tree according to the edited pinyin sequence to obtain a newly added candidate text fragment that matches the edited pinyin sequence, and constructing a candidate text set that matches the pinyin sequence of the text to be corrected based on the candidate text fragments and the newly added candidate text fragments.

[0015] Optionally, the step of editing the pinyin sequence of the candidate text segment includes: when the candidate text segment includes Chinese characters, performing an editing operation of fuzzy pronunciation on the pinyin of the Chinese characters; when the candidate text segment includes English words, performing an editing operation of inserting, replacing, exchanging and / or deleting the English words.

[0016] Optionally, the method further comprises: acquiring a pinyin sequence of a training sample word, and constructing a hybrid dictionary tree according to the pinyin sequence of the training sample word.

[0017] Optionally, the method further comprises: before the step of acquiring the pinyin sequence of the training sample words and constructing a hybrid dictionary tree according to the pinyin sequence of the training sample words, cleaning the source data to obtain the training sample words.

[0018] To achieve the above objective, according to a second aspect of the present invention, a search method is provided.

[0019] The search method of the present invention includes: receiving input text; obtaining the pinyin sequence of the input text when determining that the input text is a text to be corrected; searching a hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the input text; the hybrid dictionary tree includes the correspondence between pinyin and Chinese words and English words; determining the error correction result of the input text based on the error correction model and the candidate text set; obtaining search results based on the error correction result of the input text, and sending the search results.

[0020] To achieve the above objective, according to a third aspect of the present invention, a search and error correction method is provided.

[0021] The search and error correction method of the present invention comprises: receiving input text; obtaining the pinyin sequence of the input text when determining that the input text is the text to be corrected; searching a hybrid dictionary tree to obtain a candidate text set matching the pinyin sequence of the input text; the hybrid dictionary tree comprises the correspondence between pinyin and Chinese words and English words; determining the error correction result of the input text according to the error correction model and the candidate text set; sorting the error correction results of the input text, and sending the sorted error correction results.

[0022] To achieve the above objective, according to a fourth aspect of the present invention, a text error correction device is provided.

[0023] The text correction device of the present invention comprises: an acquisition module, used for acquiring the pinyin sequence of the text to be corrected; a search module, used for searching a hybrid dictionary tree to obtain a candidate text set matching the pinyin sequence of the text to be corrected; the hybrid dictionary tree comprises the correspondence between pinyin and Chinese words and English words; a determination module, used for determining the correction result of the text to be corrected according to the correction model and the candidate text set.

[0024] Optionally, the acquisition module acquires the pinyin sequence of the text to be corrected including: if the text to be corrected is composed of Chinese characters, the acquisition module uses the pinyin of the Chinese characters as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of non-Chinese characters, the acquisition module uses the non-Chinese characters themselves as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of Chinese characters and non-Chinese characters, the acquisition module uses the whole composed of the pinyin of the Chinese characters and the non-Chinese characters themselves as the pinyin sequence of the text to be corrected; wherein the non-Chinese characters include: numbers, English words and / or pinyin.

[0025] Optionally, the search module searches the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected, including: the search module searches the hybrid dictionary tree based on a forward maximum matching algorithm and a reverse maximum matching algorithm, and determines the candidate text set that matches the pinyin sequence based on the forward maximum matching result and the reverse maximum matching result.

[0026] Optionally, the determination module determines the error correction result of the text to be corrected according to the error correction model and the candidate text set, including: the determination module calculates the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; the determination module fuses the multiple evaluation factors to obtain the evaluation value of the candidate text; the determination module determines the error correction result of the text to be corrected according to the evaluation value.

[0027] Optionally, the multiple error correction models include at least two of the following: a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model.

[0028] Optionally, in the case where the multiple error correction models include a noise channel error correction model, an edit distance error correction model and a pinyin distance error correction model, the determination module calculates the evaluation factor of each candidate text in the candidate text set based on the multiple error correction models, including: the determination module calculates the noise channel probability of the candidate text based on the noise channel error correction model, and uses it as the first evaluation factor of the candidate text; the determination module calculates the edit distance of the candidate text based on the edit distance error correction model, and determines the second evaluation factor of the candidate text according to the edit distance; the determination module calculates the pinyin distance of the candidate text based on the pinyin distance error correction model, and determines the third evaluation factor of the candidate text according to the pinyin distance.

[0029] Optionally, the determination module calculates the pinyin distance of the candidate text based on the pinyin distance correction model, including: the determination module compares the pinyin components of the correction text and the characters in the candidate text one by one to see whether they are the same and whether the tones are the same; the determination module determines the pinyin distance of each character according to the comparison result, and takes the sum of the pinyin distances of each character as the pinyin distance of the candidate text.

[0030] Optionally, the forward maximum matching result and the reverse maximum matching result include: at least one candidate text segment; the device also includes: an editing module for editing the pinyin sequence of the candidate text segment; the search module is also used to search the hybrid dictionary tree according to the edited pinyin sequence to obtain a newly added candidate text segment that matches the edited pinyin sequence, and construct a candidate text set that matches the pinyin sequence of the text to be corrected based on the candidate text segment and the newly added candidate text segment.

[0031] Optionally, the editing module performs editing operations on the pinyin sequence of the candidate text segment, including: when the candidate text segment includes Chinese characters, the editing module performs fuzzy sound editing operations on the pinyin of the Chinese characters; when the candidate text segment includes English words, the editing module performs editing operations of inserting, replacing, exchanging and / or deleting the English words.

[0032] Optionally, the device further comprises: a construction module, configured to obtain a pinyin sequence of a training sample word, and construct a hybrid dictionary tree according to the pinyin sequence of the training sample word.

[0033] Optionally, the device further comprises: a cleaning module, configured to clean the source data to obtain the training sample words.

[0034] To achieve the above objective, according to a fifth aspect of the present invention, an electronic device is provided.

[0035] The electronic device of the present invention comprises: one or more processors; and a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the text error correction method of the present invention.

[0036] To achieve the above objective, according to a sixth aspect of the present invention, a computer readable medium is provided.

[0037] The computer-readable medium of the present invention stores a computer program, and when the program is executed by a processor, the text error correction method of the present invention is implemented.

[0038] An embodiment of the above invention has the following advantages or beneficial effects: In the embodiment of the present invention, by obtaining the pinyin sequence of the text to be corrected, searching the mixed dictionary tree to obtain candidate texts that match the pinyin sequence of the text to be corrected, calculating the evaluation value of the candidate text, and determining the correction result of the text to be corrected according to the evaluation value, it is possible to well handle text correction of a mixture of Chinese, English, and pinyin, and improve the coverage and applicability of text correction.

[0039] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0041] Figure 1 is a schematic diagram of the main steps of a text error correction method according to an embodiment of the present invention;

[0042] Figure 2 is a schematic diagram of main steps of a text error correction method according to another embodiment of the present invention;

[0043] Figure 3 is a schematic diagram of the main steps of a text error correction method according to another embodiment of the present invention;

[0044] Figure 4 is a schematic diagram of a hybrid dictionary tree according to an embodiment of the present invention;

[0045] Figure 5 is a schematic diagram of main modules of a text error correction device according to an embodiment of the present invention;

[0046] Figure 6 is a schematic diagram of main modules of a text error correction device according to another embodiment of the present invention;

[0047] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0048] Figure 8 It is a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0050] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.

[0051] Figure 1 FIG. 1 is a schematic diagram of the main steps of a text error correction method according to an embodiment of the present invention. Figure 1 As shown, the text error correction method of the embodiment of the present invention includes:

[0052] Step S101, obtaining the pinyin sequence of the text to be corrected.

[0053] Specifically, step S101 includes: if the text to be corrected is composed of Chinese characters, the pinyin of the Chinese characters is used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of non-Chinese characters, the non-Chinese characters themselves are used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of Chinese characters and non-Chinese characters, the whole composed of the pinyin of the Chinese characters and the non-Chinese characters themselves is used as the pinyin sequence of the text to be corrected; wherein the non-Chinese characters include: numbers, English words and / or pinyin.

[0054] For example, if the text to be corrected is "women's sports shoes", the pinyin sequence of the text to be corrected is "nv shi yundong xie". For example, if the text to be corrected is "iphone8", the pinyin sequence of the text to be corrected is "iphone8". For example, if the text to be corrected is "adidas men's sports shoes", the pinyin sequence of the text to be corrected is "adidas nan shi yundong xie"

[0055] Step S102: Search the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected.

[0056] Among them, the hybrid dictionary tree includes the corresponding relationships between pinyin, Chinese words, and English words. In the hybrid dictionary tree, each node stores a character. Moreover, in the node storing the last character of the pinyin, the word corresponding to the pinyin is also stored. Among them, the corresponding word can be a Chinese word or an English word. For example, assuming that the pinyin "huawei" is stored in the hybrid dictionary tree, the root node is empty, and the characters "h", "u", "a", "w", "e", "i" are sequentially stored in each node under the root node. And in the node storing the character "i", words corresponding to the pinyin sequence such as "huawéi" and "Huawei" are also stored.

[0057] Exemplarily, assuming that the text to be corrected is "huawéi shǒujī", and the pinyin sequence of the text to be corrected is "hua weishou ji", the candidate text set obtained through step S102 includes the following candidate texts: "Huawei mobile phone", "huawéi shǒujī", "Huawei collection", and "huawéi shōují".

[0058] Step S103: Determine the correction result of the text to be corrected according to the correction model and the candidate text set.

[0059] In the embodiment of the present invention, by pre-constructing a hybrid dictionary tree, obtaining the pinyin sequence of the text to be corrected, searching the hybrid dictionary tree to obtain a candidate text set matching the pinyin sequence of the text to be corrected, and determining the correction result of the text to be corrected according to the correction model and the candidate text set, it is possible to well process the text correction of the mixture of Chinese, English, and pinyin, and improve the coverage rate and applicability of text correction.

[0060] Figure 2 It is a schematic diagram of the main steps of a text correction method according to another embodiment of the present invention. As Figure 2 shown, the text correction method of the embodiment of the present invention includes:

[0061] Step S201: Obtain the pinyin sequence of the text to be corrected.

[0062] Specifically, step S201 includes: if the text to be corrected consists of Chinese characters, then use the pinyin of the Chinese characters as the pinyin sequence of the text to be corrected; if the text to be corrected consists of non-Chinese characters, then use the non-Chinese characters themselves as the pinyin sequence of the text to be corrected; if the text to be corrected consists of Chinese characters and non-Chinese characters, then use the whole composed of the pinyin of the Chinese characters and the non-Chinese characters themselves as the pinyin sequence of the text to be corrected; among them, the non-Chinese characters include: numbers, English words, and / or pinyin.

[0063] Step S202: Search for the hybrid dictionary tree based on the forward maximum matching algorithm and the backward maximum matching algorithm, and determine a candidate text set that matches the pinyin sequence of the text to be corrected according to the forward maximum matching result and the backward maximum matching result.

[0064] Specifically, in the forward maximum matching algorithm and the backward maximum matching algorithm of the embodiments of the present invention: First, segment the pinyin sequence of the text to be corrected, and then search for the hybrid dictionary tree according to the segmented pinyin sequence segments to obtain the forward maximum matching result and the backward maximum matching result. Then, determine a candidate text set that matches the pinyin sequence according to the forward maximum matching result and the backward maximum matching result. The candidate text set refers to a set composed of all candidate texts. The forward maximum matching result or the backward maximum matching result includes: at least one candidate text segment. Specifically, when the matching result only includes one candidate text segment, this candidate text segment is equivalent to a candidate text that matches the pinyin sequence of the text to be corrected. When the matching result includes multiple candidate text segments, the multiple candidate text segments can be spliced to obtain a candidate text.

[0065] Exemplarily, assume that the text to be corrected is "female's sports shoes", and the pinyin sequence of the text to be corrected is "nv shiyun dong xie". In the forward maximum matching algorithm:

[0066] 1) First, search for the hybrid dictionary tree according to "nv shi yun dong xie". If there is such a pinyin sequence as "nv shiyun dong xie" in the hybrid dictionary tree, the matching is successful, and the word corresponding to "nv shi yun dong xie" in the hybrid dictionary tree is used as the candidate text, that is, as the forward maximum matching result.

[0067] 2) If there is no such pinyin sequence as "nv shi yun dong xie" in the hybrid dictionary tree, then move forward one character length, that is, search for the hybrid dictionary tree according to the pinyin sequence segment "nv shi yun dong". If there is such a pinyin sequence segment as "nv shi yun dong" in the hybrid dictionary tree, the matching is successful, and the word corresponding to "nv shi yundong" in the hybrid dictionary tree is used as the candidate text segment. Then, search for the hybrid dictionary tree according to the pinyin sequence segment "xie". If there is such a pinyin sequence segment as "xie" in the hybrid dictionary tree, the matching is successful, and the word corresponding to "xie" in the hybrid dictionary tree is used as the candidate text segment. Furthermore, the forward maximum matching result includes: the candidate text segment corresponding to "nv shi yun dong" and the candidate text segment corresponding to "xie".

[0068] 3) If the pinyin sequence segment "nv shi yun dong" does not exist in the hybrid dictionary tree, then iteratively execute the step of "advancing one character length forward and searching the hybrid dictionary tree according to the new pinyin sequence segment" until the forward maximum matching result is obtained.

[0069] Exemplarily, assume that the text to be corrected is "female time sports shoes", and the pinyin sequence of the text to be corrected is "nv shiyun dong xie". In the reverse maximum matching algorithm:

[0070] 1) First, search the hybrid dictionary tree according to "nv shi yun dong xie". If the pinyin sequence "nv shiyun dong xie" exists in the hybrid dictionary tree, the matching is successful, and the word corresponding to the pinyin sequence "nv shi yun dong xie" in the hybrid dictionary tree is used as the candidate text, that is, as the reverse maximum matching result.

[0071] 2) If the pinyin sequence "nv shiyun dong xie" does not exist in the hybrid dictionary tree, then advance one character length backward, that is, search the hybrid dictionary tree according to the pinyin sequence segment "shi yun dong xie". If the pinyin sequence segment "shi yun dong xie" exists in the hybrid dictionary tree, the matching is successful, and the word corresponding to "shi yun dongxie" in the hybrid dictionary tree is used as the candidate text segment. Then, search the hybrid dictionary tree according to the pinyin sequence segment "nv". If the pinyin sequence "nv" exists in the hybrid dictionary tree, the matching is successful, and the word corresponding to "nv" in the hybrid dictionary tree is used as the candidate text segment. Furthermore, the reverse maximum matching result includes: the candidate text segment corresponding to "shi yun dong xie" and the candidate text segment corresponding to "nv".

[0072] 3) If the pinyin sequence segment "shi yun dong xie" does not exist in the hybrid dictionary tree, then iteratively execute the step of "advancing one character length backward and searching the hybrid dictionary tree according to the new pinyin sequence segment" until the reverse maximum matching result is obtained.

[0073] Exemplarily, assume that the text to be corrected is "female time sports shoes", and the pinyin sequence of the text to be corrected is "nv shiyun dong xie". If the segmentation result of the pinyin sequence by the forward maximum matching algorithm is "nv shi" and "yun dongxie"; and in the hybrid dictionary tree, the words corresponding to "nvshi" are "lady" and "female time", and the word corresponding to "yun dong xie" is "sports shoes", then the candidate text fragments are: "lady", "female time", and "sports shoes". Therefore, the candidate texts obtained based on the forward maximum matching are: "lady sports shoes" and "female time sports shoes". If the segmentation result of the pinyin sequence by the backward maximum matching algorithm is "xie" and "nv shi yun dong"; and in the hybrid dictionary tree, the word corresponding to "nv shi yun dong" is "lady sports", and the words corresponding to "xie" are "shoe" and "machine", then the candidate text fragments are "lady sports", "shoe", and "machine". Therefore, the candidate texts obtained based on the backward maximum matching are "lady sports shoes" and "lady sports machine". Furthermore, the candidate texts that match the pinyin sequence of the text to be corrected obtained according to the forward maximum matching result and the backward maximum matching result are: "lady sports shoes", "female time sports shoes", and "lady sports machine".

[0074] In the embodiments of the present invention, by respectively using the forward maximum matching algorithm and the backward maximum matching algorithm to segment and match the pinyin sequence of the text to be corrected, it is not only possible to speed up the text correction speed of the text to be corrected (especially long-tail words), ensuring the timeliness of text correction; but also possible to improve the accuracy and coverage of text correction.

[0075] Step S203: Calculate the evaluation factors of each candidate text in the candidate text set based on multiple error correction models respectively.

[0076] Among them, the multiple error correction models may include at least two of the following: noise channel error correction model, edit distance error correction model, pinyin distance error correction model.

[0077] For example, in an optional embodiment, the multiple error correction models are composed of a noise channel error correction model and an edit distance error correction model; the evaluation factor of the candidate text obtained based on the noise channel error correction model is: the noise channel probability of the candidate text; the evaluation factor of the candidate text obtained based on the edit distance error correction model is: the edit distance of the candidate text.

[0078] In another optional embodiment, the multiple error correction models are composed of a noise channel error correction model, an edit distance error correction model and a pinyin distance error correction model; the evaluation factor of the candidate text obtained based on the noise channel error correction model is the noise channel probability of the candidate text; the evaluation factor of the candidate text obtained based on the edit distance error correction model is the edit distance of the candidate text; the evaluation factor of the candidate text obtained based on the pinyin distance error correction model is the pinyin distance of the candidate text.

[0079] Step S204: A plurality of evaluation factors are integrated to obtain an evaluation value of the candidate text.

[0080] Step S205: determining the error correction result of the text to be corrected according to the evaluation value.

[0081] Exemplarily, the candidate text with the largest evaluation value may be used as the error correction result of the text to be corrected. Alternatively, one or more candidate texts with evaluation values ​​greater than a preset threshold may be used as the error correction result of the text to be corrected.

[0082] In the embodiment of the present invention, multiple evaluation factors are calculated in parallel by multiple error correction models, and multiple evaluation factors are merged to obtain the evaluation value of the candidate text, and the error correction result of the text to be corrected is determined according to the evaluation value, etc., which can not only improve the accuracy of query error correction, but also improve the processing speed of the text error correction method to ensure timeliness. In the embodiment of the present invention, through steps S201 to S205, the text correction of Chinese, English, and Pinyin mixture can be well processed, and the coverage and applicability of text error correction can be improved.

[0083] Figure 3 FIG. 1 is a schematic diagram of the main steps of a text error correction method according to another embodiment of the present invention. Figure 3 As shown, the text error correction method of the embodiment of the present invention includes:

[0084] Step S301: clean the source data to obtain the training sample words.

[0085] Exemplarily, the source data may include: user search log data, product title data, etc. In an optional embodiment, the user search log data may be cleaned as follows:

[0086] 1) Calculate the confidence of the search terms and filter out the search terms whose confidence is less than a preset threshold.

[0087] For example, the PV (number of searches), CTR (number of clicks), and GMV (total transaction amount) of the search term can be counted first, and then the confidence of the search term is calculated based on these three indicators. The calculation formula is as follows:

[0088] confidence=a*pv+b*ctr+c*gmv

[0089] Among them, confidence represents the confidence of the search term, a, b and c are preset constant coefficients, pv represents the number of searches, ctr represents the number of clicks, and gmv represents the total transaction amount.

[0090] Further, in this example, different preset thresholds can be set for search terms that do not include Chinese characters and search terms that include Chinese characters. For example, the preset threshold for search terms that do not include Chinese characters can be set to 500, and the preset threshold for search terms that include Chinese characters can be set to 10.

[0091] 2) Segment the search terms in the user search log data, and retain pure Chinese words whose length is less than or equal to the first length threshold (such as 5), and retain non-pure Chinese words whose length is between the second length threshold (such as 2) and the third length threshold (such as 10). Without affecting the implementation of the present invention, the first, second and third length thresholds can be flexibly set according to needs.

[0092] 3) Search words including pinyin can be filtered out based on the dictionary.

[0093] 4) Filter out search terms consisting of pure numbers and search terms containing special characters.

[0094] Through the above steps, it is possible to filter out wrong words and long-tail words input by users as much as possible, and reduce the noise in the training sample words.

[0095] Furthermore, in this optional embodiment, the product title data may be cleaned as follows: new words in the product title data are mined using a new word discovery algorithm based on left and right entropy; and the new word mining results are filtered by setting some rules (for example, removing product titles consisting of pure numbers, etc.).

[0096] Step S302: Obtain the pinyin sequence of the training sample words, and construct a hybrid dictionary tree according to the pinyin sequence of the training sample words.

[0097] Specifically, this step includes: obtaining the pinyin sequence of each word (i.e., training sample word) in the cleaned data, and then placing each character of the pinyin sequence into the child node under the root node from top to bottom. In addition, all training sample words corresponding to the same pinyin sequence are placed into the child node storing the last character of the pinyin sequence.

[0098] For example, assuming that the pinyin sequence of the training sample word is "hua wei", and all the training sample words corresponding to the pinyin sequence are "Huawei" and "Huawei", the root node can be set to empty, and "h", "u", "a", "w", "e", and "i" are placed in the child nodes of the root node from top to bottom. In addition, "Huawei" and "Huawei" are placed in the child node where "i" is stored. In the embodiment of the present invention, by constructing a hybrid dictionary tree, it is possible to well support query error correction for processing mixed Chinese, English, and pinyin.

[0099] Step S303: Obtain the pinyin sequence of the text to be corrected.

[0100] For how to implement this step, please refer to Figure 2 Relevant description about step S201 in the illustrated embodiment.

[0101] Step S304, searching the hybrid dictionary tree based on the forward maximum matching algorithm and the reverse maximum matching algorithm, and determining a candidate text set that matches the pinyin sequence of the text to be corrected according to the forward maximum matching result and the reverse maximum matching result.

[0102] The candidate text set is a set of all candidate texts. The forward maximum matching result or the reverse maximum matching result includes: at least one candidate text segment. Specifically, when the matching result includes only one candidate text segment, the candidate text segment is equivalent to a candidate text that matches the pinyin sequence of the text to be corrected. When the matching result includes multiple candidate text segments, the multiple candidate text segments can be spliced ​​to obtain the candidate text. For how to implement this step, please refer to Figure 2 Relevant description about step S202 in the illustrated embodiment.

[0103] Furthermore, in order to improve the accuracy and coverage of text correction, the text correction method of an embodiment of the present invention may also include the following steps: editing the pinyin sequence of the candidate text segment obtained by step S304; searching the hybrid dictionary tree according to the edited pinyin sequence to obtain a newly added candidate text segment that matches the edited pinyin sequence, and constructing a candidate text set that matches the pinyin sequence of the text to be corrected based on the candidate text segment and the newly added candidate text segment.

[0104] For example, the text to be corrected is "women's sports shoes", and the candidate text fragments obtained based on the forward maximum matching result are: "ladies", "women's", and "sports shoes". The candidate text fragments obtained based on the reverse maximum matching result are: "women's sports", "shoes", and "machinery". The newly added candidate text fragment obtained through the editing operation is: "Lü's", and the following candidate texts can be obtained: "women's sports shoes", "women's sports shoes", "Lü's sports shoes", and "women's sports machines".

[0105] Specifically, the editing operation on the pinyin sequence of the candidate text segment includes:

[0106] Step A: When the candidate text segment includes Chinese characters, perform an editing operation on the pinyin of the Chinese characters for homophonic editing.

[0107] Among them, the homophonic editing operation may include: editing operations for front and back nasal sounds, such as the conversion between an and ang, ian and iang, uan and uang, en and eng, uen and ueng, in and ing; editing operations for flat and rolled tongue sounds, such as the conversion between z and zh, c and ch, s and sh; conversion between northern and southern accents, such as the conversion between n and l, b and p, h and f, u and ü, i and u, i and ü. For example, if the candidate text segment is "吕氏" (Lü Shi), performing an editing operation on the pinyin "lv shi" of "吕氏" results in an edited pinyin sequence of "nvshi".

[0108] Step B: When the candidate text segment includes English words, perform editing operations of insertion, replacement, swapping, and / or deletion on the English words.

[0109] In the embodiments of the present invention, through steps A and B, the editing operation on the pinyin sequence of the candidate text segment can be achieved; by obtaining new candidate text segments that match the edited pinyin sequence and constructing candidate texts that match the pinyin sequence of the text to be corrected based on the candidate text segments and the new candidate text segments, the number of candidate texts can be increased, and the coverage rate of text error correction can be improved.

[0110] Step S305: Calculate the noise channel probability of the candidate text based on the noise channel error correction model, and use it as the first evaluation factor of the candidate text.

[0111] Specifically, the noise channel probability of the candidate text can be calculated according to the following formula:

[0112] P = P(q / c) * P(c);

[0113] Among them, P is the noise channel probability of the candidate text, q represents the text to be corrected, c represents the candidate text, P(q / c) represents the transition probability between the candidate text and the text to be corrected, and P(c) represents the prior probability of the candidate text.

[0114] Furthermore, P(q / c) and P(c) can be calculated according to the following formula:

[0115]

[0116]

[0117] Among them, freq(c) represents the occurrence frequency of the candidate text c in the training corpus, freq(q, c) represents the frequency of simultaneous occurrence of the word to be corrected and the candidate text in the training corpus, and |C| represents the total number of all words in the training corpus.

[0118] Step S306: Calculate the edit distance of the candidate text based on the edit distance correction model, and determine the second evaluation factor of the candidate text according to the edit distance.

[0119] Specifically, the edit distance of the candidate text refers to the minimum number of edit operations required to change the text to be corrected into the candidate text. Among them, the edit operations can be insertion, replacement, swapping, or deletion. For example, if the text to be corrected is "shouji" and the candidate text is "shouji", then the edit distance of the candidate text is 1. For example, if the text to be corrected is "iphoe" and the candidate text is "iphone", then the edit distance of the candidate text is 1.

[0120] Optionally, the second evaluation factor of the candidate text satisfies:

[0121]

[0122] where μ edit represents the second evaluation factor of the candidate text, d edit represents the edit distance of the candidate text, max{L1, L2} represents taking the maximum string length between the text to be corrected and the candidate text, L1 represents the string length of the text to be corrected, and L2 represents the string length of the candidate text.

[0123] Step S307: Calculate the pinyin distance of the candidate text based on the pinyin distance correction model, and determine the third evaluation factor of the candidate text according to the pinyin distance.

[0124] Specifically, the pinyin distance of the candidate text can be calculated through the following steps: Compare each character in the text to be corrected and the candidate text one by one to check whether the pinyin component letters are the same and whether the tones are the same; Determine the pinyin distance of each character according to the comparison result, and use the sum of the pinyin distances of each character as the pinyin distance of the candidate text. Among them, when the text to be corrected and the candidate text include non-Chinese parts (such as English words, numbers), it is considered that the pinyin component letters of the same characters in the same position in the non-Chinese parts are the same and the tones are also the same, and it is considered that the pinyin component letters of different characters in the same position in the non-Chinese parts are different and the tones are also different.

[0125] For example, the text to be corrected is "shouji" (a misspelling of "手机" meaning mobile phone), and the candidate text is "手机". The text to be corrected and the candidate text are compared character by character. The pinyin of the first character "受" and "手" both consists of the letters "shou", but their tones are different. Therefore, the pinyin distance of the first character is: 1 (same pinyin) + 0 (different tones) = 1. The pinyin of the second character "机" in both the text to be corrected and the candidate text is "ji", and their tones are the same. Therefore, the pinyin distance of the second character is: 1 (same pinyin) + 1 (same tone) = 2. Thus, the pinyin distance of the candidate text "手机" is 3.

[0126] For example, the text to be corrected is "ipd", and the candidate text is "ipad". The text to be corrected and the candidate text are compared character by character. The first character "i" in both the text to be corrected and the candidate text has the same pinyin letters and the same tone, so the pinyin distance of the first character is 2. The second character "p" in both the text to be corrected and the candidate text has the same pinyin and the same tone, so the pinyin distance of the second character is 2. The third character "d" in the text to be corrected and the third character "a" in the candidate text have different pinyin letters and different tones, so the pinyin distance of the third character is 0. The fourth character in the text to be corrected is empty, and the fourth character in the candidate text is "d". Their pinyin letters and tones are different, so the pinyin distance of the fourth character is 0. Thus, the pinyin distance of the candidate text "ipad" is 4.

[0127] Optionally, the third evaluation factor of the candidate text satisfies:

[0128]

[0129] where ν pinyin represents the third evaluation factor of the candidate text, d pinyin represents the pinyin distance of the candidate text, max{L1, L2} represents the maximum string length between the text to be corrected and the candidate text, L1 represents the string length of the text to be corrected, and L2 represents the string length of the candidate text.

[0130] Step S308: Integrate the first, second, and third evaluation factors to obtain the evaluation value of the candidate text.

[0131] Optionally, the first, second, and third evaluation factors can be integrated according to the following formula:

[0132] Score = a1 * P + b1 * μ edit + c1 * ν pinyin ;

[0133] where Score represents the evaluation value of the candidate text, a1, b1, and c1 are preset constant coefficients, P is the first evaluation factor, μ edit is the second evaluation factor, νpinyin is the third evaluation factor.

[0134] Step S309: Use the candidate text with the maximum evaluation value as the error correction result of the text to be error corrected.

[0135] In the embodiments of the present invention, by calculating the first, second, and third evaluation factors using a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model respectively, and fusing the first, second, and third evaluation factors to obtain the evaluation value of the candidate text and other steps, the accuracy of text error correction can be further improved.

[0136] Next, in conjunction with Figure 4 a schematic description of the structure of the hybrid dictionary tree in the embodiments of the present invention is given. As Figure 4 shown, the hybrid dictionary tree in the embodiments of the present invention includes the corresponding relationships between pinyin and Chinese words and English words. Specifically, the hybrid dictionary tree in the embodiments of the present invention includes multiple paths, and each path includes a root node and child nodes under the root node. Among them, the root node is empty, and each child node under the root node stores a character. And, in some child nodes, Chinese words or English words corresponding to specific pinyin (the pinyin composed of the characters from the root node to this child node) are stored.

[0137] For example, Figure 4 one path in includes, from top to bottom: a root node, a child node storing "h", a child node storing "u", a child node storing "a", a child node storing "w", a child node storing "e", a child node storing "i". And, in the child node storing "u", words such as "胡" and "虎" corresponding to the pinyin sequence "hu" are also stored; in the child node storing "a", words such as "华" and "花" corresponding to the pinyin sequence "hua" are also stored; in the child node storing "i", words such as "华为" and "划为" corresponding to the pinyin sequence "huawei" are also stored.

[0138] In addition, the present invention also provides a search method. The search method in the embodiments of the present invention includes:

[0139] Step 1: Receive the input text.

[0140] Step 2: When it is determined that the input text is the text to be error corrected, obtain the pinyin sequence of the input text.

[0141] In this step, all the input text can be used as the text to be error corrected, or only part of the input text can be used as the text to be error corrected. For example, a list of common error texts can be preset, and when the input text entered by the user exists in the list of common error texts, the input text is determined as the text to be error corrected.

[0142] Step 3: Search the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the input text. The hybrid dictionary tree includes the correspondence between pinyin and Chinese characters and English.

[0143] Step 4: Determine the error correction result of the input text according to the error correction model and the candidate text set.

[0144] Step 5: Obtain search results based on the error correction results of the input text, and send the search results.

[0145] During specific implementation, the search results may be sent to a user terminal, and the search results may be displayed via the user terminal.

[0146] In an embodiment of the present invention, the above steps can well support the error correction of Chinese search terms, English search terms, Pinyin search terms, and any mixture of Chinese, English and Pinyin, thereby improving the coverage and applicability of error correction for search terms, and further being able to better understand the user's search intent and improve the user experience.

[0147] In addition, the present invention also provides a search and error correction method. The search and error correction method of an embodiment of the present invention includes:

[0148] Step 1: Receive input text.

[0149] Step 2: When it is determined that the input text is a text to be corrected, obtain the pinyin sequence of the input text.

[0150] In this step, all input texts may be used as texts to be corrected, or only part of the input texts may be used as texts to be corrected. For example, a common error text list may be preset, and when the input text input by the user exists in the common error text list, the input text is determined as text to be corrected.

[0151] Step 3: Search the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the input text. The hybrid dictionary tree includes the correspondence between pinyin and Chinese characters and English.

[0152] Step 4: Determine the error correction result of the input text according to the error correction model and the candidate text set.

[0153] Step 5: sort the error correction results of the input text, and send the sorted error correction results.

[0154] In specific implementation, when there are multiple error correction results, the error correction results can be sorted according to the evaluation values obtained in the text error correction method, and the sorted error correction results are sent to the user terminal. After receiving the sorted error correction results, the user terminal can display the sorted error correction results to the user in the form of a prompt message.

[0155] In the embodiments of the present invention, through the above steps, it is possible to well support the error correction of Chinese search terms, English search terms, pinyin search terms, and any mixed search terms of Chinese, English, and pinyin, improve the coverage rate and applicability of error correction for search terms, and thus be able to better understand the user's search intention and improve the user experience.

[0156] Figure 5 It is a schematic diagram of the main modules of a text error correction device according to an embodiment of the present invention. As Figure 5 shown, the text error correction device 500 according to the embodiment of the present invention includes: an acquisition module 501, a search module 502, and a determination module 503.

[0157] The acquisition module 501 is configured to acquire the pinyin sequence of the text to be error corrected.

[0158] Specifically, the acquisition module 501 acquiring the pinyin sequence of the text to be error corrected includes: if the text to be error corrected consists of Chinese characters, the acquisition module 501 uses the pinyin of the Chinese characters as the pinyin sequence of the text to be error corrected; if the text to be error corrected consists of non-Chinese characters, the acquisition module 501 uses the non-Chinese characters themselves as the pinyin sequence of the text to be error corrected; if the text to be error corrected consists of Chinese characters and non-Chinese characters, the acquisition module 501 uses the whole formed by the pinyin of the Chinese characters and the non-Chinese characters themselves as the pinyin sequence of the text to be error corrected; wherein, the non-Chinese characters include: numbers, English words, and / or pinyin.

[0159] The search module 502 is configured to search the mixed dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be error corrected.

[0160] Wherein, the mixed dictionary tree includes the corresponding relationship between pinyin and Chinese words and English words. In the mixed dictionary tree, each node stores a character. And, in the node storing the tail character of the pinyin sequence, all the words corresponding to the pinyin sequence are also stored. Wherein, the corresponding words can be Chinese words or English words.

[0161] Exemplarily, assuming the text to be error corrected is "hua wei shou ji", and the pinyin sequence of the text to be error corrected is "hua weishou ji", the candidate text set obtained by the search module 502 includes the following candidate texts: "hua wei shou ji", "hua wei shou ji", "hua wei shou ji", and "hua wei shou ji".

[0162] The determination module 503 is used to determine the error correction result of the text to be corrected according to the error correction model and the candidate text set.

[0163] In an embodiment of the present invention, a hybrid dictionary tree is pre-constructed, and the pinyin sequence of the text to be corrected is obtained through an acquisition module; the hybrid dictionary tree is searched through a search module to obtain a candidate text set that matches the pinyin sequence of the text to be corrected; and the correction result of the text to be corrected is determined by a determination module according to the correction model and the candidate text set. This can well handle text correction of a mixture of Chinese, English, and pinyin, and improve the coverage and applicability of text correction.

[0164] Figure 6 FIG. 1 is a schematic diagram of the main modules of a text error correction device according to another embodiment of the present invention. Figure 6 As shown, the text error correction device 600 of the embodiment of the present invention includes: a cleaning module 601, a construction module 602, an acquisition module 603, a search module 604 and a determination module 605.

[0165] The cleaning module 601 is used to clean the source data to obtain the training sample words.

[0166] For example, the source data may include: user search log data, product title data, etc. For details on how the cleaning module 601 cleans the source data, please refer to Figure 3 The relevant content about data cleaning in the illustrated embodiment.

[0167] The construction module 602 is used to obtain the pinyin sequence of the training sample words and construct a hybrid dictionary tree according to the pinyin sequence of the training sample words, which can specifically include: the construction module 602 obtains the pinyin sequence of each word (i.e., the training sample word) in the cleaned data, and then puts each character of the pinyin sequence into the child node under the root node from top to bottom. In addition, the construction module 602 puts all the training sample words corresponding to the same pinyin sequence into the child node storing the last character of the pinyin sequence.

[0168] For example, assuming that the pinyin sequence of the training sample word is "hua wei", and all the training sample words corresponding to the pinyin sequence are "Huawei" and "Huawei", the root node can be set to empty, and "h", "u", "a", "w", "e", and "i" are placed in the child nodes of the root node from top to bottom. In addition, "Huawei" and "Huawei" are placed in the child node where "i" is stored. In the embodiment of the present invention, the hybrid dictionary tree is constructed by the construction module 602, which can well support the query error correction of mixed Chinese, English, and pinyin.

[0169] The acquisition module 603 is used to acquire the pinyin sequence of the text to be corrected.

[0170] For details on how the acquisition module 603 specifically acquires the pinyin sequence of the text to be corrected, please refer to Figure 5 Relevant description about the acquisition module 501 in the illustrated embodiment.

[0171] The search module 604 is used to search the hybrid dictionary tree based on the forward maximum matching algorithm and the reverse maximum matching algorithm, and determine the candidate text set that matches the pinyin sequence of the text to be corrected according to the forward maximum matching result and the reverse maximum matching result.

[0172] Specifically, in the forward maximum matching algorithm and the reverse maximum matching algorithm: the search module 604 first segments the pinyin sequence of the text to be corrected, and then searches the mixed dictionary tree according to the segmented pinyin sequence fragments to obtain the forward maximum matching result and the reverse maximum matching result. Then, the search module 604 determines the candidate text that matches the pinyin sequence according to the forward maximum matching result and the reverse maximum matching result. Among them, the forward maximum matching result or the reverse maximum matching result includes: at least one candidate text fragment. When the matching result includes a candidate text fragment, the candidate text fragment is a candidate text that matches the pinyin sequence of the text to be corrected. When the matching result includes multiple candidate text fragments, the multiple candidate text fragments can be spliced ​​to obtain the candidate text.

[0173] For example, the text to be corrected is "women's sports shoes", the candidate text segments obtained based on the forward maximum matching result are "ladies", "women's" and "sports shoes", and the candidate text segments obtained based on the reverse maximum matching result are "women's sports", "shoes" and "machinery", then the following candidate texts can be spliced ​​together: "women's sports shoes", "women's sports shoes" and "women's sports machinery".

[0174] In the embodiment of the present invention, the search module 604 segments and matches the pinyin sequence of the text to be corrected by using the forward maximum matching algorithm and the reverse maximum matching algorithm respectively, which can not only speed up the correction of the text to be corrected (especially long-tail words) and ensure the timeliness of text correction; but also improve the accuracy and coverage of text correction.

[0175] Furthermore, in order to improve the accuracy and coverage of text error correction, the text error correction device 600 may also include: an editing module. The editing module is used to edit the pinyin sequence of the candidate text segment. And, in this optional embodiment, the search module 604 is also used to search the hybrid dictionary tree according to the edited pinyin sequence to obtain the newly added candidate text segment that matches the edited pinyin sequence; and the search module 604 is used to construct a candidate text set that matches the pinyin sequence of the text to be corrected according to the candidate text segment and the newly added candidate text segment.

[0176] For example, the text to be corrected is "women's sports shoes", the candidate text segments obtained based on the forward maximum matching result are "ladies", "ladies" and "sports shoes", the candidate text segments obtained based on the reverse maximum matching result are "ladies' sports", "shoes" and "equipment", and the newly added candidate text segment obtained by the editing operation is "Lü's", then the obtained candidate text set includes the following candidate texts: "ladies' sports shoes", "ladies' sports shoes", "Lü's sports shoes" and "ladies' sports equipment".

[0177] Specifically, the editing module's editing operation on the pinyin sequence of the candidate text segment may include: when the candidate text segment includes Chinese characters, the editing module performs an fuzzy sound editing operation on the pinyin of the Chinese characters; when the candidate text segment includes English words, the editing module performs an editing operation of inserting, replacing, exchanging and / or deleting the English words.

[0178] In the embodiment of the present invention, the number of candidate texts can be increased and the coverage of text error correction can be improved by setting an editing module.

[0179] The determination module 605 is used to calculate the evaluation value of the candidate text and determine the error correction result of the text to be corrected according to the evaluation value. It can specifically include: the determination module 605 calculates the evaluation factors of the candidate text based on multiple error correction models; the determination module 605 fuses the multiple evaluation factors to obtain the evaluation value of the candidate text; the determination module 605 determines the error correction result of the text to be corrected according to the evaluation value.

[0180] Among them, the multiple error correction models may include at least two of the following: a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model.

[0181] In an optional example, the multiple error correction models include a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model. In this example, the determination module 605 calculates the evaluation factors of the candidate texts based on the multiple error correction models respectively, including: operation one, operation two, and operation three.

[0182] Operation 1: The determination module 605 calculates the noise channel probability of the candidate text based on the noise channel error correction model, and uses it as the first evaluation factor of the candidate text.

[0183] Specifically, the determination module 605 may calculate the noise channel probability of the candidate text according to the following formula:

[0184] P = P (q / c) * P (c);

[0185] Among them, P is the noise channel probability of the candidate text, q represents the text to be error-corrected, c represents the candidate text, P(q / c) represents the transition probability between the candidate text and the text to be error-corrected, and P(c) represents the prior probability of the candidate text.

[0186] Furthermore, P(q / c) and P(c) can be calculated according to the following formula:

[0187]

[0188]

[0189] Among them, freq(c) represents the occurrence frequency of the candidate text c in the training corpus, freq(q,c) represents the frequency of simultaneous occurrence of the word to be error-corrected and the candidate text in the training corpus, and |C| represents the total number of all words in the training corpus.

[0190] Operation 2: The determination module 605 calculates the edit distance of the candidate text based on the edit distance error correction model, and determines the second evaluation factor of the candidate text according to the edit distance.

[0191] The edit distance of the candidate text refers to the minimum number of edit operations required to change the text to be error-corrected into the candidate text. Among them, the edit operation can be insertion, replacement, swapping, or deletion. For example, if the text to be error-corrected is "shouji" and the candidate text is "shouji", then the edit distance of the candidate text is 1. For example, if the text to be error-corrected is "iphoe" and the candidate text is "iphone", then the edit distance of the candidate text is 1.

[0192] Optionally, the determination module 605 can calculate the second evaluation factor of the candidate text according to the following formula:

[0193]

[0194] Among them, μ edit represents the second evaluation factor of the candidate text, d edit represents the edit distance of the candidate text, max{L1,L2} represents taking the maximum string length between the text to be error-corrected and the candidate text, L1 represents the string length of the text to be error-corrected, and L2 represents the string length of the candidate text.

[0195] Operation 3: The determination module 605 calculates the pinyin distance of the candidate text based on the pinyin distance error correction model, and determines the third evaluation factor of the candidate text according to the pinyin distance.

[0196] Specifically, the operation of the determination module 605 to calculate the pinyin distance of the candidate text based on the pinyin distance correction model may include: for the characters in the text to be corrected and the candidate text, the determination module 605 compares one by one whether the pinyin component letters are the same and whether the tones are the same; the determination module 605 determines the pinyin distance of each character according to the comparison result, and takes the sum of the pinyin distances of each character as the pinyin distance of the candidate text.

[0197] Wherein, when the text to be corrected and the candidate text include non-Chinese characters (such as English words, numbers), it is considered that the pinyin component letters of the same characters at the same position in the non-Chinese characters are the same and the tones are also the same, and it is considered that the pinyin component letters of different characters at the same position in the non-Chinese characters are different and the tones are also different.

[0198] For example, if the text to be corrected is "shou ji" and the candidate text is "shou ji", the pinyin distance of the first character is: 1 (same pinyin) + 0 (different tones) = 1; the pinyin distance of the second character is: 1 (same pinyin) + 1 (same tone) = 2. Therefore, the pinyin distance of the candidate text "shou ji" is 3.

[0199] For example, if the text to be corrected is "ipd" and the candidate text is "ipad", the pinyin component letters of the first character "i" in the text to be corrected and the candidate text are the same and the tones are also the same, so the pinyin distance of the first character is 2. The pinyin of the second character "p" in the text to be corrected and the candidate text is the same and the tones are also the same, so the pinyin distance of the second character is 2. The pinyin component letters of the third character "d" in the text to be corrected are different from those of the third character "a" in the candidate text and the tones are different, so the pinyin distance of the third character is 0. The fourth character in the text to be corrected is empty, and the fourth character in the candidate text is "d", and their pinyin component letters and tones are different, so the pinyin distance of the fourth character is 0. Therefore, the pinyin distance of the candidate text "ipad" is 4.

[0200] Optionally, the determination module 605 may calculate the third evaluation factor of the candidate text according to the following formula:

[0201]

[0202] Wherein, ν pinyin represents the third evaluation factor of the candidate text, d pinyin represents the pinyin distance of the candidate text, max{L1, L2} represents taking the maximum string length between the text to be corrected and the candidate text, L1 represents the string length of the text to be corrected, and L2 represents the string length of the candidate text.

[0203] Further, in this example, after obtaining the first, second, and third evaluation factors, the determination module 605 may fuse the first, second, and third evaluation factors to obtain the evaluation value of the candidate text. After obtaining the evaluation value, the determination module 605 may use the candidate text with the largest evaluation value as the error correction result of the text to be corrected. Alternatively, the determination module 605 may also use one or more candidate texts with evaluation values ​​greater than a preset threshold as the error correction result of the text to be corrected.

[0204] Optionally, the determination module 605 may fuse the first, second, and third evaluation factors according to the following formula:

[0205] Score=a1*P+b1*μ edit +c1*ν pinyin ;

[0206] Among them, Score represents the evaluation value of the candidate text, a1, b1, c1 are preset constant coefficients, P is the first evaluation factor, μ edit is the second evaluation factor, ν pinyin It is the third evaluation factor.

[0207] In the embodiment of the present invention, the determination module 605 can further improve the accuracy of text error correction by respectively calculating the first, second, and third evaluation factors based on the noise channel error correction model, the edit distance error correction model, and the pinyin distance error correction model, and fusing the first, second, and third evaluation factors to obtain the evaluation value of the candidate text. The device of the embodiment of the present invention can well handle the text error correction of Chinese, English, and pinyin mixtures, and improve the coverage and applicability of text error correction.

[0208] Figure 7 An exemplary system architecture 700 is shown to which the text error correction method or text error correction device according to the embodiment of the present invention can be applied.

[0209] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0210] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0211] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0212] Server 705 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using terminal devices 701, 702, and 703. The backend management server may perform query error correction and other processing on received search terms and other data, and feed back the error correction results to the terminal device.

[0213] It should be noted that the text error correction method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the text error correction device is generally arranged in the server 705 .

[0214] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0215] Furthermore, the present invention also provides an electronic device, comprising: one or more processors; and a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the text error correction method of the present invention.

[0216] Figure 8 A schematic diagram of the structure of a computer system 800 suitable for implementing the electronic device of the present invention is shown. Figure 8 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0217] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0218] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0219] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) Y01, the above-mentioned functions defined in the system of the present invention are executed.

[0220] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0221] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart and the combination of boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0222] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be arranged in a processor, for example, may be described as: a processor includes an acquisition module, a search module, and a determination module. The names of these modules do not constitute a limitation on the modules themselves under certain circumstances, for example, the acquisition module may also be described as a "module for acquiring a phonetic sequence of a text to be corrected".

[0223] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the following process: obtaining the pinyin sequence of the text to be corrected; searching the hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected; the hybrid dictionary tree includes the correspondence between pinyin and Chinese words and English words; determining the correction result of the text to be corrected according to the correction model and the candidate text set.

[0224] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A text error correction method, characterized in that: The method comprises: Obtain the pinyin sequence of the text to be corrected; Searching a hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected; the hybrid dictionary tree includes a correspondence between pinyin and Chinese words and English words, and the hybrid dictionary tree is constructed based on the pinyin sequence of training sample words, and the step of obtaining the training sample words includes: obtaining user search log data and product title data as source data, and filtering the search words according to the confidence and / or length of the search words in the search log; mining new words in the product title data using a new word discovery algorithm based on left and right entropy; and filtering the new word mining results; and obtaining the training sample words according to the filtering results; Determine the error correction result of the text to be corrected according to the error correction model and the candidate text set; specifically include: searching the hybrid dictionary tree based on the forward maximum matching algorithm and the reverse maximum matching algorithm, and taking all the words corresponding to the forward maximum matching result and the reverse maximum matching result as candidate texts; respectively calculating the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; fusing multiple evaluation factors to obtain the evaluation value of the candidate text; determining the error correction result of the text to be corrected according to the evaluation value; the error correction model includes: a pinyin distance correction model; for the characters in the text to be corrected and the candidate text, compare one by one whether their pinyin components are the same and whether their tones are the same; determine the pinyin distance of each character according to the comparison result, and take the sum of the pinyin distances of each character as the evaluation factor of the candidate text calculated by the pinyin distance correction model.

2. The method according to claim 1, characterized in that The step of obtaining the pinyin sequence of the text to be corrected comprises: If the text to be corrected is composed of Chinese characters, the pinyin of the Chinese characters is used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of non-Chinese characters, the non-Chinese characters themselves are used as the pinyin sequence of the text to be corrected; if the text to be corrected is composed of Chinese characters and non-Chinese characters, the whole composed of the pinyin of the Chinese characters and the non-Chinese characters themselves is used as the pinyin sequence of the text to be corrected; wherein the non-Chinese characters include: numbers, English words and / or pinyin.

3. The method according to claim 2, characterized in that The multiple error correction models include at least two of the following: a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model.

4. The method according to claim 3, characterized in that In the case where the multiple error correction models include a noise channel error correction model, an edit distance error correction model, and a pinyin distance error correction model, the step of respectively calculating the evaluation factor of each candidate text in the candidate text set based on the multiple error correction models includes: The noise channel probability of the candidate text is calculated based on the noise channel error correction model and used as the first evaluation factor of the candidate text; the edit distance of the candidate text is calculated based on the edit distance error correction model, and the second evaluation factor of the candidate text is determined according to the edit distance.

5. The method according to claim 2, characterized in that: The forward maximum matching result and the reverse maximum matching result include: at least one candidate text segment; The method also includes: editing the pinyin sequence of the candidate text segment; searching the hybrid dictionary tree according to the edited pinyin sequence to obtain a newly added candidate text segment that matches the edited pinyin sequence, and constructing a candidate text set that matches the pinyin sequence of the text to be corrected according to the candidate text segment and the newly added candidate text segment.

6. The method according to claim 5, characterized in that The step of editing the pinyin sequence of the candidate text segment comprises: When the candidate text segment includes Chinese characters, the pinyin of the Chinese characters is edited to be fuzzy; when the candidate text segment includes English words, the English words are edited to be inserted, replaced, exchanged and / or deleted.

7. A search method, characterized in that: The method comprises: Receive input text; In the case where it is determined that the input text is a text to be corrected, obtaining a pinyin sequence of the input text; Searching a hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the input text; the hybrid dictionary tree includes a correspondence between pinyin and Chinese words and English words, and the hybrid dictionary tree is constructed based on the pinyin sequence of training sample words, and the step of obtaining the training sample words includes: obtaining user search log data and product title data as source data, and filtering the search words according to the confidence and / or length of the search words in the search log; mining new words in the product title data using a new word discovery algorithm based on left and right entropy; and filtering the new word mining results; and obtaining the training sample words according to the filtering results; Determine the error correction result of the input text according to the error correction model and the candidate text set; specifically include: searching the hybrid dictionary tree based on the forward maximum matching algorithm and the reverse maximum matching algorithm, and taking all the words corresponding to the forward maximum matching result and the reverse maximum matching result as candidate texts; respectively calculating the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; fusing multiple evaluation factors to obtain the evaluation value of the candidate text; determining the error correction result of the text to be corrected according to the evaluation value; the error correction model includes: a pinyin distance error correction model; for the characters in the text to be corrected and the candidate text, compare one by one whether their pinyin components are the same and whether their tones are the same; determine the pinyin distance of each character according to the comparison result, and take the sum of the pinyin distances of each character as the evaluation factor of the candidate text calculated by the pinyin distance error correction model; A search result is obtained according to the error correction result of the input text, and the search result is sent.

8. A search and error correction method, characterized in that: The method comprises: Receive input text; In the case where it is determined that the input text is a text to be corrected, obtaining a pinyin sequence of the input text; Searching a hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the input text; the hybrid dictionary tree includes a correspondence between pinyin and Chinese words and English words, and the hybrid dictionary tree is constructed based on the pinyin sequence of training sample words, and the step of obtaining the training sample words includes: obtaining user search log data and product title data as source data, and filtering the search words according to the confidence and / or length of the search words in the search log; mining new words in the product title data using a new word discovery algorithm based on left and right entropy; and filtering the new word mining results; and obtaining the training sample words according to the filtering results; Determine the error correction result of the input text according to the error correction model and the candidate text set; specifically include: searching the hybrid dictionary tree based on the forward maximum matching algorithm and the reverse maximum matching algorithm, and taking all the words corresponding to the forward maximum matching result and the reverse maximum matching result as candidate texts; respectively calculating the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; fusing multiple evaluation factors to obtain the evaluation value of the candidate text; determining the error correction result of the text to be corrected according to the evaluation value; the error correction model includes: a pinyin distance error correction model; for the characters in the text to be corrected and the candidate text, compare one by one whether their pinyin components are the same and whether their tones are the same; determine the pinyin distance of each character according to the comparison result, and take the sum of the pinyin distances of each character as the evaluation factor of the candidate text calculated by the pinyin distance error correction model; The error correction results of the input text are sorted, and the sorted error correction results are sent.

9. A text error correction device, characterized in that: The device comprises: An acquisition module is used to acquire the pinyin sequence of the text to be corrected; A search module is used to search a hybrid dictionary tree to obtain a candidate text set that matches the pinyin sequence of the text to be corrected; the hybrid dictionary tree includes a correspondence between pinyin and Chinese words and English words, and the hybrid dictionary tree is constructed based on the pinyin sequence of training sample words, and the step of obtaining the training sample words includes: obtaining user search log data and product title data as source data, and filtering the search words according to the confidence and / or length of the search words in the search log; mining new words in the product title data using a new word discovery algorithm based on left and right entropy; and filtering the new word mining results; and obtaining the training sample words according to the filtering results; A determination module is used to determine the error correction result of the text to be corrected according to the error correction model and the candidate text set; specifically used to: search for a hybrid dictionary tree based on a forward maximum matching algorithm and a reverse maximum matching algorithm, and use all words corresponding to the forward maximum matching result and the reverse maximum matching result as candidate texts; calculate the evaluation factor of each candidate text in the candidate text set based on multiple error correction models; merge multiple evaluation factors to obtain the evaluation value of the candidate text; determine the error correction result of the text to be corrected according to the evaluation value; the error correction model includes: a pinyin distance error correction model; for the characters in the text to be corrected and the candidate text, compare one by one whether their pinyin components are the same and whether their tones are the same; determine the pinyin distance of each character according to the comparison result, and use the sum of the pinyin distances of each character as the evaluation factor of the candidate text calculated by the pinyin distance error correction model.

10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.