bad_text.html
001|
002| from sys import argv
003| from os import path
004| from random import random
005|
006| BasePath = r'C:\CJS\prj\Python\ws\@sandbox'
007|
008| Source = '''\
008| It's that time again, my blog anniversary. It's been twelve years, more than 1300 posts (plus a few dozen pages), and almost two million words (1.7 and change). That's a fair amount of water over the dam. That said, the river flows a bit slower these days.
008|
008| This 12-year anniversary comes on the heels of the 10-year anniversary of being retired. While the perceived importance of tens is a very human conceit (you'd expect the Simpsons and Mickey Mouse to attach that same importance to eights), twelves have a nice mathematical importance -- there are more ways to evenly divide it: 2, 3, 4, and 6 (compared to the 2 and 5 of tens or the 2 and 4 of eights).
008|
008| (That nice divisibility is handy with our 12-hour clocks and 12-month years.)
008| '''
009|
010|
011| def bad_text (in_txt):
012| print('GOOD TEXT')
013| print(in_txt)
014| print()
015|
016|
017| out = []
018| for ch in in_txt:
019|
020|
021| if ch.isalpha() and (random() < 0.005):
022| continue
023|
024|
025| if ch.isalpha() and (random() < 0.005):
026| ch = ch + ch
027|
028| out.append(ch)
029| continue
030|
031|
032| if (ch == 'a') and (random() < 0.10):
033| ch = 'e'
034|
035| out.append(ch)
036| continue
037|
038| if (ch == 'e') and (random() < 0.10):
039| ch = 'a'
040|
041| out.append(ch)
042| continue
043|
044|
045| out.append(ch)
046|
047|
048| out_txt = ''.join(out)
049| print('BAD TEXT')
050| print(out_txt)
051| print()
052| return out_txt
053|
054|
055|
056| txt = bad_text(Source)
057|
058|
059|
060|
061|
062| '''eof'''
063|