1.1 --- a/bookloupe/bookloupe.c Sat May 25 20:38:17 2013 +0100
1.2 +++ b/bookloupe/bookloupe.c Sat May 25 20:47:50 2013 +0100
1.3 @@ -1263,6 +1263,89 @@
1.4 }
1.5
1.6 /*
1.7 + * check_for_jeebies:
1.8 + *
1.9 + * Check for "to he" and other easy h/b errors.
1.10 + *
1.11 + * This is a very inadequate effort on the h/b problem,
1.12 + * but the phrase "to he" is always an error, whereas "to
1.13 + * be" is quite common.
1.14 + * Similarly, '"Quiet!", be said.' is a non-be error
1.15 + * "to he" is _not_ always an error!:
1.16 + * "Where they went to he couldn't say."
1.17 + * Another false positive:
1.18 + * What would "Cinderella" be without the . . .
1.19 + * and another: "If he wants to he can see for himself."
1.20 + */
1.21 +void check_for_jeebies(const char *aline)
1.22 +{
1.23 + const char *s;
1.24 + s=strstr(aline," be could ");
1.25 + if (!s)
1.26 + s=strstr(aline," be would ");
1.27 + if (!s)
1.28 + s=strstr(aline," was be ");
1.29 + if (!s)
1.30 + s=strstr(aline," be is ");
1.31 + if (!s)
1.32 + s=strstr(aline," is be ");
1.33 + if (!s)
1.34 + s=strstr(aline,"\", be ");
1.35 + if (!s)
1.36 + s=strstr(aline,"\" be ");
1.37 + if (!s)
1.38 + s=strstr(aline,"\" be ");
1.39 + if (!s)
1.40 + s=strstr(aline," to he ");
1.41 + if (s)
1.42 + {
1.43 + if (pswit[ECHO_SWITCH])
1.44 + printf("\n%s\n",aline);
1.45 + if (!pswit[OVERVIEW_SWITCH])
1.46 + printf(" Line %ld column %d - Query he/be error?\n",
1.47 + linecnt,(int)(s-aline)+1);
1.48 + else
1.49 + cnt_word++;
1.50 + }
1.51 + s=strstr(aline," the had ");
1.52 + if (!s)
1.53 + s=strstr(aline," a had ");
1.54 + if (!s)
1.55 + s=strstr(aline," they bad ");
1.56 + if (!s)
1.57 + s=strstr(aline," she bad ");
1.58 + if (!s)
1.59 + s=strstr(aline," he bad ");
1.60 + if (!s)
1.61 + s=strstr(aline," you bad ");
1.62 + if (!s)
1.63 + s=strstr(aline," i bad ");
1.64 + if (s)
1.65 + {
1.66 + if (pswit[ECHO_SWITCH])
1.67 + printf("\n%s\n",aline);
1.68 + if (!pswit[OVERVIEW_SWITCH])
1.69 + printf(" Line %ld column %d - Query had/bad error?\n",
1.70 + linecnt,(int)(s-aline)+1);
1.71 + else
1.72 + cnt_word++;
1.73 + }
1.74 + s=strstr(aline,"; hut ");
1.75 + if (!s)
1.76 + s=strstr(aline,", hut ");
1.77 + if (s)
1.78 + {
1.79 + if (pswit[ECHO_SWITCH])
1.80 + printf("\n%s\n",aline);
1.81 + if (!pswit[OVERVIEW_SWITCH])
1.82 + printf(" Line %ld column %d - Query hut/but error?\n",
1.83 + linecnt,(int)(s-aline)+1);
1.84 + else
1.85 + cnt_word++;
1.86 + }
1.87 +}
1.88 +
1.89 +/*
1.90 * procfile:
1.91 *
1.92 * Process one file.
1.93 @@ -1509,88 +1592,7 @@
1.94 check_for_spaced_dash(aline);
1.95 }
1.96 check_for_unmarked_paragraphs(aline);
1.97 - /*
1.98 - * Check for "to he" and other easy he/be errors.
1.99 - * This is a very inadequate effort on the he/be problem,
1.100 - * but the phrase "to he" is always an error, whereas "to
1.101 - * be" is quite common.
1.102 - * Similarly, '"Quiet!", be said.' is a non-be error
1.103 - * "to he" is _not_ always an error!:
1.104 - * "Where they went to he couldn't say."
1.105 - * Another false positive:
1.106 - * What would "Cinderella" be without the . . .
1.107 - * and another: "If he wants to he can see for himself."
1.108 - */
1.109 - s=wrk;
1.110 - *s=0;
1.111 - if (strstr(aline," to he "))
1.112 - s=strstr(aline," to he ");
1.113 - if (strstr(aline,"\" be "))
1.114 - s=strstr(aline,"\" be ");
1.115 - if (strstr(aline,"\", be "))
1.116 - s=strstr(aline,"\", be ");
1.117 - if (strstr(aline," is be "))
1.118 - s=strstr(aline," is be ");
1.119 - if (strstr(aline," be is "))
1.120 - s=strstr(aline," be is ");
1.121 - if (strstr(aline," was be "))
1.122 - s=strstr(aline," was be ");
1.123 - if (strstr(aline," be would "))
1.124 - s=strstr(aline," be would ");
1.125 - if (strstr(aline," be could "))
1.126 - s=strstr(aline," be could ");
1.127 - if (*s)
1.128 - {
1.129 - if (pswit[ECHO_SWITCH])
1.130 - printf("\n%s\n",aline);
1.131 - if (!pswit[OVERVIEW_SWITCH])
1.132 - printf(" Line %ld column %d - Query he/be error?\n",
1.133 - linecnt,(int)(s-aline)+1);
1.134 - else
1.135 - cnt_word++;
1.136 - }
1.137 - s=wrk;
1.138 - *s=0;
1.139 - if (strstr(aline," i bad "))
1.140 - s=strstr(aline," i bad ");
1.141 - if (strstr(aline," you bad "))
1.142 - s=strstr(aline," you bad ");
1.143 - if (strstr(aline," he bad "))
1.144 - s=strstr(aline," he bad ");
1.145 - if (strstr(aline," she bad "))
1.146 - s=strstr(aline," she bad ");
1.147 - if (strstr(aline," they bad "))
1.148 - s=strstr(aline," they bad ");
1.149 - if (strstr(aline," a had "))
1.150 - s=strstr(aline," a had ");
1.151 - if (strstr(aline," the had "))
1.152 - s=strstr(aline," the had ");
1.153 - if (*s)
1.154 - {
1.155 - if (pswit[ECHO_SWITCH])
1.156 - printf("\n%s\n",aline);
1.157 - if (!pswit[OVERVIEW_SWITCH])
1.158 - printf(" Line %ld column %d - Query had/bad error?\n",
1.159 - linecnt,(int)(s-aline)+1);
1.160 - else
1.161 - cnt_word++;
1.162 - }
1.163 - s=wrk;
1.164 - *s=0;
1.165 - if (strstr(aline,", hut "))
1.166 - s=strstr(aline,", hut ");
1.167 - if (strstr(aline,"; hut "))
1.168 - s=strstr(aline,"; hut ");
1.169 - if (*s)
1.170 - {
1.171 - if (pswit[ECHO_SWITCH])
1.172 - printf("\n%s\n",aline);
1.173 - if (!pswit[OVERVIEW_SWITCH])
1.174 - printf(" Line %ld column %d - Query hut/but error?\n",
1.175 - linecnt,(int)(s-aline)+1);
1.176 - else
1.177 - cnt_word++;
1.178 - }
1.179 + check_for_jeebies(aline);
1.180 /*
1.181 * Special case - angled bracket in front of "From" placed there by an
1.182 * MTA when sending an e-mail.