10. A method, comprising: at an electronic device with one or more processors and memory: 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; 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.
10. A method, comprising: at an electronic device with one or more processors and memory: 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; 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. 18. The method of claim 10 , further comprising: receiving user input including a second n-gram; and selecting the second language based on the second n-gram.