refering, recommented, registred and other typos

49 views
Skip to first unread message

Jori Mäntysalo (TAU)

unread,
Aug 8, 2019, 3:56:17 AM8/8/19
to sage-...@googlegroups.com
Might be of interest to someone painting a bikeshed. I played a little
with Levenshtein module.

$ egrep --no-filename -R -o -w '[a-z]{4,15}' src/sage > /tmp/all
$ cat /tmp/all | sort | uniq -c | fgrep -w 1 | colrm 1 8 > /tmp/singles
$ cat /tmp/all | sort | uniq -c | fgrep -v -w 1 | colrm 1 8 > /tmp/nonsingles

And now

#!/bin/python

from Levenshtein import distance

f = open('/tmp/singles', 'r')
singles = f.readlines()
f.close()

f = open('/tmp/nonsingles', 'r')
nonsingles = f.readlines()
f.close()

for s in singles:
for w in nonsingles:
if distance(s, w) == 1:
print(s+" "+w)
break

This can be used to spot at few typos.

--
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee
Reply all
Reply to author
Forward
0 new messages