20. The system of claim 19 , wherein determining the likelihood that the query sequence for which the query sequence key is determined occurs a word boundary from the word boundary count and non-word boundary count associated with a query sequence key comprises dividing the word boundary count by a sum of the word boundary count and non-word boundary count.
19. A system comprising: a data processing apparatus; and a computer storage medium encoded with a computer program, the program comprising data processing apparatus instructions that when executed by the data processing apparatus cause the data processing apparatus to perform operations comprising: accessing queries stored in query logs, each query being one or more characters in a first sequence constituting one or more words in a second sequence; for each query: selecting query sequences from the query, each query sequence being at least a portion of a word n-gram, the word n-gram being a subsequence of up to n words selected from the second sequence of words of the query, and for each query sequence: determining one or more query sequence keys for the query sequence; determining at least one of a word boundary count and a non-word boundary count for each query sequence key, each word-boundary count and non-word boundary count being dependent on the context of the query sequence; for each query sequence key: determining a likelihood that the query sequence for which the query sequence key is determined occurs a word boundary from the word boundary count and non-word boundary count associated with a query sequence key; and associating, in a data storage device, the likelihood with the query sequence key.