17. The method of claim 16 comprising training the language model using noise contrastive estimation where the noise samples are computed as alternative candidates of true words assuming imperfect entry of the true words to the electronic device.
16. A computer-implemented method performed by an electronic device, the method comprising: receiving, at a processor, user input comprising a sequence of one or more items; computing, using a language model, candidate next items in the sequence of one or more items; training the language model using training data comprising a plurality of true words and at least one alternative candidate word for each of the plurality of true words, wherein the plurality of true words comprises respective words intended to be input with a virtual keyboard, wherein the at least one alternative candidate word for each true word comprises at least one word received from imperfect entry during attempted input of the true word with the virtual keyboard, and wherein, as a result of the training, the language model is trained to reward discriminating between the plurality of true words and the at least one alternative candidate word for each of the plurality of true words.