1. A non-transitory computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by one or more processors of an electronic device, cause the electronic device to: receive user input including an n-gram; generate, from the user input, a representation of the n-gram; generate, using the representation of the n-gram, a similarity between a representation of the n-gram and a representation of a first language, wherein the representation of the first language is based on an occurrence of each of a plurality of n-grams in the first language and an occurrence of each of the plurality of n-grams in a second language; determine whether the similarity between the representation of the n-gram and the representation of the first language satisfies a threshold; and in accordance with a determination that the similarity between the representation of the n-gram and the representation of the first language does not satisfy the threshold, display a user interface to allow a user to specify a language of the user input.