the same 2-gram "bc" (although {"ab", "bc"} is clearly not the same as {"bc", "ca"}). However, we know empirically that if two strings of real text have a similar vector representation (as measured by cosine distance) then they are likely to be similar. Other metrics have also been applied to vectors of n-grams with varying, sometimes better, results. For example, z-scores have been used to compare documents by examining how many standard deviations each n-gram differs from its mean occurrence in a large collection, or text corpus, of documents (which form the "background" vector). In the event of small counts, the g-score (also known as g-test) may give better results for comparing alternative models. It is also possible to take a more principled approach to the statistics of n-grams, modeling similarity as the likelihood that two strings came from the same source directly in terms of a problem in Bayesian inference. n-gram-based searching can also be used for plagiarism detection. Other applications n-grams find use in several areas of computer science, computational linguistics, and applied mathematics. They have been used to: design kernels that allow machine learning algorithms such as support vector machines to learn from string data find likely candidates for the correct spelling of a misspelled word improve compression in compression algorithms where a small area of data requires n-grams of greater length assess the probability of a given word sequence appearing in text of a language of interest in pattern recognition systems, speech recognition, OCR (optical character recognition), Intelligent Character Recognition (ICR), machine translation and similar applications improve retrieval in information retrieval systems when it is hoped to find similar "documents" (a term for which the conventional meaning is sometimes stretched, depending on the data set) given a single query document and a database of reference documents improve retrieval performance in genetic sequence analysis as in the BLAST family of programs identify the language a text is in or the species a small sequence of DNA was taken from predict letters or words at random in order to create text, as in the dissociated press algorithm. cryptanalysis Space required for an n-gram Consider an n-gram where the units are characters and a text with t characters, where . There are total strings, where each string requires units of space. Thus, the total space required for this n-gram is , which is simplified to: Bias-versus-variance trade-off To choose