1. A computer-implemented method comprising: selecting a first term and a second term; determining, for each of one or more first co-occurring terms that occur in past search queries that include the first term, a first co-occurrence frequency of the co-occurring term in search queries that include the first term; generating a first vector for the first term using the first co-occurrence frequencies; determining, for each of one or more second co-occurring terms that occur in past search queries that include the first term adjacent to the second term, a second co-occurrence frequency of the co-occurring term in the search queries that include the first term adjacent to the second term; generating a second vector for the second term using the second co-occurrence frequencies; comparing the first vector and the second vector; and computing a score for the second term as a context for a substitution rule based on the first term, wherein the score is based on a comparison between the first vector and the second vector.
1. A computer-implemented method comprising: selecting a first term and a second term; determining, for each of one or more first co-occurring terms that occur in past search queries that include the first term, a first co-occurrence frequency of the co-occurring term in search queries that include the first term; generating a first vector for the first term using the first co-occurrence frequencies; determining, for each of one or more second co-occurring terms that occur in past search queries that include the first term adjacent to the second term, a second co-occurrence frequency of the co-occurring term in the search queries that include the first term adjacent to the second term; generating a second vector for the second term using the second co-occurrence frequencies; comparing the first vector and the second vector; and computing a score for the second term as a context for a substitution rule based on the first term, wherein the score is based on a comparison between the first vector and the second vector. 10. The method of claim 1 , comprising: determining that the score satisfies a threshold; and designating the second term as a bad context for the first term in response to determining that the score satisfies a threshold.