To get the list I searched for posts containing only a small amount of different characters, based on the assumption that random typing like "hgfghhgffhgfgh" usually contains the same characters over and over again. To measure this redundancy I basically calculated the entropy of all posts:
double calc_entropy(const std::string &txt) {
static const double log_2 = log(2.0);
const int sz = txt.size();
int chars[256] = {0};
for (int i = 0; i < sz; i++) {
if (txt[i] == '>' || txt[i] == '<' || txt[i] == ' ')
continue;
chars[(unsigned int)(unsigned char)txt[i]]++;
}
double H = 0.0;
for (int i = 0; i < 256; i++) {
if (chars[i]) {
double p = (double)chars[i] / sz;
H += p * log(p) / log_2;
}
}
return -H;
}
When sorting the posts by the score calculated by this function (or minor variants of it), the problematic answers came to the top. But of course there are also false positives, like thisthis or many variations of "Yes""Yes" and "No""No".