Pinyin decoding method and related device

By fusing semantic and statistical features into a neural network model, the problem of insufficient model decoding stability and flexibility in pinyin decoding methods is solved, achieving efficient and accurate pinyin decoding and improving user experience.

CN122389809APending Publication Date: 2026-07-14IFLYTEK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
IFLYTEK CO LTD
Filing Date
2026-06-16
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Among existing pinyin decoding methods, the N-gram model based on probability statistics has good stability but is difficult to handle complex situations, while the neural network-based model has high flexibility but insufficient decoding stability. When used in combination, the accuracy of the decoding result is difficult to guarantee, and the dual-model decoding has a large amount of computation and long response time.

Method used

Semantic features are extracted by a neural network model, and information from a statistical language model is mapped to the same feature space and fused with it to form a fused semantic feature for decoding, thereby reducing computation and storage requirements.

Benefits of technology

It improves decoding accuracy, reduces latency and stuttering, enables flexible handling of complex scenarios and stable decoding of commonly used words, and enhances the user input experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122389809A_ABST
    Figure CN122389809A_ABST
Patent Text Reader

Abstract

The application discloses a pinyin decoding method and related equipment, and relates to the technical field of natural language processing. The application first acquires a first text sequence containing a historical input text sequence and a current to-be-decoded pinyin string, and extracts semantic features corresponding to the text sequence by using a neural network model; then, corresponding statistical information is acquired by relying on a statistical language model. The statistical language model can store various types of text static statistical information, including candidate word entries and corresponding probability information, and the statistical information is mapped to a feature space consistent with the semantic features to obtain statistical features. The semantic features and the statistical features are fused to obtain fused semantic features, and a decoding result corresponding to the pinyin string is generated according to the fused semantic features. The application combines the semantic understanding ability of the neural network and the prior statistical advantage of the statistical language model, and takes into account the decoding accuracy and the use stability, is efficient in reasoning, and is suitable for various input method use scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and more specifically, to a pinyin decoding method and related equipment. Background Technology

[0002] Pinyin input refers to the process of inputting a text string by combining pinyin (full pinyin, full abbreviation, final abbreviation, and random abbreviation) using a keyboard, and finally obtaining the desired text. This technology is generally called P2C (Pinyin-to-Character) process. (See reference) Figure 1 It demonstrates four different input formats: full spelling, full abbreviation, last abbreviation, and random abbreviation. The decoding result may differ for the same text under different input methods.

[0003] Traditional Pinyin decoding schemes mainly fall into two categories: one uses a probability-based statistical model, N-gram, to represent and store each possible combination of preceding and following text and its probability. This method offers good stability but struggles to handle complex cases. The other method is based on neural networks (NNs). This approach is flexible and can handle semantically related decoding tasks, but its decoding stability is insufficient, often resulting in unexpected decoding errors for common words.

[0004] Some studies have attempted to combine the two decoding schemes mentioned above, running the statistical N-gram model and the neural network model in parallel, and then replacing or displaying the decoding results of the two models according to certain rules, allowing users to choose. However, the distributions trained by the two models are inherently different, making it difficult to directly fuse the resulting posterior probabilities. Forcing a fusion may actually reduce the accuracy of the decoding results. Summary of the Invention

[0005] In view of the above problems, this application is proposed to provide a Pinyin decoding method and related equipment to improve the flexibility and stability of decoding, thereby improving decoding accuracy. The specific solution is as follows:

[0006] Firstly, a pinyin decoding method is provided, including:

[0007] Get the first text sequence containing the historical input text sequence and the current pinyin string to be decoded;

[0008] The semantic features of the first text sequence are extracted using a neural network model;

[0009] Based on the first text sequence, statistical information is obtained from the statistical language model, and the statistical information is mapped to the same feature space as the semantic features to obtain statistical features;

[0010] The semantic features and statistical features are fused to obtain fused semantic features, and the decoding result corresponding to the current pinyin string to be decoded is generated based on the fused semantic features.

[0011] In one possible design, in another implementation of the first aspect of the embodiments of this application, the statistical language model is an N-gram model, and the statistical information includes at least one candidate term and probability information corresponding to each candidate term.

[0012] In one possible design, in another implementation of the first aspect of the embodiments of this application, the process of mapping the statistical information to the same feature space as the semantic features to obtain the statistical features includes:

[0013] The candidate terms are mapped to the same feature space as the semantic features, and the mapped features are weighted and fused using the probability information corresponding to the candidate terms to obtain statistical features.

[0014] In one possible design, in another implementation of the first aspect of the embodiments of this application, the process of mapping the statistical information to the same feature space as the semantic features to obtain the statistical features includes:

[0015] Each candidate word is combined with its corresponding probability information and mapped to the same feature space as the semantic features. The mapped features are then fused to obtain statistical features.

[0016] In one possible design, in another implementation of the first aspect of the embodiments of this application, the process of obtaining statistical information from the statistical language model based on the first text sequence includes:

[0017] The first text sequence is converted into embedded features through an embedding layer;

[0018] Based on the embedding feature, statistical information corresponding to the embedding feature is queried from the statistical language model; wherein, the statistical language model stores at least one candidate term and its probability information using the embedding feature as an index.

[0019] In one possible design, in another implementation of the first aspect of the embodiments of this application, the process of mapping the statistical information to the same feature space as the semantic features includes:

[0020] The statistical information is mapped to the same feature space as the semantic features using a trainable mapping matrix, and the mapping matrix and the neural network model are jointly trained and optimized during the training phase.

[0021] In one possible design, in another implementation of the first aspect of the embodiments of this application, the process of fusing the semantic features and the statistical features to obtain the fused semantic features includes:

[0022] The semantic features and the statistical features are residually fused to obtain the fused semantic features.

[0023] In one possible design, in another implementation of the first aspect of the embodiments of this application, the neural network model includes:

[0024] The system comprises a pre-network, a statistical language model embedding module, and a post-network, wherein the pre-network includes an embedding layer and a semantic extraction module;

[0025] The embedding layer is used to convert the first text sequence into embedded features;

[0026] The semantic extraction module is used to extract semantic features of the first text sequence based on the embedded features;

[0027] The statistical language model embedding module is used to query statistical information corresponding to the embedding feature from the statistical language model, map the statistical information to the same feature space as the semantic feature, and obtain the statistical feature. The statistical language model stores at least one candidate word and its probability information with the embedding feature as the index.

[0028] The post-network is used to perform decoding processing with the fused semantic features obtained by fusing the semantic features and the statistical features as input, and to generate the decoding result corresponding to the current pinyin string to be decoded.

[0029] In a second aspect, an electronic device is provided, comprising: a memory and a processor;

[0030] The memory is used to store programs;

[0031] The processor is configured to execute the program to implement the various steps of the pinyin decoding method described in any of the first aspects of this application.

[0032] Thirdly, a readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the various steps of the pinyin decoding method described in any of the preceding first aspects of this application.

[0033] Fourthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the various steps of the pinyin decoding method described in any of the first aspects of this application.

[0034] By employing the aforementioned technical solution, this application extracts semantic features from the first text sequence using a neural network model. This fully leverages the semantic understanding capabilities of the neural network model, flexibly handling scenarios such as complex contexts, polyphonic characters, and input error correction. Simultaneously, statistical information is obtained from a statistical language model based on the first text sequence, and this statistical information is mapped to the same feature space as the semantic features before being fused with the semantic features. On one hand, through the mapping operation, the originally inconsistent statistical information and semantic features can be fused at the feature level within a unified vector space, avoiding the mismatch problem caused by directly fusing the decoding results of two models at the text level in existing technologies. On the other hand, the fused features contain both a deep semantic understanding of the current context and statistical prior knowledge based on large-scale corpora, thus simultaneously ensuring the decoding stability of common words and fixed collocations and the flexibility for complex semantic scenarios. This overcomes the shortcomings of uncontrollable results from pure neural network models and the difficulty of handling complex semantics by pure statistical models.

[0035] The fused semantic features obtained by this application, which integrate semantic and statistical features, not only include a deep semantic understanding of the current context but also incorporate historical statistical patterns, enabling more accurate prediction of user input intent. Especially in complex scenarios such as handling long sentences, ambiguous words, personalized input, and pinyin correction, this application demonstrates better decoding performance, thereby improving overall decoding accuracy.

[0036] Furthermore, this application integrates the acquisition and mapping of statistical information within the same neural network model, eliminating the need to run two separate decoding models and then fuse the results. The entire decoding process requires only one neural network inference, significantly reducing computational load and storage consumption. It also avoids the additional waiting time caused by running two models serially or in parallel, thereby greatly reducing the latency and stuttering of Pinyin input and improving the user's continuous input experience. Attached Figure Description

[0037] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0038] Figure 1 The following are examples illustrating the decoding results under several different Pinyin input methods;

[0039] Figure 2 A schematic diagram of an implementation system architecture for the Pinyin decoding method provided in this application embodiment;

[0040] Figure 3This is a schematic flowchart of a Pinyin decoding method provided in an embodiment of this application;

[0041] Figure 4 This is a schematic diagram of a neural network model structure for Pinyin decoding provided in an embodiment of this application;

[0042] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0045] First, let's introduce the terms and concepts that may be used in this application.

[0046] N-gram statistical language model:

[0047] In N-gram statistical language models, N represents the Nth order of historical word combinations. The goal is to predict the next word based on known historical words (i.e., the preceding n-1 words). Specifically, the N-gram model calculates the conditional probability P(w|h), where w is the next word and h is the sequence of the preceding n-1 words. For common bigrams, n=2, considering only the preceding word. An intuitive way to calculate P(w|h) is to count the frequency of this word combination in a large corpus, i.e., the number of times the historical sequence h appears and the number of times h is followed by w, and then estimate the probability using the following formula:

[0048] .

[0049] Where w represents the word to be predicted, i.e., the candidate character to be output in the input method. h represents the historical context sequence, which represents the preceding text input before the current character. P(w|h) represents the conditional probability that the next output character is w given the historical context h. C(h,w) represents the total number of occurrences of w immediately following the complete context sequence h in the corpus used to train the statistical language model. C(h) represents the total number of occurrences of the context sequence h alone in the same training corpus.

[0050] Therefore, the N-gram statistical model decodes based on the probability of statistically related combinations. The model stores terms (combinations of w and h) and the probability P corresponding to each term. Theoretically, as long as the historical vocabulary h is rich enough, the N-gram model can simulate all possible situations. However, in reality, terms cannot be stored infinitely, so the effectiveness of N-gram is greatly reduced.

[0051] Decoding method based on neural network model:

[0052] This approach primarily relies on RNN-based model structures, such as LSTM, or Transformer-based structures, such as GPT. The main modeling method is to train the P2C task as a translation-decoding task for pinyin to text. The advantage of this type of model is its flexibility and some semantic understanding capability. However, due to the lack of static rule distribution statistics, the decoding results are unstable; for example, it may fail to decode some commonly used words.

[0053] Some studies have attempted to decode the two models in parallel and fuse the decoding results at the output layer. However, this approach still has problems:

[0054] 1) The distributions generated by the training of the Pinyin decoding models based on Ngram and NN neural network models are different, and it is difficult to directly fuse the posterior probabilities. Forcing the fusion will reduce the accuracy of the decoding results.

[0055] 2) It requires calculating two sets of models separately and then fusing them, which incurs significant computational overhead and increases storage and computing resources exponentially. If the decoding results are then fused, the response time will depend on the response time of the slowest of the two models, resulting in noticeable lag for the user.

[0056] This application proposes a novel model architecture that integrates statistical language models (e.g., N-grams) and neural network models. Using only one model, inference costs are reduced through parameter reuse. The model structure design leverages the strengths of both models, resulting in superior decoding performance. This will be elaborated upon below.

[0057] This application provides a Pinyin decoding method that can be applied to, for example... Figure 2 The system architecture shown may include a terminal 100 and a server 200. The server 200 may include one or more servers (…). Figure 2 (This example uses a server as an illustration).

[0058] Either the terminal 100 or the server 200 can be used alone to execute the pinyin decoding method provided in the embodiments of the present application. In addition, the terminal 100 and the server 200 can also be used in cooperation to execute the pinyin decoding method provided in the embodiments of the present application.

[0059] Next, the product form of the terminal 100 will be described. Figure 2 in the terminal 100;

[0060] The terminal 100 in the embodiments of the present application can be a mobile phone, a tablet computer, a learning machine, a wearable device, a vehicle-mounted device, a conference terminal, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiments of the present application do not impose any restrictions thereon.

[0061] The pinyin decoding method of the present application can be applied to the field of text input, including but not limited to the input method scenarios in the Chinese and other multilingual fields.

[0062] The embodiments of the present application provide a pinyin decoding method. Taking the application of this method to a computer device as an example, the computer device can specifically be Figure 2 the terminal 100 in or a system composed of the terminal 100 and the server 200. Referring to Figure 3 , the pinyin decoding method specifically includes the following steps:

[0063] Step S100: Obtain a first text sequence including a historical input text sequence and a currently待解码拼音串 pinyin string to be decoded.

[0064] Specifically, the historical input text sequence refers to the continuous text sequence that has been confirmed by word selection through the input method and finally displayed in the input box before the user inputs the currently待解码拼音串 pinyin string to be decoded. It is the core basis for judging the context semantics in the pinyin decoding task. The first text sequence composed of the historical input text sequence and the currently待解码拼音串 pinyin string to be decoded is used as the condition for querying the subsequent statistical language model.

[0065] Exemplarily, the historical input text sequence can include "你是一个 you are a", and the currently待解码拼音串 pinyin string to be decoded is "hr".

[0066] The present application can define the historical input text sequence as h n,t , where n represents the order N of the Ngram corresponding to when the statistical language model adopts Ngram, and t represents the current input time.

[0067] It should be noted that there is an unclear "待解码拼音串" in the original text which should be a specific Chinese term. I've left it as is in the translation for now. If you can provide the correct English term for it, I can further improve the translation.Step S110: Extract semantic features of the first text sequence using a neural network model.

[0068] The neural network model designed in this application can adopt model frameworks such as Long Short-Term Memory Network (LSTM) and Transformer, and a statistical language model embedding module can be embedded in the neural network model.

[0069] In this step, the first text sequence is used as the input to the neural network model. The semantic features of the first text sequence are extracted through the pre-network of the neural network model to achieve semantic understanding of the current context.

[0070] Step S120: Obtain statistical information from the statistical language model based on the first text sequence, and map the statistical information to the same feature space as the semantic features to obtain statistical features.

[0071] Among them, statistical language models refer to models that are pre-trained statistically based on large-scale corpora and used to store static statistical information related to text sequences. By recording statistical patterns such as co-occurrence frequency, conditional probability, and occurrence frequency among text units, they provide stable and reliable prior knowledge constraints for text processing tasks.

[0072] The statistical language models in this application include, but are not limited to: Ngram statistical language models, high-frequency word dictionaries, common collocation dictionaries, word co-occurrence statistics libraries, and other models or data structures that can provide static statistical prior information. Their characteristics are that they do not rely on real-time semantic computation, have stable statistical distributions, and can quickly look up candidate words and their corresponding statistical probabilities.

[0073] Taking the Ngram model as an example of a statistical language model, the corresponding statistical information can include at least one candidate word and the probability information corresponding to each candidate word.

[0074] In one alternative example, a query can be performed in the Ngram model based on the first text sequence, and the top K candidate terms with the highest probabilities can be obtained as statistical information. Here, K can be a pre-defined value, such as 2, 3, 4, or other values.

[0075] Since the statistical information obtained from the statistical language model may differ from the semantic feature distribution of the first text sequence extracted by the neural network model, this step maps the statistical information to the same feature space as the semantic features to eliminate the distribution difference, thus obtaining statistical features. This facilitates the subsequent steps of fusing statistical features and semantic features in the same feature space.

[0076] In some optional examples, a trainable mapping matrix can be used to map statistical information to the same feature space as the semantic features. This mapping matrix is ​​jointly trained and optimized with the neural network model during the training phase.

[0077] By employing a trainable mapping matrix to map statistical information to the same feature space as semantic features, and by jointly training and optimizing this mapping matrix with the neural network model during the training phase, it is possible to align the distributions of statistical information and semantic features, eliminating the fusion difficulties and information conflicts caused by the mismatch in their distributions. It supports end-to-end joint optimization to automatically learn the optimal fusion method without the need for manual design of fusion rules. While retaining the high stability and accuracy of commonly used words of the statistical language model, it fully leverages the contextual semantic understanding capabilities of the neural network, maintains efficient inference of the single model, does not increase additional computational overhead, reduces latency and resource consumption, and improves decoding accuracy and input fluency.

[0078] Step S130: Combine semantic features and statistical features to obtain fused semantic features, and decode the current pinyin string based on the fused semantic features to generate the decoding result.

[0079] When fusing semantic features and statistical features to obtain fused semantic features, a residual fusion method can be used, which involves adding the semantic features and statistical features element by element.

[0080] The residual fusion approach is computationally simple, requires no additional parameters, and does not increase model complexity or inference latency. It can directly inject statistical features as supplementary information without disrupting the original semantic feature distribution, ensuring stable model training and faster convergence, while effectively improving the reliability and fluency of decoding results.

[0081] In addition, other feature fusion methods can be used, including but not limited to weighted addition, feature concatenation, element-wise multiplication, and attention-weighted fusion. All of the above fusion methods can achieve information integration of semantic features and statistical features.

[0082] After obtaining the fused semantic features, these features can be input into the post-processor of the neural network model. Sequence decoding is then performed based on these features to obtain the decoding result (candidate character sequence) corresponding to the current pinyin string to be decoded. This decoding result combines the contextual semantic understanding capability of the neural network model with the statistical stability of the statistical language model, ensuring accurate, reliable decoding that conforms to user input habits.

[0083] The method provided in this application extracts semantic features from a first text sequence using a neural network model. This fully leverages the semantic understanding capabilities of the neural network model to flexibly handle complex contexts, polyphonic characters, input error correction, and other scenarios. Simultaneously, it obtains statistical information from a statistical language model based on the first text sequence and maps this statistical information to the same feature space as the semantic features before fusing it with the semantic features. On one hand, through the mapping operation, the originally inconsistent statistical information and semantic features can be fused at the feature level within a unified vector space, avoiding the mismatch problem caused by directly fusing the decoding results of two models at the text level in existing technologies. On the other hand, the fused features contain both a deep semantic understanding of the current context and statistical prior knowledge based on large-scale corpora, thus simultaneously ensuring the decoding stability for common words and fixed collocations and the flexibility for complex semantic scenarios. This overcomes the shortcomings of uncontrollable results from pure neural network models and the difficulty of handling complex semantics by pure statistical models.

[0084] The fused semantic features obtained by this application, which integrate semantic and statistical features, not only include a deep semantic understanding of the current context but also incorporate historical statistical patterns, enabling more accurate prediction of user input intent. Especially in complex scenarios such as handling long sentences, ambiguous words, personalized input, and pinyin correction, this application demonstrates better decoding performance, thereby improving overall decoding accuracy.

[0085] Furthermore, traditional N-gram models and neural network models run as two independent decoders, each requiring complete decoding computation before the results are fused. The complete decoding of the N-gram model involves path search and probability calculation, resulting in significant computational overhead; the fusion process also introduces additional rule judgments or model computations. This application embeds a statistical language model embedding module within the neural network model, eliminating the need for a separate, complete N-gram decoder. The entire decoding process requires only one neural network forward inference step and eliminates the need for additional model output fusion steps. Compared to existing solutions that serially run two decoders, this application significantly reduces total computation time and storage usage. Compared to parallel operation solutions, this application avoids competition for computational resources between the two models, resulting in more stable real-time response performance on resource-constrained mobile devices. This effectively reduces latency and stuttering in Pinyin input, improving the user's continuous input experience.

[0086] In this embodiment of the application, taking the statistical information including at least one candidate term and the probability information corresponding to each candidate term as an example, several optional implementation methods are provided for the aforementioned step S120 to map the statistical information to the same feature space as the semantic features to obtain the statistical features.

[0087] In one possible implementation, candidate terms are mapped to the same feature space as the semantic features, and the mapped features are weighted and fused using the probability information corresponding to the candidate terms to obtain statistical features.

[0088] Specifically, each candidate word is mapped to a feature space consistent with the semantic feature dimension to obtain the word features corresponding to each candidate word. The probability information corresponding to each candidate word is used to weight the corresponding word features to obtain weighted word features. All weighted word features are then fused to obtain statistical features.

[0089] Candidate terms are defined as vectors. :

[0090] To make vectors By maintaining consistency with the distribution trained on the neural network model, and thus transforming it into a vector that conforms to the structural distribution of the neural network model while preserving a certain amount of statistical language model information, the distribution discrepancy can be eliminated, allowing the vector to... After a trainable mapping matrix , which is mapped to an m-dimensional vector. M represents the dimension of the semantic features extracted by the neural network model from the first input text sequence.

[0091] With function Represents a trainable matrix Then the vector The corresponding mapped features are:

[0092] .

[0093] Furthermore, the probability information P corresponding to the candidate terms is used to perform weighted fusion of the mapped features to obtain statistical features:

[0094] Define the fusion function as follows: The result of weighting the mapped features using the probability P corresponding to each candidate term is expressed as follows:

[0095] .

[0096] in, There are many forms; a simple example is as follows:

[0097] .

[0098] The above steps yield the probability-weighted mapping features corresponding to each candidate term. Next, the probability-weighted mapping features of all candidate terms can be fused. The fusion method can be addition, concatenation, etc. Taking addition fusion as an example, the statistical features after fusion are represented as follows:

[0099] .

[0100] Where K represents the total number of candidate terms, This represents the probability-weighted mapping feature corresponding to the i-th candidate term.

[0101] In another possible implementation, each candidate word is combined with its corresponding probability information and mapped to the same feature space as the semantic features. The mapped features are then fused to obtain statistical features.

[0102] Specifically, firstly, each candidate word and its corresponding probability information are combined to form joint statistical information containing both word content and statistical probability. Then, this joint statistical information is mapped onto the same feature space as the semantic features using a trainable mapping matrix, yielding mapped features for each candidate word. Finally, the mapped features are fused (the fusion method can be addition, concatenation, etc.) to obtain the final statistical features. These statistical features encode word information and probability information in an integrated manner, more completely preserving the prior constraints of the statistical language model and further improving the stability and decoding effect of feature fusion.

[0103] In some embodiments of this application, some possible implementation methods of obtaining statistical information from the statistical language model based on the first text sequence in the aforementioned step S120 are described.

[0104] In one possible implementation, a first text sequence containing the historical input text sequence and the current pinyin string to be decoded can be input into a preset embedding layer. The embedding layer can then convert the character and pinyin text content into a high-dimensional numerical vector, generating an embedding feature corresponding to the first text sequence, thereby completing the conversion from text form to feature index form.

[0105] The statistical language model used in this application can be pre-built and stored offline. The model does not use the original text string as the retrieval basis, but pre-uses the embedded features corresponding to various types of text content as the retrieval index. It stores several candidate terms corresponding to different indexes in an orderly manner, as well as the probability information corresponding to each candidate term, forming a static statistical knowledge base with embedded features as the query index.

[0106] After obtaining the embedding features corresponding to the first text sequence, the embedding features are directly used as the query index to perform matching and retrieval within the statistical language model. This quickly retrieves all candidate terms that match the current embedding features, as well as the probability information corresponding to each candidate term, thereby completing the accurate acquisition of statistical information.

[0107] The retrieval method in this embodiment relies on vector indexing to achieve fast matching, which is more efficient and faster than traditional text matching queries. At the same time, it can accurately match candidate words corresponding to the context, ensuring that the subsequent feature mapping and fusion process can obtain effective statistical prior information that fits the input context.

[0108] In addition to the methods described above, statistical information can also be obtained through direct querying. Specifically, the first text sequence, consisting of the historical input text sequence and the current pinyin string to be decoded, is directly input into the statistical language model in its raw text form, without prior vector conversion via an embedding layer. The statistical language model internally constructs offline statistics based on a massive corpus, directly using the raw text content as search keywords for matching and retrieval. Based on the text context and sequence collocation rules, it retrieves at least one candidate word that matches the current first text sequence, and simultaneously retrieves the statistical probability information corresponding to each candidate word, thus directly obtaining the statistical information.

[0109] Reference Figure 4 This example illustrates an alternative architecture for the neural network model of this application.

[0110] The neural network model in this embodiment includes a pre-network, a statistical language model embedding module, and a post-network. The pre-network includes an embedding layer and a semantic extraction module.

[0111] The embedding layer is used to convert the first text sequence into embedded features.

[0112] The semantic extraction module is used to extract semantic features from the first text sequence based on embedded features. In specific implementations, the semantic extraction module can adopt various architectures, such as through one or more Transformer Blocks.

[0113] The statistical language model embedding module is used to query statistical information corresponding to the embedded features from the statistical language model, map the statistical information to the same feature space as the semantic features, and obtain statistical features. The statistical language model stores at least one candidate word and its probability information with the embedded features as the index.

[0114] In one alternative example, the statistical language model could be an N-gram model.

[0115] The post-processor network is used to perform decoding processing with the fused semantic features obtained by fusing semantic features and statistical features as input, and to generate the decoding result corresponding to the current pinyin string to be decoded.

[0116] The neural network model provided in this embodiment may include the following training data during the training phase: input samples and sample labels. The input samples include historical input text sequence samples and pinyin string samples to be decoded. The sample labels are the decoding results corresponding to the pinyin string samples to be decoded.

[0117] During the training phase, the network parameters in the neural network model and the trainable mapping matrix in the statistical language model embedding module are jointly trained and optimized until the training is completed, at which point the parameters and mapping matrix in the neural network model are fixed.

[0118] The neural network model for Pinyin decoding provided in this embodiment possesses both the semantic understanding capability of a neural network model and the stability of a statistical language model. It can handle complex contexts while ensuring accurate decoding of commonly used words. The fusion of statistical and semantic features based on vector space avoids the errors caused by traditional methods that forcibly fuse decoding results according to rules, resulting in decoding results that are more in line with human usage habits.

[0119] Furthermore, by requiring only one model for inference, computational and storage overhead is greatly reduced, input lag is significantly reduced, and the user experience is improved.

[0120] The neural network model for Pinyin decoding provided in this embodiment is applicable to Pinyin input methods on all platforms: mobile phones, PCs, tablets, etc. In terms of applicable languages, it can be used for input decoding of Pinyin characters in multiple languages ​​such as Chinese, English, and Japanese.

[0121] This application also provides an electronic device in its embodiments. (See reference...) Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, tablets, large-screen teaching displays, wearable devices, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0122] like Figure 5 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2 or a program loaded from a storage device 8 into a random access memory (RAM) 3, to implement the pinyin decoding method of the foregoing embodiments of this application. When the electronic device is powered on, the RAM 3 also stores various programs and data required for the operation of the electronic device. The processing unit 1, ROM 2, and RAM 3 are interconnected via a bus 4. An input / output (I / O) interface 5 is also connected to the bus 4.

[0123] Typically, the following devices can be connected to I / O interface 5: input devices 6 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 7 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 8 including, for example, memory cards, hard drives, etc.; and communication devices 9. Communication device 9 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.

[0124] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the pinyin decoding methods provided in this application.

[0125] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the pinyin decoding methods provided in this application.

[0126] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0128] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0129] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[0130] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

Claims

1. A method for decoding Pinyin, characterized in that, include: Get the first text sequence containing the historical input text sequence and the current pinyin string to be decoded; The semantic features of the first text sequence are extracted using a neural network model; Based on the first text sequence, statistical information is obtained from the statistical language model, and the statistical information is mapped to the same feature space as the semantic features to obtain statistical features; The semantic features and statistical features are fused to obtain fused semantic features, and the decoding result corresponding to the current pinyin string to be decoded is generated based on the fused semantic features.

2. The method according to claim 1, characterized in that, The statistical language model is an N-gram model, and the statistical information includes at least one candidate word and the probability information corresponding to each candidate word.

3. The method according to claim 2, characterized in that, The process of mapping the statistical information to the same feature space as the semantic features to obtain the statistical features includes: The candidate terms are mapped to the same feature space as the semantic features, and the mapped features are weighted and fused using the probability information corresponding to the candidate terms to obtain statistical features.

4. The method according to claim 2, characterized in that, The process of mapping the statistical information to the same feature space as the semantic features to obtain the statistical features includes: Each candidate word is combined with its corresponding probability information and mapped to the same feature space as the semantic features. The mapped features are then fused to obtain statistical features.

5. The method according to claim 1, characterized in that, The process of obtaining statistical information from a statistical language model based on the first text sequence includes: The first text sequence is converted into embedded features through an embedding layer; Based on the embedding feature, statistical information corresponding to the embedding feature is queried from the statistical language model; wherein, the statistical language model stores at least one candidate term and its probability information using the embedding feature as an index.

6. The method according to claim 1, characterized in that, The process of mapping the statistical information to the same feature space as the semantic features includes: The statistical information is mapped to the same feature space as the semantic features using a trainable mapping matrix, and the mapping matrix and the neural network model are jointly trained and optimized during the training phase.

7. The method according to claim 1, characterized in that, The process of fusing the semantic features and the statistical features to obtain the fused semantic features includes: The semantic features and the statistical features are residually fused to obtain the fused semantic features.

8. The method according to any one of claims 1-7, characterized in that, The neural network model includes: The system comprises a pre-network, a statistical language model embedding module, and a post-network, wherein the pre-network includes an embedding layer and a semantic extraction module; The embedding layer is used to convert the first text sequence into embedded features; The semantic extraction module is used to extract semantic features of the first text sequence based on the embedded features; The statistical language model embedding module is used to query statistical information corresponding to the embedding feature from the statistical language model, map the statistical information to the same feature space as the semantic feature, and obtain the statistical feature. The statistical language model stores at least one candidate word and its probability information with the embedding feature as the index. The post-network is used to perform decoding processing with the fused semantic features obtained by fusing the semantic features and the statistical features as input, and to generate the decoding result corresponding to the current pinyin string to be decoded.

9. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the Pinyin decoding method as described in any one of claims 1 to 8.

10. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the Pinyin decoding method as described in any one of claims 1 to 8.