11. A system comprising: one or more hardware processors; a non-transitory computer-readable medium storing instructions, which, when executed, are operable to cause the one or more processors to perform operations comprising: receiving a sequence of keyboard events representing keystrokes input to a virtual keyboard of a device; traversing a hierarchical data structure according to the sequence of keyboard events to determine candidate words; constructing a word lattice based on a language model, including deriving path weights from candidate word statistics and keyboard error model data, wherein deriving the path weights is based on a function having one or more first parameters including the candidate word statistics and one or more second parameters including the keyboard error model data; searching the word lattice for N best paths, where N is a positive integer; determining one or more candidate sentences comprising candidate words based on the N best paths.
11. A system comprising: one or more hardware processors; a non-transitory computer-readable medium storing instructions, which, when executed, are operable to cause the one or more processors to perform operations comprising: receiving a sequence of keyboard events representing keystrokes input to a virtual keyboard of a device; traversing a hierarchical data structure according to the sequence of keyboard events to determine candidate words; constructing a word lattice based on a language model, including deriving path weights from candidate word statistics and keyboard error model data, wherein deriving the path weights is based on a function having one or more first parameters including the candidate word statistics and one or more second parameters including the keyboard error model data; searching the word lattice for N best paths, where N is a positive integer; determining one or more candidate sentences comprising candidate words based on the N best paths. 13. The system of claim 11 , where the hierarchical data structure is a trie data structure.