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; determine 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 determine whether the similarity between the representation of the n-gram and the representation of the first language satisfies a threshold.