Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
#!/bin/sh
# English -- suite of English checks for latex files
#
# AUTHOR: Gary T. Leavens
USAGE="Usage: $0 file ..."
[ -n "$echo" ] && set -x
# repeated -- Print any repeated words in a text file, such as "the the."
#
# BUGS: This will not catch repeated words where one is capatilized and the
# other is not capitalized.
repeated()
{
USAGE="Usage: $0 file ..."
# no arguments?
if test $# -eq 0
then
echo "$USAGE" >&2
exit 1
fi
awk 'BEGIN { prev = "" }
{ for (i=1; i<=NF; i++) {
if (prev == $i) { if (prev ~ /[a-zA-Z]/) print $i, $i }
prev = $i } }
' $*
}
# article -- Print any ``an foo'' or ``a object'' mistakes in a text file.
#
# BUGS: This doesn't know about "h" and thinks "u" doesn't need "an".
# should also work with quotations better...
article()
{
USAGE="Usage: $0 file ..."
# no arguments?
if test $# -eq 0
then
echo "$USAGE" >&2
exit 1
fi
awk 'BEGIN { prev = "" }
{ for (i=1; i<=NF; i++) {
if ((prev ~ /^[Aa]n$/) && ($i ~ /^[^AaEeIiOo].*$/)) {
print prev, $i }
if ((prev ~ /^[Aa]$/) && ($i ~ /^[AaEeIiOo].*$/)) {
print prev, $i }
prev = $i } }
' $*
}
# no arguments?
if test $# -eq 0
then
echo "$USAGE" >&2
exit 1
fi
for f
do
echo 'checking for repeated words ...'
repeated $f
echo 'checking for bad indefinite articles ...'
deroff $f | article -
echo 'checking for spelling errors ...'
spell $f
done