# Patent

## Title
Predictive text input

## Abstract

Systems and processes for predictive text input are provided. In one example process, a text input can be received. The text input can be associated with an input context. A frequency of occurrence of an m-gram with respect to a subset of a corpus can be determined using a language model. The subset can be associated with a context. A weighting factor can be determined based on a degree of similarity between the input context and the context. A weighted probability of a predicted text given the text input can be determined based on the frequency of occurrence of the m-gram and the weighting factor. The m-gram can include at least one word in the text input and at least one word in the predicted text.

## Background
CROSS-REFERENCE TO RELATED APPLICATION
This application claims priority from U.S. Provisional Ser. No. 62/006,010, filed on May 30, 2014, entitled PREDICTIVE TEXT INPUT, which is hereby incorporated by reference in its entirety for all purposes.
This application also relates to the following provisional applications: U.S. patent application Ser. No. 62/005,837, “Device, Method, and Graphical User Interface for a Predictive Keyboard,” filed May 30, 2014, U.S. patent application Ser. No. 62/046,876, “Device, Method, and Graphical User Interface for a Predictive Keyboard,” filed Sep. 5, 2014, U.S. patent application Ser. No. 62/005,825, “Entropy-Guided Text Prediction Using Combined Word and Character N-gram Language Models,” filed May 30, 2014, U.S. patent application Ser. No. 62/005,942, “Text Prediction Using Combined Word N-gram and Unigram Language Models,” filed May 30, 2014, and U.S. patent application Ser. No. 62/005,958, “Canned Answers in Messages,” filed May 30, 2014, which are hereby incorporated by reference in their entirety for all purposes.


FIELD
This relates generally to text input in electronic devices and, more specifically, to predictive text input in electronic devices.
BACKGROUND
Text entry can be required to interact with electronic devices. However, many electronic devices do not include convenient means for inputting text. For example, many mobile devices can have smaller virtual keyboards that are slow and inaccurate for inputting text. In addition, a user can encounter difficulties typing characters not readily available on virtual keyboards.
Predictive text inputting solutions can help to increase the speed and accuracy of inputting text. Such solutions can provide predictions of future words based on previous words entered by the user, thereby reducing time and effort to input text. Currently, predictive text inputting solutions can utilize generalized language models or word libraries to provide text predictions. While these solutions can assist users with text input, the text predictions can often be inaccurate or in a context not intended by the user.
SUMMARY
Systems and processes for predictive text input are provided. In one example process, a text input can be received. The text input can be associated with an input context. A frequency of occurrence of an m-gram with respect to a subset of a corpus can be determined using a language model. The subset can be associated with a context. A weighting factor can be determined based on a degree of similarity between the input context and the context. A weighted probability of a predicted text given the text input can be determined based on the frequency of occurrence of the m-gram and the weighting factor. The m-gram can include at least one word in the text input and at least one word in the predicted text.
In another example process, a text input can be received. A physical context that is associated with the text input can be determined. A weighted probability of a predicted text given the text input can be determined using a language model and the physical context. The predicted text can be presented via a user interface of the electronic device.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an exemplary language model having a hierarchical context tree structure according to various examples.
FIG. 2 illustrates an exemplary process for predictive text input according to various examples.
FIG. 3 illustrates an exemplary process for predictive text input according to various examples.
FIG. 4 illustrates an exemplary process for predictive text input according to various examples.
FIG. 5 illustrates an exemplary user device for carrying out aspects of predictive text input according to various examples.
FIG. 6 illustrates an exemplary system and environment for carrying out aspects of predictive text input according to various examples.
FIG. 7 illustrates a functional block diagram of an exemplary electronic device according to various examples.
FIG. 8 illustrates a functional block diagram of an exemplary electronic device according to various examples.



DETAILED DESCRIPTION
In the following description of examples, reference is made to the accompanying drawings in which it is shown by way of illustration specific examples that can be practiced. It is to be understood that other examples can be used and structural changes can be made without departing from the scope of the various examples.
The present disclosure relates to systems and processes for predictive text input. In various examples described herein, a language model can be used to generate predictive text given input text. In some examples, the language model can be a user language model having a hierarchical context tree structure. For example, the language model can be built from user text and thus can more closely model the intent of the user. This enables greater accuracy in generating predictive text for the user. In addition, the language model can include various sub-models associated with various specific contexts. The language model can thus be used to model various specific contexts, thereby improving accuracy in generating predictive text. The hierarchical context tree structure can enable information to be shared between the sub-models and can prevent redundancy among the sub-models. This allows the language model to be stored and implemented efficiently.
In one example process for predictive text input, a text input can be received. The text input can be associated with an input context. A frequency of occurrence of an m-gram with respect to a subset of a corpus can be determined using a language model. The m-gram can include at least one word in the text input. A weighting factor can be determined based on a degree of similarity between the input context and the context. A weighted probability of a predicted text given the text input can be determined based on the frequency of occurrence of the m-gram and the weighting factor. The m-gram can include at least one word in the predicted text. The predicted text can be presented via a user interface of an electronic device.
In some examples, physical context can be used to improve the accuracy of predictive text. Physical context can refer to a time period, a location, an environment, a situation, or a circumstance associated with the user at the time the text input is received. For example, physical context can include the situation of being on an airplane. The physical context can be determined using a sensor of an electronic device. In addition, the physical context can be determined using data obtained from an application of the electronic device. In one example, the physical context of being on an airplane can be determined based on audio detected by the microphone of the electronic device. In another example, the physical context of being on an airplane can be determined based on a user calendar entry obtained from the calendar application on the electronic device.
In one example process of predictive text using physical context, a text input can be received. A physical context that is associated with the text input can be determined. A weighted probability of a predicted text given the text input can be determined using a language model and the physical context. The predicted text can be presented via a user interface of an electronic device.
1. Language Model
A language model generally assigns to an n-gram a frequency of occurrence of that n-gram with respect to a corpus of natural language text. An n-gram refers to a sequence of n words, where n is any integer greater than zero. In some cases, the frequency of occurrence can be in the form of raw counts. For example, a particular 2-gram can occur 25 times within a corpus of natural language text. Accordingly, the frequency of occurrence of that 2-gram within the corpus can be 25 counts. In other cases, the frequency of occurrence can be a normalized value. For example, the frequency of occurrence can be in the form of a likelihood or probability (e.g., probability distribution). In one such example, a corpus of natural language text can include 25 counts of a particular 2-gram and 1000 counts of all 2-grams. Accordingly, the frequency of occurrence of that 2-gram within the corpus can be equal to 25/1000.
A language model can be built from a corpus. In some cases, the language model can be a general language model built from a corpus that includes a large volume of text associated with various contexts. In other cases, the language model can be a context-specific language model where the language model is built from a corpus that is associated with a specific context. The specific context can be, for example, a subject, an author, a source of text, an application for inputting text, a recipient of text, or the like. Context-specific language models can be desirable to improve accuracy in text predictions. However, because each context-specific language model can be associated with only one context, multiple context-specific language models can be required to cover a range of contexts. This can be an inefficient use of resources where significant memory and computational power can be required to store and implement a large number of context-specific language models. It should be recognized that that the term “context” described herein can refer to a scope or a domain.
FIG. 1 depicts language model 100 having a hierarchical context tree structure. The hierarchical context tree structure can be advantageous in enabling multiple contexts to be efficiently integrated within a single language model. Language model 100 can thus be used to efficiently model a variety of contexts.
As shown in FIG. 1, language model 100 can include multiple nodes that extend from root node 102 in a tree structure. The nodes can be arranged in multiple hierarchical levels where each hierarchical level can represent a different category of context. For example, hierarchical level 132 can represent application context while hierarchical level 134 can represent recipient context. Having only a single category of context for each hierarchical level can be advantageous in preventing redundancy between the nodes of language model 100. This reduces the memory required to store language model 100 and also enables greater efficiency in determining text predictions.
Each node of language model 100 can correspond to a sub-model of language model 100. Each sub-model within a hierarchical level can be associated with a specific context of the category of context of the hierarchical level. For example, hierarchical level 132 can include sub-models that are each associated with a specific application of the user device. Specifically, sub-models 104, 106, and 108 can be associated with the messaging application, the email application, and the word processor application, respectively. Similarly, hierarchical level 134 can include sub-models that are each associated with a specific recipient. Specifically, sub-models 110, 112, and 114 can be associated with the spouse of the user, a first friend of the user, and a second friend of the user, respectively. In addition, a child sub-model can be associated with the context of its parent sub-model. For example, children sub-models 110, 112, and 114 can extend from parent sub-model 104 and thus children sub-models 110, 112, and 114 can be associated with the messaging application of parent sub-model 104. Further, the sub-models can be independent of one another such that each sub-model is associated with a unique context. This prevents redundancy between the sub-models.
Language model 100 can be built from a corpus that includes multiple subsets where each subset can be associated with a specific context. In this example, language model 100 can be an n-gram statistical language model that includes a plurality of n-grams. Each n-gram can be associated with a frequency of occurrence. The frequency of occurrence of each n-gram can be with respect to a subset or a plurality of subsets of the corpus. Thus, each n-gram can be associated with a specific context of a subset or of a plurality of subsets.
Each sub-model of language model 100 can be built from a subset of the corpus and can be associated with the specific context of the subset. For example, sub-model 110 can be built from a first subset of the corpus. The first subset can include text that is associated with the messaging application of the user device and that is directed to the spouse of the user. Thus, sub-model 110 can be associated with a first context where the first context can include the messaging application and the spouse of the user. Further, the frequency of occurrence of an n-gram of sub-model 110 can be with respect to the first subset.
In some examples, a parent sub-model can be based on its children sub-models. For example, the frequency of occurrence of a specific n-gram with respect to parent sub-model 104 can be derived by combining the frequencies of occurrence of that n-gram with respect to children sub-models 110, 112, and 114. In some examples, the result from each child sub-model can be weighted by a weighting factor prior to being combined. For example, the frequency of occurrence of a particular 2-gram with respect to parent sub-model 104 can be equal to the sum of the weighted frequencies of occurrence of that 2-gram with respect to children sub-models 110, 112, and 114. This can be expressed as: C(w1 w2)messaging=λ1C(w1 w2)messaging,spouse+λ2C(w1 w2)messaging,friend1+λ3C(w1 w2)messaging,friend2, where C(w1 w2)messaging denotes the frequency of occurrence of the 2-gram with respect to sub-model 104, C(w1 w2)messaging,spouse denotes the frequency of occurrence of the 2-gram with respect to sub-model 110, C(w1 w2)messaging,friend1 denotes the frequency of occurrence of the 2-gram with respect to sub-model 112, C(w1 w2)messaging,friend2 denotes the frequency of occurrence of the 2-gram with respect to sub-model 114, and λ1, λ2, λ3 are different weighting factors.
Language model 100 can further include a plurality of hierarchical context tags to encode the context associated with each n-gram. Each context can thus be represented by one or more hierarchical context tags. For example, an n-gram of sub-model 104 can be represented by the hierarchical context tag “messaging” while an n-gram of sub-model 110 can be represented by the hierarchical context tags “messaging, spouse”. Identical n-grams from different sub-models can thus be differentiated by the hierarchical context tags associated with each n-gram.
In some examples, language model 100 can be a general language model. In other examples, language model 100 can be user language model that is built from a corpus of user text. User text or user text input can refer to text that is inputted by a user of the user device. The user can be an individual or a group of individuals. Further, language model 100 can be a static language model or dynamic language model.
It should be recognized that language model 100 can include any number of hierarchical levels representing a respective number of categories of context. The hierarchical levels can be arranged in any suitable order. For instance, in some examples, hierarchical level 134 can extend from root 102 while hierarchical level 132 can extend from hierarchical level 134. Each hierarchical level can include any number of sub-models associated with a respective number of specific contexts. For example, hierarchical level 132 can include additional sub-models that are associated with other applications of the user device. The applications can include, for example, web browser, social media, chat, calendar scheduler, spreadsheets, presentations, notes, media, virtual assistant, or the like. Similarly, hierarchical level 134 can include additional sub-models that are associated with other recipients. The recipients can include any specific individual, any group of individuals, or any category of people. For example, the recipients can include a family member, a friend, a colleague, a group of friends, children within a particular age range, or the like. Further, in some examples, language model 100 can include an additional hierarchical level representing physical context. The sub-models of the hierarchical level can be associated with a specific physical context. For example, physical context can include one or more of an environment, situation, circumstance, weather, time period, location, and the like.
2. Process for Predictive Text Input
FIG. 2 illustrates exemplary process 200 for predictive text input according to various examples. In some examples, process 200 can be implemented by a user device (e.g., user device 500, described below). In some examples, the user device can be part of a server-client system (e.g., system 600, described below) and process 200 can be implemented by the server-client system.
At block 202 of process 200, a text input can be received. In some examples, the text input can be received via an interface of the user device (e.g., touch screen 546 or other input/control devices 548 of user device 500, described below). The interface can be any suitable device for inputting text. For example, the interface can be a keyboard/keypad, a touch screen implementing a virtual keyboard or a handwriting recognition interface, a remote control (e.g., television remote control), a scroll wheel interface, an audio input interface implementing speech-to-text conversion, or the like. The received text input can be in any language and can include at least one word. In some examples, the text input can include a sequence of words. In some cases, a character (e.g., symbols and punctuation) can be considered a word.
The received text input can be associated with an input context. The input context can include any contextual information related to the received text input. The input context can include a single context or a combination of contexts. In some examples, the input context can include an application of the user device with which the received text input is associated. The application can be any application configured to receive text input, such as, for example, email, text messaging, web browser, calendar scheduler, word processing, spreadsheets, presentations, notes, media, virtual assistant, or the like. In addition, the input context can include the recipient to which the received text input is directed. The recipient can include, for example, a family member, a friend, a colleague, or the like. The recipient can also include a particular group of people or a category of people, such as, for example, best friends, professional acquaintances, children of a particular age group, or the like.
The recipient can be determined using a language model. In some examples, the language model can be the same language model used in block 204 for determining a first frequency of occurrence of an m-gram with respect to a first subset of a corpus. In other examples, the language model used to determine the recipient can be different from that used in block 204. The language model used to determine the recipient can include sub-models that are associated with various recipients (e.g., recipient A, B, C . . . Z). The most likely recipient to which the input text is directed can be determined from the input text using the language model. For example, the probability that the recipient is recipient A given the text input can be determined as follows: P(recipient A|text input)=P(text input|recipient A)*P(recipient A)/P(text input). The input context can thus include the most likely recipient determined based on the input text and using the language model.
In some examples, the input context can include a physical context. The physical context can refer to an environment, a situation, or a circumstance associated with the user at the time the text input is received. For example, the physical context can include a time, a location, a weather condition, a speed of travel, a noise level, or a brightness level. The physical context can also include traveling on a vehicle (e.g., car, bus, subway, airplane, boat, etc.), engaging in a particular activity (e.g., sports, hobby, shopping, etc.), or attending a particular event (e.g., dinner, conference, show, etc.).
In some examples, the input context can be determined using a sensor of the user device. The sensor can include, for example, a microphone, a motion sensor, a GPS receiver, a light/brightness sensor, an image sensor, a moisture sensor, a temperature sensor, or the like. In a specific example, the user can be inputting text to the user device while traveling on an airplane. In such an example, the microphone of the user device can receive audio that is characteristic of an airplane and a sound classifier can be used to determine that the received audio is associated with an airplane. Further, the motion sensor and GPS sensor (e.g., GPS receiver) of the user device can be used to determine that the speed, altitude, and location of the user are consistent with being on an airplane. The input context of traveling on an airplane can thus be determined using information obtained from the microphone, motion sensor, and GPS sensor.
In another example, the user can be inputting text to the user device while jogging. In such an example, the motion sensor can detect oscillations and vibration associated with jogging while the microphone can receive audio that is consistent with a person jogging. The input context of jogging can thus be determined based on the information from the microphone and motion sensor.
In yet another example, the user can be inputting text to the user device while in a dark environment. In such an example, the image sensor or the brightness sensor can be used to detect that the user is in a dark environment. The physical context of being in a dark environment can thus be determined based on the information from the image or brightness sensor. Further, in some cases, other physical context can be determined based on determining that the user is in a dark environment. For example, the user device can determine the physical context of watching a movie in a movie theater based on determining the location of the user using the GPS sensor and determining that the user is in a dark environment.
In some examples, the input context can be represented by one or more hierarchical context tags. For example, the received text input can be associated with the email application and spouse of the user as the recipient. In such an example, the input context can be represented by the hierarchical context tags “email, spouse”.
At block 204 of process 200, a first frequency of occurrence of an m-gram with respect to a first subset of a corpus can be determined using a first language model. In some examples, the first language model can be an n-gram statistical language model having a hierarchical context tree structure. Specifically, the first language model can be similar or identical to language model 100 described above with reference to FIG. 1.
The first language model can be built from a corpus having a plurality of subsets where each subset is associated with a context. Thus, the first subset can be associated with a first context. In one example, with reference to FIG. 1, sub-model 110 can be built from the first subset of the corpus. In this example, the first subset can include a collection of text that is associated with the messaging application and directed to the spouse of the user. Accordingly, in this example, the first context can include the messaging application and the spouse as the recipient.
The m-gram can be a sequence of m words where m is a specific positive integer. The m-gram can include at least one word in the text input received at block 202. In one example, the text input can include the word “apple” and the m-gram can be the 2-gram “apple cider”. In one example, the first frequency of occurrence of the 2-gram “apple cider” can be determined from sub-model 110 of language model 100.
It should be recognized that in other examples, the first frequency of occurrence of the m-gram with respect to the first subset can be determined from any sub-model of language model 100 and the first subset can be associated with the context of the respective sub-model. For instance, in one example, a sub-model of language model 100 can be built from a first subset that includes a collection of text associated with a specific physical context (e.g., environment, situation, circumstance, time period, location, etc.). In this example, the sub-model can be a physical context sub-model that is associated with the specific physical context. The first frequency of occurrence of the m-gram with respect to the first subset can be determined from the physical context sub-model where the first context includes the specific physical context.
In some examples, the first language model can be a general language model. In other examples, the first language model can be a user language model built using a corpus that includes a collection of user input text received prior to receiving the text input. In some examples, the first language model can be a static language model that is not modified or updated using the input text. In other examples, the first language model can be a dynamic language model. For example, learning based on received input text can be performed to update the dynamic language model. Specifically, the first language model can be updated using the input text received at block 202. Further, the first language model can be pruned (e.g., unlearned) using methods known in the art to enable the efficient use of the language model and to limit the memory required to store the language model.
At block 206 of process 200, a first weighting factor to apply to the first frequency of occurrence of the m-gram can be determined based on a degree of similarity between the input context and the first context. For example, a higher first weighting factor can be determined based on a higher degree of similarity between the input context and the first context. Conversely, a lower first weighting factor can be determined based on a lower degree of similarity between the input context and the first context.
In some example, the input context and the first context can be represented by hierarchical context tags and the degree of similarity can be determined based on the number of matching hierarchical context tags between the input context and the first context. For example, the input context can be represented by the hierarchical context tags “messaging, spouse” and the first context can be represented by the hierarchical context tags “messaging, spouse”. In this example, the degree of similarity can be high based on the matching of both the application context tags and the recipient context tags. Therefore, in this example, the first weighting factor can be determined to have a high value. In another example, the input context can be represented by the hierarchical context tags “messaging, spouse” and first context can be represented by the hierarchical context tags “email, colleague1”. In this example, the degree of similarity can be low due to neither the application context tags nor the recipient context tags matching. Therefore, in this example, the first weighting factor can be determined to have a low value.
In some examples, the first weighting factor can be determined using a look-up table. The look-up table can have predetermined values of the first weighting factor based on various combinations of input context and first context. In other examples, the first weighting factor can be determined by performing calculations based on predetermined logic.
At block 208 of process 200, a first weighted probability of a first predicted text given the text input can be determined based on the first frequency of occurrence of the m-gram and the first weighting factor. The m-gram at block 204 can include at least one word in the first predicted text. In one example, the text input can be the word “apple”, the first predicted text can be the word “cider”, and the m-gram can be the 2-gram “apple cider”. In this example, the first weighted probability of the word “cider” given the word “apple” can be determined as follows:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        cider
        |
        apple
      
      )
    
  
  =
  
    
      λ
      1
    
    ⁢
    
      
        
          
            C
            1
          
          (
          
            apple
            ⁢
            
              
            
            ⁢
            cider
          
          )
        
        
          message
          ,
          spouse
        
      
      
        
          
            C
            1
          
          (
          apple
          )
        
        
          message
          ,
          spouse
        
      
    
  




where C1(apple cider)message,spouse denotes the first frequency of occurrence of the 2-gram “apple cider” with respect to the first subset determined using sub-model 110 of language model 100, C1(apple)message,spouse denotes the frequency of occurrence of the 1-gram “apple” with respect to the first subset determined using sub-model 110 of language model 100, and λ1 denotes the first weighting factor.

At block 210 of process 200, the first predicted text can be presented via a user interface of the user device. The first predicted text can be presented in a variety of ways. For example, the first predicted text can be displayed via a user interface displayed on the touchscreen of the user device. The manner in which the first predicted text is displayed can be based at least in part on the first probability of the first predicted text given the text input. For example, a list of predicted text can be presented and the position of the first predicted text on the list can be based at least in part on the first probability. A higher first probability can result in the first predicted text being positioned closer to the front or top of the list.
Although process 200 is described above with reference to blocks 202 through 210, it should be appreciated that in some cases, one or more blocks of process 200 can be optional and additional blocks can also be performed.
Further, it should be recognized that the first weighted probability of the first predicted text given the text input at block 208 can be determined based on any number of frequencies of occurrence of the m-gram and a respective number of the weighting factors. This enables information from other sub-models to be leveraged in determining the first weighted probability. For instance, in some examples, the first weighted probability of the first predicted text given the text input can be determined based on a first frequency of occurrence of the m-gram with respect to a first subset of the corpus, a first weighting factor, a second frequency of occurrence of the m-gram with respect to a second subset of the corpus, and a second weighting factor. In these examples, process 200 can further include determining, using the first language model, the second frequency of occurrence of the m-gram with respect to a second subset of the corpus. The second subset can be different from the first subset and the second subset can be associated with a second context that is different from the first context. For example, as described above with reference to block 204, the first frequency of occurrence of the m-gram with respect to the first subset can be determined using sub-model 110 of language model 100. Sub-model 110 can be built using the first subset of the corpus and the first context of the first subset can be associated with the messaging application and the spouse of the user. In addition, the second frequency of occurrence of the m-gram with respect to the second subset can be determining using sub-model 112 of language model 100. Sub-model 112 can be built using the second subset of the corpus and the second context of the second subset can be associated with the messaging application and the first friend of the user.
Further, process 200 can include determining the second weighting factor to apply to the second frequency of occurrence of the m-gram based on a degree of similarity between the input context and the second context. For example, the input context can be represented by “messaging, spouse”, the first context can be represented by “messaging, spouse”, and the second context can be represented by “messaging, friend1”. In this example, the degree of similarity between the input context and the first context can be greater than the degree of similarity between the input context and the second context. Accordingly, in this example, the first weighting factor can be greater than the second weighting factor. It should be appreciated that in other examples, the degree of similarity between the input context and the first context can be less than the degree of similarity between the input context and the second context and thus the first weighting factor can be less than the second weighting factor.
As described above, the first weighted probability of the first predicted text given the text input can be determined based on the first frequency of occurrence of the m-gram, the first weighting factor, the second frequency of occurrence of the m-gram, and the second weighting factor. In an example where the text input is “apple” and the predicted text is “cider”, the first weighted probability of the word “cider” given the word “apple” can be determined as follows:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        cider
        |
        apple
      
      )
    
  
  =
  
    
      
        λ
        1
      
      ⁢
      
        
          
            
              C
              1
            
            (
            
              apple
              ⁢
              
                
              
              ⁢
              cider
            
            )
          
          
            message
            ,
            spouse
          
        
        
          
            
              C
              1
            
            (
            apple
            )
          
          
            message
            ,
            spouse
          
        
      
    
    +
    
      
        λ
        2
      
      ⁢
      
        
          
            
              C
              2
            
            (
            
              apple
              ⁢
              
                
              
              ⁢
              cider
            
            )
          
          
            message
            ,
            
              friend
              ⁢
              
                
              
              ⁢
              1
            
          
        
        
          
            
              C
              2
            
            (
            apple
            )
          
          
            message
            ,
            
              friend
              ⁢
              
                
              
              ⁢
              1
            
          
        
      
    
  




where C1(apple cider)message,spouse denotes the first frequency of occurrence of the 2-gram “apple cider” with respect to the first subset determined using sub-model 110, C1(apple)message,spouse denotes the first frequency of occurrence of the 1-gram “apple” with respect to the first subset determined using sub-model 110, λ1 denotes the first weighting factor, C2(apple cider)message,friend1 denotes the second frequency of occurrence of the 2-gram “apple cider” with respect to the second subset determined using sub-model 112, C2(apple)message,friend1 denotes the second frequency of occurrence of the 1-gram “apple” with respect to the second subset determined using sub-model 112, and λ2 denotes the second weighting factor. In this example, the probability of each sub-model is calculated and each probability is weighted separately before being combined.

In another example, the first weighted probability of the word “cider” given the word “apple” can be determined as follows:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        cider
        |
        apple
      
      )
    
  
  =
  
    
      
        
          λ
          1
        
        ⁢
        
          
            
              C
              1
            
            (
            
              apple
              ⁢
              
                
              
              ⁢
              cider
            
            )
          
          
            message
            ,
            spouse
          
        
      
      +
      
        
          λ
          2
        
        ⁢
        
          
            
              C
              2
            
            (
            
              apple
              ⁢
              
                
              
              ⁢
              cider
            
            )
          
          
            message
            ,
            
              friend
              ⁢
              
                
              
              ⁢
              1
            
          
        
      
    
    
      
        
          λ
          1
        
        ⁢
        
          
            
              C
              1
            
            (
            apple
            )
          
          
            message
            ,
            spouse
          
        
      
      +
      
        
          λ
          2
        
        ⁢
        
          
            
              C
              2
            
            (
            apple
            )
          
          
            message
            ,
            
              friend
              ⁢
              
                
              
              ⁢
              1
            
          
        
      
    
  




In this example, the frequencies of occurrence are combined separately in the numerator and the denominator to derive the first weighting probability.

Further, in this example, the first weighted probability of the word “cider” given the word “apple” (e.g., Pw1(cider|apple)) can be based on the first weighted probability of the 1-gram “apple” with respect to the first subset (e.g., λ1C1(apple)message,spouse). Therefore, in this example, process 200 can include determining, using the first language model, a first frequency of occurrence of an (m−1)-gram with respect to the first subset (e.g., C1(apple)message,spouse). The m-gram (e.g., “apple cider”) can include one or more words in the (m−1)-gram (e.g., “apple”). The first weighting factor (e.g., λ1) can be applied to the first frequency of occurrence of the (m−1)-gram (e.g., C1(apple)message,spouse) to obtain the weighted frequency of occurrence of the (m−1)-gram (e.g., λ1C1(apple)message,spouse). The first weighted probability of the first predicted text given the text input (e.g., Pw1(cider|apple)) can thus be determined based on the first weighted frequency of occurrence of the (m−1)-gram (e.g., λ1C1(apple)message,spouse).
In some examples, the weighted probability of a second predicted text given the text input and the first predicted text can be determined in response to the first weighted probability of the first predicted text given the text input being greater than a predetermined threshold. In these examples, process 200 can further include determining, using the language model, a frequency of occurrence of an (m+1)-gram with respect to the first subset of the corpus. The (m+1)-gram can include one or more words in the m-gram and at least one word in the second predicted text. The weighted probability of the second predicted text given the text input and the first predicted text can be determined based on the frequency of occurrence of the (m+1)-gram and the first weighting factor. In one example, the m-gram can be the 2-gram “apple cider” and the (m+1)-gram can be the 3-gram “apple cider vinegar”. In response to the first weighted probability of the word “cider” given the word “apple” (e.g., Pw1(cider|apple)) being greater than a predetermined threshold, the frequency of occurrence of the 3-gram “apple cider vinegar” (e.g., C(apple cider vinegar)message,spouse) with respect to the first subset of the corpus can be determined using sub-model 110 of language model 100. A weighted probability of the word “vinegar” given the words “apple cider” can be determined based on the frequency of occurrence of the 3-gram “apple cider vinegar” and the first weighting factor λ1. In particular:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        vinegar
        |
        
          apple
          ⁢
          
            
          
          ⁢
          cider
        
      
      )
    
  
  =
  
    
      λ
      1
    
    ⁢
    
      
        
          C
          (
          
            apple
            ⁢
            
              
            
            ⁢
            cider
            ⁢
            
              
            
            ⁢
            vinegar
          
          )
        
        
          message
          ,
          spouse
        
      
      
        
          C
          (
          
            apple
            ⁢
            
              
            
            ⁢
            cider
          
          )
        
        
          message
          ,
          spouse
        
      
    
  




It should be recognized that weighted probabilities can be determined for any number of additional predicted texts in response to the weighted probability of the previous predicted text being greater than a predetermined threshold. In some examples, weighted probabilities of predicted text can be determined for up to five words using process 200. This can be desirable for enabling the generation of predictive text that includes a sequence of up to five words.

In some examples, additional language models can be used to determine a weighted probability of the first predicted text given the text input. Additional language models enable the use of additional statistical or contextual information for determining weighted probability of the first predicted text given the text input. This can be desirable for achieving greater accuracy and robustness in text prediction. For example, process 200 can include determining a second weighted probability of the first predicted text given the text input (e.g., Pw2(cider|apple)) based on the first weighted probability of the first predicted text given the text input (e.g., Pw1(cider|apple)) and a probability of the first predicted text given the text input (e.g., P(cider|apple)). In this example, the probability of the first predicted text given the text input (e.g., P(cider|apple)) can be determined using a second language model. The second language model can be any suitable language model. In one example, the second language model can be a general language model. In another example, the second language model can be a static language model. In a specific example, the first language model can be a dynamic user language model while the second language model can be a static general language model. Determining the second weighted probability of the first predicted text given the text input (e.g., Pw2(cider|apple)) can include applying a third weighting factor (e.g., λ3) to the first weighted probability of the first predicted text given the text input (e.g., Pw1(cider|apple)) and applying a fourth weighting factor (e.g., λ4) to the probability of the first predicted text given the text input (e.g., P(cider|apple)). In particular, the second weighted probability of the first predicted text given the text input can be determined as follows: Pw2(cider|apple)=λ3Pw1(cider|apple)+λ4P(cider|apple).
In examples where the language model is a dynamic language model, process 200 can further include updating the language model using the text input of block 202. In some examples, process 200 can include updating the language model using the text input of block 202 and the predicted text of block 208. Further, the input context can be used to update the language model. In an example where the input context is associated with “messaging, spouse”, the text input and predicted text of “apple cider” can be used to update the sub-model 110 of language model 100. Further, in some examples, only certain text is used to update the model. For example, only text that is accepted by the user can be used to update the model. In one example, text that is transmitted, sent, published, or posted via an application of the user device (e.g., email, messenger, chat, social media, etc.) can be considered to be accepted by the user.
Although in the above examples the language model can be an n-gram statistical language model having a hierarchical context tree structure (e.g., language model 100), it should be recognized that various other language models can be suitable for implementing process 200. For example, the language model can be a neural network based language model that is trained using a corpus. The corpus can include multiple subsets where each subset is associated with a specific context. The neural network based language model can be configured to receive an input that includes the m-gram and the input context and output a frequency of occurrence of the m-gram with respect to a first subset of the corpus and a first weighting factor to apply to the frequency of occurrence of the m-gram.
FIG. 3 illustrates another exemplary process 300 for predictive text input according to various examples. In some examples, process 300 can be implemented by a user device (e.g., user device 500, described below). In some examples, the user device can be part of a server-client system (e.g., system 600, described below) and process 300 can be implemented by the server-client system.
At block 302 of process 300, a first text input can be received. The first text input can be associated with a first input context. Block 302 can be similar or identical to block 202 described above.
At block 304 of process 300, a first weighted probability of a predicted text given the first text input can be determined using a language model and based on the first input context. The first weighted probability can be determined in a similar or identical manner as described above with respect to blocks 204 through 208.
At block 306 of process 300, a second text input can be received. In some examples, the second text input can be received after the first text input is received. The second text input can be associated with a second input context. The first text input can be identical to the second text input. However, the first input context can be different from the second input context. Block 306 can be similar or identical to block 202 described above.
At block 308 of process 300, a second weighted probability of the predicted text given the second text input can be determined using the language model and based on the second input context. The second weighted probability can be determined in a similar or identical manner as described above with respect to blocks 204 through 208.
The language model can take into account the differences in the first input context and the second input context in determining the first weighted probability and the second weighted probability, respectively. For example, different weighting factors can be determined at block 206 due to differences in the first input context and the second input context. Further, in some examples, different sub-models of the language model can be used to determine the second weighted probability at block 308 compared to the first weighted probability at block 304. Therefore, although the first input text and the second input text are identical, the first weighted probability can be different from the second weighted probability due to different sub-models being used to determine the frequency of occurrence of an m-gram or different weighting factors being determined.
3. Predictive Text Input Using Physical Context
FIG. 4 illustrates exemplary process 400 for predictive text input using physical context according to various examples. In process 400, physical context information can be used to improve the accuracy of a predicted text given a text input such that the predicted text is more likely to include the user's intent. In some examples, process 400 can be implemented by a user device (e.g., user device 500, described below). In some examples, the user device can be part of a server-client system (e.g., system 600, described below) and process 400 can be implemented by the server-client system.
At block 402 of process 400, a text input can be received. Block 402 can be similar or identical to block 202 of process 200 described above.
At block 404 of process 400, a physical context associated with the text input can be determined. As described above, the physical context can refer to an environment, a situation, or a circumstance associated with the user at the time the text input is received. In some examples, the physical context can include a time, a location, a weather condition, a speed of travel, a noise level, a brightness level, or the like. The physical context can also include a situation or circumstance such as, traveling on a vehicle (e.g., car, bus, subway, airplane, boat, etc.), engaging in a particular activity (e.g., sports, hobby, shopping, etc.), or attending a particular event (e.g., dinner, conference, show, etc.).
In some examples, the physical context can be determined using a sensor of the user device. For example, the physical context can be determine in a similar or identical manner as determining the input context using a sensor of the user device at block 202 of process 200, described above.
In other examples, the physical context can be determined using data obtained from an application of the user device. The data can be obtained from any suitable application of the user device. For example, the physical context can be determined using the entries of the calendar application and the time of the clock application. In a specific example, it can be determined using the clock application and the calendar application that the text input is received while the user is attending a work meeting. According, the physical context associated with the text input can be determined to be the situation of attending a work meeting.
In other examples, the physical context can be determined to be a particular time period. The time period can be determined from data obtained from a clock application, a calendar application, or a weather application. In one example, the physical context can include a convenient time period for the user to schedule an outdoor activity. In this example, the convenient time period can be determined using the current time from the clock application, the user's schedule from the calendar application, and the weather forecast using the weather application.
At block 406 of process 400, a first weighted probability of a predicted text given the text input can be determined using a first language model and the physical context. The first language model can be any suitable language model for determining a probability of a predicted text given the text input. The first language model can be a general language model or a user language model. In an example where the first language model is a user language model, the first language model can be built from a corpus that includes a collection of user input text received prior to receiving the text input at block 302. In some examples, the first language model can be a static language model or a dynamic language model. In an example where the first language model is a dynamic language model, the first language model can be updating using the received text input.
In some examples, the first weighted probability of the predicted text given the text input can be determined based on a first probability of the predicted text given the text input and a first weighting factor. Block 406 can include determining, using the first language model, the first probability of the predicted text given the text input. Further, block 406 can include determining the first weighting factor based on the physical context. For example, if the physical context includes the situation of traveling in Paris and the text input includes the phrase, “I'm having fun at the”, the first weighting factor can be determined to be higher for a predicted text that is associated with Paris (e.g., Eiffel tower, Louvre, or Notre Dame) and lower for a predicted text associated with San Francisco (e.g., Union Square, Pier 39, or Alcatraz). The first weighting factor can be apply to the first probability of the predicted text given the text input to obtained the first weighted probability of a predicted text given the text input.
In some examples, the first language model can be a class-based language model that includes a class and a first sub-model. The first sub-model can be associated with the physical context. Block 406 can include determining, using the first language model, a probability of a class given the input text (e.g., P(class|text input)). Block 406 can further include determining, using the first sub-model, a first probability of the predicted text given the class (e.g., P1(predicted text|class)). The first weighted probability of the predicted text given the text input (e.g., Pw1(predicted text|text input) can be determined based on the probability of the class given the input text (e.g., P(class|text input)) and the first probability of the predicted text given the class (e.g., P1(predicted text|class)). For example, the first weighted probability of the predicted text given the text input can be determined as follows:

Pw1(predicted text|text input)=P(class|text input)P1(predicted text|class)

In some example, the first language model can include a second sub-model. The second sub-model can be associated with a context that is different from that of the first sub-model. For example, the second sub-model can be associated with a general context. The second sub-model can be built from a corpus that is different from that of the first sub-model. Block 406 can further include determining, using the second sub-model, a second probability of the predicted text given the class (e.g., P2(predicted text|class)). The first weighted probability of the predicted text given the text input can be determined based on the second probability of the predicted text given the class. In one example, the first weighted probability of the predicted text given the text input can be based on a linear combination of the first probability of the predicted text given the class and second probability of the predicted text given the class. In particular:

Pw1(predicted text|text input) =P(class|text input){λ1P1(predicted text|class) +λ2P2(predicted text|class)}

where λ1 and λ2 are weighting factors.

It should be recognized that the first language model can include any number of sub-models. For instance, in some examples, the first language model can include n sub-models, where n is a positive integer. In these examples, the first weighted probability of the predicted text given the text input can be determined as follows:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        
          predicted
          ⁢
          
            
          
          ⁢
          text
        
        |
        
          text
          ⁢
          
            
          
          ⁢
          input
        
      
      )
    
  
  =
  
    
      P
      ⁡
      
        (
        
          class
          |
          
            text
            ⁢
            
              
            
            ⁢
            input
          
        
        )
      
    
    ⁢
    
      
        ∑
        
          i
          =
          1
        
        n
      
      ⁢
      
        
      
      ⁢
      
        
          λ
          i
        
        ⁢
        
          
            P
            i
          
          (
          
            
              predicted
              ⁢
              
                
              
              ⁢
              text
            
            |
            class
          
          )
        
      
    
  




Further, it should be recognized that, in some example, the first language model can include multiple classes. In these examples, the first weighted probability of the predicted text given the text input can be determined based on the combined probabilities across the multiple classes. For example:




  
    
      P
      
        w
        ⁢
        
          
        
        ⁢
        1
      
    
    ⁡
    
      (
      
        
          predicted
          ⁢
          
            
          
          ⁢
          text
        
        |
        
          text
          ⁢
          
            
          
          ⁢
          input
        
      
      )
    
  
  =
  
    
      ∑
      
        class
        ∈
        L
      
    
    ⁢
    
      [
      
        
          P
          ⁡
          
            (
            
              class
              |
              
                text
                ⁢
                
                  
                
                ⁢
                input
              
            
            )
          
        
        ⁢
        
          
            ∑
            
              i
              =
              1
            
            n
          
          ⁢
          
            
          
          ⁢
          
            
              λ
              i
            
            ⁢
            
              
                P
                i
              
              (
              
                
                  predicted
                  ⁢
                  
                    
                  
                  ⁢
                  text
                
                |
                class
              
              )
            
          
        
      
      ]
    
  




where L denotes the first language model and

P(class|text input)P1(predicted text|class) is summed over all classes in the first language model, L.

In some examples, the first language model can be an n-gram statistical language model. In particular, the first language model can be an n-gram statistical language model having a hierarchical context tree structure (e.g., language model 100, described above). In these examples, the first language model can be built from a corpus that includes a plurality of subsets where each subset is associated with a context. Further, the first language model can include a hierarchical level representing physical context where the sub-models in the hierarchical level can each be associated with a specific physical context. In these examples, the first weighted probability of the predicted text given the text input can be determined using similar or identical methods described above with respect to blocks 204 through 208 of process 200. For example, block 406 can include determining, using the first language model, a first frequency of occurrence of an m-gram with respect to a first subset of the plurality of subsets. The first subset can be associated with a first context and the m-gram can include at least one word in the text input and at least one word in the predicted text. In addition, block 406 can include determining, based on a degree of matching between the physical context and the first context, a first weighting factor to apply to the first frequency of occurrence of the m-gram. The first weighting factor can be determined to be higher if the first context is more similar to the physical context. Conversely, the first weighting factor can be determined to be lower if the first context is less similar to the physical context. The first weighted probability of the predicted text given the text input can be based on the first frequency of occurrence of the m-gram and the first weighting factor.
It should be recognized that the first weighted probability of the predicted text given the text input can be based on any number of frequencies of occurrence of the m-gram and a respective number of weighting factors. For example, the first weighted probability of the predicted text given the text input can also be based on a second frequency of occurrence of the m-gram and a third weighting factor. In such an example, block 406 can further include determining, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the plurality of subsets. The second subset can be associated with a second context. Block 406 can further include determining a third weighting factor to apply to the second frequency of occurrence of the m-gram based on a degree of matching between the input context and the second context.
In yet other examples, the first language model can be a context-specific language model that is associated with the physical context. In these examples, the physical context can be used to select the first language model among a plurality of context-specific language models. The selected first language model can thus be used to determine the first weighted probability of the predicted text given the text input. In some cases, no weighting is performed in determining the first weighted probability of the predicted text given the text input. For example, the probability of the predicted text given the text input can be determined from the first language model and first weighted probability of the predicted text given the text input can equal the determined probability of the predicted text given the text input.
At block 408 of process 400, the predicted text can be presented via a user interface of the electronic device. Block 408 can be similar or identical to block 210 of process 200 described above.
Although process 400 is described above with reference to blocks 402 through 408, it should be appreciated that in some cases, one or more blocks of process 400 can be optional and additional blocks can also be performed. For instance, in examples where the first language model is a dynamic language model, process 400 can include updating the first language model using the received text input at block 402.
Further, in some examples, additional language models can be used to determine a second weighted probability of the predicted text given the text input. Using additional language models can be desirable for achieving greater accuracy in predicting text. In these examples, process 400 can include determining, using a second language model, a third probability of the predicted text given the text input. In addition, a second weighted probability of the predicted text given the text input can be determined based on the first weighted probability and the third probability. In some examples, determining the second weighted probability can include applying a third weighting factor to the first weighted probability and applying a fourth weighting factor to the third probability. For example, Pw2(predicted text|text input)=λ3Pw1(predicted text|text input)+λ4P3(predicted text|text input), where Pw2(predicted text|text input) denotes the second weighted probability of the predicted text given the text input, Pw1(predicted text|text input) denotes the first weighted probability of the predicted text given the text input, P3(predicted text|text input) denotes the third probability of the predicted text given the text input, λ3 denotes the third weighting factor, and λ4 denotes the fourth weighting factor.
3. User Device for Predictive Text Input
FIG. 5 is a block diagram of user device 500 for carrying out various aspects of predictive text input according to various examples. User device 500 can be any electronic device that is configured to receive a text input. For example, user device 500 can include a cellular telephone (e.g., smartphone), tablet computer, laptop computer, desktop computer, portable media player, wearable digital device (e.g., digital glasses, wristband, wristwatch, brooch, armbands, etc.), television, set top box (e.g., cable box, video player, video streaming device, etc.), gaming system, or the like. As shown in FIG. 5, user device 500 can include a memory interface 502, one or more processors 504, and a peripherals interface 506. The various components in user device 500 can be together coupled by one or more communication buses or signal lines. User device 500 can further include various sensors, subsystems, and peripheral devices that are coupled to peripherals interface 506. The sensors, subsystems, and peripheral devices gather information and/or facilitate various functionalities of user device 500.
In some examples, user device 500 can include a motion sensor 510, a light sensor 512 (e.g., a brightness sensor), and a proximity sensor 514 coupled to peripherals interface 506 to facilitate orientation, light, and proximity sensing functions. One or more other sensors 516, such as a positioning system (e.g., a GPS receiver), a temperature sensor, a biometric sensor, a gyroscope, a compass, an accelerometer (e.g., a motion sensor), and the like, are also connected to peripherals interface 506 to facilitate related functionalities. Further, the various sensors of user device 500 described above can be used to determine an input context at block 202 of process 200 or a physical context at block 404 of process 400.
In some examples, a camera subsystem 520 and an optical sensor 522 (e.g., an image sensor or brightness sensor) can be utilized to facilitate camera functions, such as taking photographs and recording video clips. Communication functions can be facilitated through one or more wired and/or wireless communication subsystems 524, which can include various communication ports, radio frequency receivers and transmitters, and/or optical (e.g., infrared) receivers and transmitters. An audio subsystem 526 can be coupled to speakers 528 and a microphone 530 to facilitate audio-enabled functions, such as voice recognition, music recognition, voice replication, digital recording, telephony functions, and speech-to-text conversion. In one example, the text input at block 202, 302, and 402 described above can be received by means of speech-to-text conversion facilitated by microphone 530. Optical sensor 522 and microphone 530 can be used to determine an input context at block 202 of process 200 or a physical context at block 404 of process 400.
In some examples, user device 500 can further include an I/O subsystem 540 coupled to peripherals interface 506. I/O subsystem 540 can include a touch screen controller 542 and/or other input controller(s) 544. Touch-screen controller 542 can be coupled to a touch screen 546. Touch screen 546 and the touch screen controller 542 can, for example, detect contact and movement or a break thereof using any of a plurality of touch sensitivity technologies, such as capacitive, resistive, infrared, surface acoustic wave technologies, proximity sensor arrays, and the like. Other input controller(s) 544 can be coupled to other input/control devices 548, such as one or more buttons, rocker switches, a thumb-wheel, an infrared port, a USB port, and/or a pointer device such as a stylus. In some examples, a signal to begin receiving an audio input can be received by user device 500 via input to touch screen 546 (e.g., a virtual button) or other input/control devices 548. The text input at blocks 202, 302, and 402 can be received via touch screen 546 and/or other input/control devices 548.
In some examples, user device 500 can further include a memory interface 502 coupled to memory 550. Memory 550 can include any electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, a portable computer diskette (magnetic), a random access memory (RAM) (magnetic), a read-only memory (ROM) (magnetic), an erasable programmable read-only memory (EPROM) (magnetic), a portable optical disc such as CD, CD-R, CD-RW, DVD, DVD-R, or DVD-RW, or flash memory such as compact flash cards, secured digital cards, USB memory devices, memory sticks, and the like. In some examples, a non-transitory computer-readable storage medium of memory 550 can be used to store instructions (e.g., for performing processes 200, 300, or 400, described above) for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. In other examples, the instructions (e.g., for performing processes 200, 300, or 400, described above) can be stored on a non-transitory computer-readable storage medium of server system 610 described below, or can be divided between the non-transitory computer-readable storage medium of memory 550 and the non-transitory computer-readable storage medium of server system 610.
In some examples, memory 550 can store an operating system 552, a communication module 554, a graphical user interface module 556, a sensor processing module 558, a phone module 560, and applications 562. Operating system 552 can include instructions for handling basic system services and for performing hardware dependent tasks. Communication module 554 can facilitate communicating with one or more additional devices, one or more computers, and/or one or more servers. Graphical user interface module 556 can facilitate graphic user interface processing. Sensor processing module 558 can facilitate sensor related processing and functions. Phone module 560 can facilitate phone-related processes and functions. Applications module 562 can facilitate various functionalities of user applications, such as electronic-messaging, web browsing, media processing, navigation, imaging, virtual assistant functions, and/or other processes and functions.
As described herein, memory 550 can also store predictive text input module 564 and various user data and models 566 to provide the client-side functionalities of the virtual assistant. The predictive text input module 564 can include modules, instructions, and programs for performing various aspects of processes 200, 300, or 400 described above. User data and models 566 can include various language models described above with respect to processes 200, 300, or 400 that are used for predictive text input. For example, user data and models 566 can include user language models built using a corpus that includes a collection of user text.
In various examples, memory 550 can include additional instructions or fewer instructions. Furthermore, various functions of user device 500 can be implemented in hardware and/or in firmware, including in one or more signal processing and/or application specific integrated circuits. Further, processes for predictive text input described above can be implemented as a stand-alone application installed on user device 500. Alternatively, processes for predictive text input can be implemented according to a client-server model as described below with reference to FIG. 6.
5. System for Predictive Text Input
FIG. 6 illustrates exemplary client-server system 600 for carrying out various aspects of predictive text input according to various examples. System 600 can include a client-side portion executed on user device 500 and a server-side portion executed on server system 610. User device 500 can communicate with server system 610 through one or more networks 608, which can include the Internet, an intranet, or any other wired or wireless public or private network. The client-side portion executed on user device 500 can provide client-side functionalities, such as user-facing input and output processing and communications with server system 610. Server system 610 can provide server-side functionalities for any number of clients residing on a respective user device 500.
As shown in FIG. 6, server system 610 can include memory 628, one or more processors 626, client-facing I/O interface 622, and I/O interface to external services 616. The various components of server system 610 can be coupled together by one or more communication buses or signal lines. Memory 628, or the computer-readable storage media of memory 628, can include one or more processing modules 618 and user data and model storage 620. The one or more processing modules 618 can include various programs and instructions. The one or more processors 626 can execute the programs and instructions of the one or more processing modules 618 and read/write to/from user data and model storage 620. In the context of this document, a “non-transitory computer-readable storage medium” can be any medium that can contain or store the program for use by or in connection with the instruction execution system, apparatus, or device.
In some examples, the one or more processing modules 618 can include various programs and instructions for performing various aspects of processes 200, 300, or 400 described above. In particular, the one or more processing modules 618 can include a predictive text input module for performing various aspects of processes 200, 300, or 400 described above. User data and models 620 can include various user data and models that can be accessed or referenced when performing various aspects of predictive text input. For example, user data and models 620 can include various language models used for predictive text input described above with reference to processes 200, 300, or 400. Further user data can include various user application data that can be used to determine an input context or a physical context associated with a received text input.
In some examples, system server 610 can communicate with external services 624, such as telephony services, calendar services, information services, messaging services, navigation services, and the like, through network(s) 608. In some examples, external services can provide relevant application data for determining input context or physical context associated with a received text input. Further, in some examples, system server 610 can access one or more language models stored on external services 624 for performing predictive text input. The I/O interface to external services 616 can facilitate communications between system server 610 and external services 624.
Server system 610 can be implemented on one or more stand-alone data processing devices or a distributed network of computers. In some examples, server system 610 can employ various virtual devices and/or services of third-party service providers (e.g., third-party cloud service providers) to provide the underlying computing resources and/or infrastructure resources of server system 610.
The division of functionalities between the client and server portions of the virtual assistant can vary in different examples. For instance, in some examples, one or more processing modules 618 and user data and models 620 can be stored in the memory of user device 500 to enable the user device to perform a greater proportion or all of the functionalities associated with predictive text input. In other examples, the client executed on user device 500 can be a thin-client that provides only user-facing input and output processing functions, and delegates all other functionalities of predictive text input to a back-end server.
6. Electronic Device
FIG. 7 shows a functional block diagram of an electronic device 700 configured in accordance with the principles of the various described examples. The functional blocks of the device can be, optionally, implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 7 can be, optionally, combined or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination, separation, or further definition of the functional blocks described herein.
As shown in FIG. 7, electronic device 700 can include touch screen display unit 702 configured to display a user interface for receiving text input and to receive touch input, and text receiving unit 704 configured to receive text input. In some examples, electronic device 700 can include sensor unit 706 that is configured to sense a physical context. Sensor unit 706 can include any sensor for sensing a physical context, such as, for example, a microphone, an image sensor, a brightness sensor, a motion sensor, a GPS sensor, and the like. Electronic device 700 can further include processing unit 710 coupled to touch screen display unit 702 and text receiving unit 704 (and, optionally, coupled to sensor unit 706). In some examples, processing unit 710 can include receiving unit 712, frequency of occurrence determining unit 714, weighting factor determining unit 716, weighted probability determining unit 718, probability determining unit 720, language model updating unit 722, and presenting unit 724.
Processing unit 710 can be configured to receive a text input (e.g., from text receiving unit 704 and using receiving unit 712). The text input can be associated with an input context. Processing unit 710 can be configured to determine, using a first language model, a first frequency of occurrence of an m-gram with respect to a first subset of a corpus (e.g., using frequency of occurrence determining unit 714). The first subset can be associated with a first context and the m-gram can include at least one word in the text input. Processing unit 710 can be configured to determining (e.g., using weighting factor determining unit 716), based on a degree of similarity between the input context and the first context, a first weighting factor to apply to the first frequency of occurrence of the m-gram. Processing unit 710 can be configured to determining (e.g., using weighted probability determining unit 718), based on the first frequency of occurrence of the m-gram and the first weighting factor, a first weighted probability of a first predicted text given the text input. The m-gram can include at least one word in the first predicted text.
In some examples, processing unit 710 can be configured to determine, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the corpus (e.g., using frequency of occurrence determining unit 714). The second subset can be associated with a second context. Processing unit 710 can be configured to determine (e.g., using weighting factor determining unit 716), based on a degree of similarity between the input context and the second context, a second weighting factor to apply to the second frequency of occurrence of the m-gram. Processing unit 710 can be configured to determine the first weighted probability of the first predicted text given the text input (e.g., using weighted probability determining unit 718) based on the second frequency of occurrence of the m-gram and the second weighting factor.
In some examples, the first context and the second context can be different, and the first weighting factor and the second weighting factor can be different.
In some examples, processing unit 710 can be configured to determine, using the first language model, a first frequency of occurrence of an (m−1)-gram with respect to the first subset of the corpus (e.g., using frequency of occurrence determining unit 714). The m-gram can include one or more words in the (m−1)-gram. Processing unit 710 can be configured to determine the first weighted probability of the first predicted text given the text input (e.g., using weighted probability determining unit 718) based on a first weighted frequency of occurrence of the (m−1)-gram. The first weighting factor can be applied to the first frequency of occurrence of the (m−1)-gram to obtain the first weighted frequency of occurrence of the (m−1)-gram.
In some examples, the first language model can be a user language model that is built from the corpus and the corpus can include a collection of user input text received prior to receiving the text input.
In some examples, processing unit 710 can be configured to update (e.g., using language model updating unit 722) the first language model using the text input.
In some examples, processing unit 710 can be configured to determine, using a second language model, a probability of the first predicted text given the text input (e.g., using probability determining unit 720). Processing unit 710 can be configured to determine (e.g., using weighted probability determining unit 718) a second weighted probability of the first predicted text given the text input based on the first weighted probability of the first predicted text given the text input and the probability of the first predicted text given the text input.
In some examples, processing unit 710 can be configured to apply a third weighting factor to the first weighted probability of the first predicted text given the text input and apply a fourth weighting factor to the probability of the first predicted text given the text input (e.g., using weighted probability determining unit 718) to determine the second weighted probability of the first predicted text given the text input.
In some examples, the first language model can be built from the corpus. The corpus can include a plurality of subsets where each subset can be associated with a context of a plurality of contexts. Each context of the plurality of contexts can be represented by one or more hierarchical context tags of the first language model.
In some examples, the first language model can include a plurality of n-grams including the m-gram where each n-gram of the plurality of n-grams can be associated with one or more hierarchical context tags and a frequency of occurrence of the n-gram with respect to a subset of the corpus.
In some examples, the first language model can include a plurality of sub-models arranged in a hierarchical context tree where each sub-model can be associated with a specific context.
In some examples, the first weighted probability of the first predicted text given the text input can be greater than a predetermined threshold. Processing unit 710 can be configured to determine, using the first language model, a frequency of occurrence of an (m+1)-gram with respect to the first subset of the corpus (e.g., using frequency of occurrence determining unit 714 ). The (m+1)-gram can include one or more words in the m-gram. Processing unit 710 can be configured to determine (e.g., using weighted probability determining unit 718), based on the frequency of occurrence of the (m+1)-gram and the first weighting factor, a weighted probability of a second predicted text given the text input and the first predicted text. The (m+1)-gram can include at least one word in the second predicted text.
In some examples, the first context can include a first application of the electronic device and the first subset can include a collection of user text that is associated with the first application.
In some examples, the first context can include a first recipient and the first subset can include a collection of user text that is directed to the first recipient. In some examples, the first context can include a physical context determined using a sensor of the electronic device (e.g., sensor unit 706). The first subset can include a collection of user text that is associated with the physical context.
In some examples, the first context can include a time period or a location and the first subset can include a collection of user text that is associated with the time period or the location.
In some examples, the first context can include an environment, a situation, or a circumstance and the first subset can include a collection of user text that is associated with the environment, the situation, or the circumstance.
In some examples, the text input can be associated with a second application of the electronic device and the input context can include the second application. In some examples, the text input can be directed to a second recipient, and wherein the input context includes the second recipient. In some examples, the second recipient can be determined based on the text input and using the first language model. In some examples, the input context can be determined using a sensor of the electronic device (e.g., sensor unit 706). In some examples, the input context can be determined from data obtained from one or more applications of the electronic device.
In some examples, processing unit 710 can be configured to presenting (e.g., using presenting unit 724) the first predicted text via a user interface of the electronic device.
In some examples, processing unit 710 can be configured to receive (e.g., from text receiving unit 704 and using receiving unit 712) a first text input where the first text input can be associated with a first input context. Processing unit 710 can be configured to determine, using a language model and based on the first input context, a first weighted probability of a predicted text given the first text input (e.g., using one or more of frequency of occurrence determining unit 714, weighting factor determining unit 716, weighted probability determining unit 718, and probability determining unit 720). Processing unit 710 can be configured to receive (e.g., from text receiving unit 704 and using receiving unit 712) a second text input where the second text input can be associated with a second input context. The first text input can be identical to the second text input and the first input context can be different from the second input context. Processing unit 710 can be configured to determine, using the language model and based on the second input context, a second weighted probability of the predicted text given the second text input (e.g., using one or more of frequency of occurrence determining unit 714, weighting factor determining unit 716, weighted probability determining unit 718, and probability determining unit 720). The first weighted probability can be different from the second weighted probability. In some examples, the language model can be similar or identical to the first language model described above.
In some examples, the first text input can be associated with a first application of the electronic device and the first input context can include the first application. The second text input can be associated with a second application of the electronic device and the second input context can include the second application. The first application can be different from the second application.
In some examples, the first text input can be directed to a first recipient and the first input context can include the first recipient. The second text input can be directed to a second recipient and the second input context can include the second recipient. The first recipient can be different from the second recipient.
In some examples, the first recipient can be determined based on the first text input and using a second language model. In some examples, the first input context can be determined using a sensor of the electronic device (e.g., sensor unit 706). In some examples, the first input context can be determined using data obtained from one or more applications of the electronic device.
FIG. 8 shows a functional block diagram of an electronic device 800 configured in accordance with the principles of the various described examples. The functional blocks of the device can be, optionally, implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 8 can be, optionally, combined or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination, separation, or further definition of the functional blocks described herein.
As shown in FIG. 8, electronic device 800 can include touch screen display unit 802 configured to display a user interface for receiving text input and to receive touch input, and text receiving unit 804 configured to receive text input. In some examples, electronic device 800 can include sensor unit 806 that is configured to sense a physical context. Sensor unit 806 can include any sensor for sensing a physical context, such as, for example, a microphone, an image sensor, a brightness sensor, a motion sensor, a GPS sensor, and the like. Electronic device 800 can further include processing unit 810 coupled to touch screen display unit 802 and text receiving unit 804 (and, optionally, coupled to sensor unit 806). In some examples, processing unit 810 can include receiving unit 812, physical context determining unit 814, frequency of occurrence determining unit 816, weighting factor determining unit 818, weighted probability determining unit 820, probability determining unit 822, language model updating unit 824, and presenting unit 826.
Processing unit 810 can be configured to receive a text input (e.g., from text receiving unit 804 and using receiving unit 812). Processing unit 810 can be configured to determine (e.g., using physical context determining unit 814) a physical context associated with the text input. Processing unit 810 can be configured to determine, using a first language model and the physical context, a first weighted probability of a predicted text given the text input (e.g., using one or more of frequency of occurrence determining unit 816, weighting factor determining unit 818, weighted probability determining unit 820, and probability determining unit 822). Processing unit 810 can be configured to present (e.g., using presenting unit 826) the predicted text via a user interface of the electronic device.
In some examples, the physical context can be determined using a sensor of the electronic device (e.g., sensor unit 806). In some examples, the physical context can be determined using data obtained from an application of the electronic device.
In some examples, processing unit 810 can be configured to determine, using the first language model, a first probability of the predicted text given the text input (e.g., using probability determining unit 822). Processing unit 810 can be configured to determine (e.g., using weighting factor determining unit 818), based on the physical context, a first weighting factor to apply to the first probability of the predicted text given the text input. Processing unit 810 can be configured to determine (e.g., using weighted probability determining unit 820) the first weighted probability of the predicted text given the text input based on the first probability of the predicted text given the text input and the first weighting factor.
In some examples, the first language model can be a class-based language model that includes a first sub-model. The first sub-model can be associated with the physical context. Processing unit 810 can be configured to determine, using the first language model, a probability of a class given the input text (e.g., using probability determining unit 822). Processing unit 810 can be configured to determine, using the first sub-model, a first probability of the predicted text given the class (e.g., using probability determining unit 822). The first weighted probability of the predicted text given the text input can be determined based on the probability of the class given the input text and the first probability of the predicted text given the class. In some examples, the first language model can include a second sub-model. The second sub-model can be associated with a general context. Processing unit 810 can be configured to determine, using the second sub-model, a second probability of the predicted text given the class (e.g., using probability determining unit 822). The first weighted probability of the predicted text given the text input can be determined based on the first probability of the predicted text given the class.
In some examples, the first language model can be a general language model. In some examples, the first language model can be a user language model that is built from a corpus where the corpus can include a collection of user input text received prior to receiving the text input. In some examples, processing unit 810 can be configured to update (e.g., using language model updating unit 824) the first language model using the text input and the predicted text.
In some examples, the physical context can include a time period. In some examples, the time period can be determined from data obtained from an application of the electronic device. The application can be one of a clock application, a scheduler application, and a weather application.
In some examples, the physical context can include an environment, a situation, or a circumstance experienced by a user of the electronic device when the text input is received. In some examples, the environment, the situation, or the circumstance can be determined using a microphone of the electronic device (e.g., sensor unit 806). In some examples, the environment, the situation, or the circumstance can be determined using a light sensor or an image sensor of the electronic device (e.g., sensor unit 806). In some examples, the environment, the situation, or the circumstance can be determined using a motion sensor of the electronic device (e.g., sensor unit 806).
In some examples, the first language model can be built from a corpus that includes a plurality of subsets, where each subset can be associated with a context. Processing unit 810 can be configured to determine, using the first language model, a first frequency of occurrence of an m-gram with respect to a first subset of the plurality of subsets (e.g., using frequency of occurrence determining unit 816). The first subset can be associated with a first context and the m-gram can include at least one word in the text input and at least one word in the predicted text. Processing unit 810 can be configured to determine (e.g., using weighting factor determining unit 818), based on a degree of similarity between the physical context and the first context, a first weighting factor to apply to the first frequency of occurrence of the m-gram. The first weighted probability can be based on the first frequency of occurrence of the m-gram and the first weighting factor.
In some examples, processing unit 810 can be configured to determine, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the plurality of subsets (e.g., using frequency of occurrence determining unit 816). The second subset can be associated with a second context. Processing unit 810 can be configured to determine, based on a degree of similarity between the input context and the second context, a third weighting factor to apply to the second frequency of occurrence of the m-gram (e.g., using frequency of occurrence determining unit 816). The first weighted probability of the predicted text given the text input can be determined based on the second frequency of occurrence of the m-gram and the third weighting factor.
In some examples, processing unit 810 can be configured to determine, using a second language model, a third probability of the predicted text given the text input (e.g., using probability determining unit 822). Processing unit 810 can be configured to determine (e.g., using weighted probability determining unit 820) a second weighted probability of the predicted text given the text input based on the first weighted probability and the third probability. In some examples, processing unit 810 can be configured to apply a third weighting factor to the first weighted probability and apply a fourth weighting factor to the third probability (e.g., using weighted probability determining unit 820) to determine the second weighted probability. In some examples, the first language model can be a user language model and the second language model can be a general language model.
Although examples have been fully described with reference to the accompanying drawings, it is to be noted that various changes and modifications will become apparent to those skilled in the art. Such changes and modifications are to be understood as being included within the scope of the various examples as defined by the appended claims.
In some cases, the systems, processes, and devices described above can include the gathering and use of data available from various sources to improve the delivery to users of invitational content or any other content that may be of interest to them. The present disclosure contemplates that in some instances, this gathered data may include personal information data that uniquely identifies or can be used to contact or locate a specific person. Such personal information data can include demographic data, location-based data, telephone numbers, email addresses, home addresses, or any other identifying information.
The present disclosure recognizes that the use of such personal information data in connection with the systems, processes, and devices described above, can be used to the benefit of users. For example, the personal information data can be used to deliver targeted content that is of greater interest to the user. Accordingly, use of such personal information data enables calculated control of the delivered content. Further, other uses for personal information data that benefit the user are also contemplated by the present disclosure.
The present disclosure further contemplates that the entities responsible for the collection, analysis, disclosure, transfer, storage, or other use of such personal information data will comply with well-established privacy policies and/or privacy practices. In particular, such entities should implement and consistently use privacy policies and practices that are generally recognized as meeting or exceeding industry or governmental requirements for maintaining personal information data private and secure. For example, personal information from users should be collected for legitimate and reasonable uses of the entity and not shared or sold outside of those legitimate uses. Further, such collection should occur only after receiving the informed consent of the users. Additionally, such entities would take any needed steps for safeguarding and securing access to such personal information data and ensuring that others with access to the personal information data adhere to their privacy policies and procedures. Further, such entities can subject themselves to evaluation by third parties to certify their adherence to widely accepted privacy policies and practices.
Despite the foregoing, the present disclosure also contemplates examples in which users selectively block the use of, or access to, personal information data. That is, the present disclosure contemplates that hardware and/or software elements can be provided to prevent or block access to such personal information data. For example, in the case of advertisement delivery services, the systems and devices described above can be configured to allow users to select to “opt in” or “opt out” of participation in the collection of personal information data during registration for services. In another example, users can select not to provide location information for targeted content delivery services. In yet another example, users can select to not provide precise location information, but permit the transfer of location zone information.
Therefore, although the present disclosure broadly covers use of personal information data to implement one or more various disclosed examples, the present disclosure also contemplates that the various examples can also be implemented without the need for accessing such personal information data. That is, the various examples disclosed herein are not rendered inoperable due to the lack of all or a portion of such personal information data. For example, content can be selected and delivered to users by inferring preferences based on non-personal information data or a bare minimum amount of personal information, such as the content being requested by the device associated with a user, other non-personal information available to the content delivery services, or publicly available information.

## Claims

1. A method for text prediction comprising:
at an electronic device:
receiving a text input, the text input associated with an input context;
determining, using a first language model, a first frequency of occurrence of an m-gram with respect to a first subset of a corpus, wherein the first subset is associated with a first context, and wherein the m-gram includes at least one word in the text input;
determining, based on a degree of similarity between the input context and the first context, a first weighting factor, wherein a weighted first frequency of occurrence of the m-gram is obtained by applying the first weighting factor to the first frequency of occurrence of the m-gram;
determining, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the corpus, wherein the second subset is associated with a second context;
determining, based on a degree of similarity between the input context and the second context, a second weighting factor, wherein a weighted second frequency of occurrence of the m-gram is obtained by applying the second weighting factor to the second frequency of occurrence of the m-gram; and
determining, based on the weighted first frequency of occurrence of the m-gram and the weighted second frequency of occurrence of the m-gram, a first weighted probability of a first predicted text given the text input, wherein the m-gram includes at least one word in the first predicted text.

2. The method of claim 1, further comprising:
determining, using the first language model, a first frequency of occurrence of an (m−1)-gram with respect to the first subset of the corpus, wherein:
the m-gram includes one or more words in the (m−1)-gram;
the first weighted probability of the first predicted text given the text input is determined based on a first weighted frequency of occurrence of the (m−1)-gram; and
the first weighting factor is applied to the first frequency of occurrence of the (m−1)-gram to obtain the first weighted frequency of occurrence of the (m−1)-gram.

3. The method of claim 1, wherein the first language model is a user language model that is built from the corpus, and wherein the corpus includes a collection of user input text received prior to receiving the text input.

4. The method of claim 1, further comprising updating the first language model using the text input.

5. The method of claim 1, further comprising:
determining, using a second language model, a probability of the first predicted text given the text input;
determining a second weighted probability of the first predicted text given the text input based on the first weighted probability of the first predicted text given the text input and the probability of the first predicted text given the text input.

6. The method of claim 5, wherein determining the second weighted probability of the first predicted text given the text input includes:
applying a third weighting factor to the first weighted probability of the first predicted text given the text input; and
applying a fourth weighting factor to the probability of the first predicted text given the text input.

7. The method of claim 1, wherein:
the first language model is built from the corpus;
the corpus includes a plurality of subsets;
each subset is associated with a context of a plurality of contexts; and
each context of the plurality of contexts is represented by one or more hierarchical context tags of the first language model.

8. The method of claim 1, wherein the first language model comprises a plurality of n-grams including the m-gram, and wherein each n-gram of the plurality of n-grams is associated with one or more hierarchical context tags and a frequency of occurrence of the n-gram with respect to a subset of the corpus.

9. The method of claim 1, wherein the first language model includes a plurality of sub-models arranged in a hierarchical context tree, and wherein each sub-model is associated with a specific context.

10. The method of claim 1, wherein the first weighted probability of the first predicted text given the text input is greater than a predetermined threshold, and further comprising:
determining, using the first language model, a frequency of occurrence of an (m+1)-gram with respect to the first subset of the corpus, wherein the (m+1)-gram includes one or more words in the m-gram; and
determining, based on the frequency of occurrence of the (m+1)-gram and the first weighting factor, a weighted probability of a second predicted text given the text input and the first predicted text, wherein the (m+1)-gram includes at least one word in the second predicted text.

11. The method of claim 1, wherein the first context includes a first application of the electronic device, and wherein the first subset includes a collection of user text that is associated with the first application.

12. The method of claim 1, wherein the first context includes a first recipient, and wherein the first subset includes a collection of user text that is directed to the first recipient.

13. The method of claim 1, wherein the first context includes a physical context determined using a sensor of the electronic device, and wherein the first subset includes a collection of user text that is associated with the physical context.

14. The method of claim 1, wherein the first context includes a time period or a location, and wherein the first subset includes a collection of user text that is associated with the time period or the location.

15. The method of claim 1, wherein the text input is associated with a second application of the electronic device, and wherein the input context includes the second application.

16. The method of claim 1, wherein the text input is directed to a second recipient, and wherein the input context includes the second recipient.

17. The method of claim 16, wherein the second recipient is determined based on the text input and using the first language model.

18. The method of claim 1, wherein the input context is determined using a sensor of the electronic device.

19. The method of claim 1, wherein the input context is determined from data obtained from one or more applications of the electronic device.

20. The method of claim 1, further comprising:
presenting, based on the first weighted probability of the first predicted text given the text input, the first predicted text via a user interface of the electronic device.

21. The method of claim 1, wherein the first language model comprises a plurality of sub-models, each sub-model corresponding to a respective subset of a plurality of subsets of the corpus, and each subset of the plurality of subsets of the corpus corresponding to a respective context of a plurality of contexts, wherein a first sub-model of the plurality of sub-models corresponds to the first subset, and wherein the plurality of subsets includes the first subset.

22. A method for text prediction comprising:
at an electronic device:
receiving a first text input, the first text input associated with a first input context;
determining, using a language model and based on the first input context, a first weighted probability of a predicted text given the first text input;
receiving a second text input, the second text input associated with a second input context, wherein the second text input is received after the first text input is received, wherein the first text input is identical to the second text input, and wherein the first input context is different from the second input context; and
determining, using the language model and based on the second input context, a second weighted probability of the predicted text given the second text input, wherein the first weighted probability is different from the second weighted probability.

23. The method of claim 22, wherein:
the language model is built from a corpus;
the corpus includes a plurality of subsets;
each subset is associated with a context of a plurality of contexts; and
each context of the plurality of contexts is represented by one or more hierarchical tags of the language model.

24. The method of claim 22, wherein:
the first text input is associated with a first application of the electronic device and the first input context includes the first application;
the second text input is associated with a second application of the electronic device and the second input context includes the second application; and
the first application is different from the second application.

25. The method of claim 22, wherein:
the first text input is directed to a first recipient and the first input context includes the first recipient;
the second text input is directed to a second recipient and the second input context includes the second recipient; and
the first recipient is different from the second recipient.

26. The method of claim 22, further comprising:
presenting, at a first instance and via a user interface of the electronic device, the predicted text based on the first weighted probability of the predicted text given the first text input; and
presenting, at a second instance and via the user interface, the predicted text based on the second weighted probability of the predicted text given the second text input.

27. A non-transitory computer-readable storage medium comprising instructions for causing one or more processors of an electronic device to:
receive a text input, the text input associated with an input context;
determine, using a first language model, a first frequency of occurrence of an m-gram with respect to a first subset of a corpus, wherein the first subset is associated with a first context, and wherein the m-gram includes at least one word in the text input;
determine, based on a degree of similarity between the input context and the first context, a first weighting factor, wherein a weighted first frequency of occurrence of the m-gram is obtained by applying the first weighting factor to the first frequency of occurrence of the m-gram;
determine, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the corpus, wherein the second subset is associated with a second context;
determine, based on a degree of similarity between the input context and the second context, a second weighting factor, wherein a weighted second frequency of occurrence of the m-gram is obtained by applying the second weighting factor to the second frequency of occurrence of the m-gram; and
determine, based on the weighted first frequency of occurrence of the m-gram and the weighted second frequency of occurrence of the m-gram, a first weighted probability of a first predicted text given the text input, wherein the m-gram includes at least one word in the first predicted text.

28. The computer-readable storage medium of claim 27, wherein:
the first language model is built from the corpus;
the corpus includes a plurality of subsets;
each subset is associated with a context of a plurality of contexts; and
each context of the plurality of contexts is represented by one or more hierarchical context tags of the first language model.

29. The computer-readable storage medium of claim 27, wherein the first language model comprises a plurality of n-grams including the m-gram, and wherein each n-gram of the plurality of n-grams is associated with one or more hierarchical context tags and a frequency of occurrence of the n-gram with respect to a subset of the corpus.

30. The computer-readable storage medium of claim 27, wherein the first language model includes a plurality of sub-models arranged in a hierarchical context tree, and wherein each sub-model is associated with a specific context.

31. The computer-readable storage medium of claim 27, wherein the first context includes a first application of the electronic device, and wherein the first subset includes a collection of user text that is associated with the first application.

32. The computer-readable storage medium of claim 27, wherein the first context includes a first recipient, and wherein the first subset includes a collection of user text that is directed to the first recipient.

33. The computer-readable storage medium of claim 27, further comprising instructions for causing the one or more processors to:
present, via a user interface of the electronic device, the first predicted text based on the first weighted probability of the first predicted text given the text input.

34. A system comprising:
one or more processors;
memory;
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for:
receiving a text input, the text input associated with an input context;
determining, using a first language model, a first frequency of occurrence of an m-gram with respect to a first subset of a corpus, wherein the first subset is associated with a first context, and wherein the m-gram includes at least one word in the text input;
determining, based on a degree of similarity between the input context and the first context, a first weighting factor, wherein a weighted first frequency of occurrence of the m-gram is obtained by applying the first weighting factor to the first frequency of occurrence of the m-gram;
determining, using the first language model, a second frequency of occurrence of the m-gram with respect to a second subset of the corpus, wherein the second subset is associated with a second context; and
determining, based on a degree of similarity between the input context and the second context, a second weighting factor, wherein a weighted second frequency of occurrence of the m-gram is obtained by applying the second weighting factor to the second frequency of occurrence of the m-gram;
determining, based on the weighted first frequency of occurrence of the m-gram and the weighted second frequency of occurrence of the m-gram, a first weighted probability of a first predicted text given the text input, wherein the m-gram includes at least one word in the first predicted text.

35. The system of claim 34, wherein:
the first language model is built from the corpus;
the corpus includes a plurality of subsets;
each subset is associated with a context of a plurality of contexts; and
each context of the plurality of contexts is represented by one or more hierarchical context tags of the first language model.

36. The system of claim 34, wherein the first language model comprises a plurality of n-grams including the m-gram, and wherein each n-gram of the plurality of n-grams is associated with one or more hierarchical context tags and a frequency of occurrence of the n-gram with respect to a subset of the corpus.

37. The system of claim 34, wherein the first language model includes a plurality of sub-models arranged in a hierarchical context tree, and wherein each sub-model is associated with a specific context.

38. The system of claim 34, wherein the one or more programs further include instructions for:
presenting, via a user interface of the system, the first predicted text based on the first weighted probability of the first predicted text given the text input.

39. A non-transitory computer-readable storage medium comprising instructions for causing one or more processors of an electronic device to:
receive a first text input, the first text input associated with a first input context;
determine, using a language model and based on the first input context, a first weighted probability of a predicted text given the first text input;
receive a second text input, the second text input associated with a second input context, wherein the second text input is received after the first text input is received, wherein the first text input is identical to the second text input, and wherein the first input context is different from the second input context; and
determine, using the language model and based on the second input context, a second weighted probability of the predicted text given the second text input, wherein the first weighted probability is different from the second weighted probability.

40. The computer-readable storage medium of claim 39, wherein:
the language model is built from a corpus;
the corpus includes a plurality of subsets;
each subset is associated with a context of a plurality of contexts; and
each context of the plurality of contexts is represented by one or more hierarchical tags of the language model.

41. The computer-readable storage medium of claim 39, wherein:
the first text input is associated with a first application of the electronic device and the first input context includes the first application;
the second text input is associated with a second application of the electronic device and the second input context includes the second application; and
the first application is different from the second application.

42. The computer-readable storage medium of claim 39, wherein:
the first text input is directed to a first recipient and the first input context includes the first recipient;
the second text input is directed to a second recipient and the second input context includes the second recipient; and
the first recipient is different from the second recipient.

43. The computer-readable storage medium of claim 39, further comprising instructions for causing the one or more processors to:
present, at a first instance and via a user interface of the electronic device, the predicted text based on the first weighted probability of the predicted text given the first text input; and
present, at a second instance and via the user interface, the predicted text based on the second weighted probability of the predicted text given the second text input.