11. An electronic device, comprising: one or more processors; a memory; and 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 user input including an n-gram; generating, from the user input, a representation of the n-gram; generating, 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; and determining 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.
11. An electronic device, comprising: one or more processors; a memory; and 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 user input including an n-gram; generating, from the user input, a representation of the n-gram; generating, 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; and determining 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. 22. The electronic device of claim 11 , the one or more programs further including instructions for: in accordance with a determination that the similarity between the representation of the n-gram and the representation of the first language satisfies the threshold, selecting the first language.