author | robin <robin@reportlab.com> |
Tue, 07 Mar 2017 10:00:34 +0000 | |
changeset 4330 | 617ffa6bbdc8 |
parent 4252 | fe660f227cac |
child 4338 | 6223e7fa13f6 |
permissions | -rw-r--r-- |
558 | 1 |
#!/bin/env python |
4330 | 2 |
#Copyright ReportLab Europe Ltd. 2000-2017 |
558 | 3 |
#see license.txt for license details |
2332 | 4 |
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/randomtext.py |
565 | 5 |
|
4252 | 6 |
__version__='3.3.0' |
565 | 7 |
|
558 | 8 |
############################################################################### |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
9 |
# generates so-called 'Greek Text' for use in filling documents. |
558 | 10 |
############################################################################### |
3029 | 11 |
__doc__="""Like Lorem Ipsum, but more fun and extensible. |
12 |
||
559 | 13 |
This module exposes a function randomText() which generates paragraphs. |
558 | 14 |
These can be used when testing out document templates and stylesheets. |
15 |
A number of 'themes' are provided - please contribute more! |
|
16 |
We need some real Greek text too. |
|
559 | 17 |
|
18 |
There are currently six themes provided: |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
19 |
STARTUP (words suitable for a business plan - or not as the case may be), |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
20 |
COMPUTERS (names of programming languages and operating systems etc), |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
21 |
BLAH (variations on the word 'blah'), |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
22 |
BUZZWORD (buzzword bingo), |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
23 |
STARTREK (Star Trek), |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
24 |
PRINTING (print-related terms) |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
25 |
PYTHON (snippets and quotes from Monty Python) |
2377 | 26 |
CHOMSKY (random lingusitic nonsense) |
887
9142fd106d18
Minor changes. Now allows you to specify the maximum number of sentences
johnprecedo
parents:
614
diff
changeset
|
27 |
|
9142fd106d18
Minor changes. Now allows you to specify the maximum number of sentences
johnprecedo
parents:
614
diff
changeset
|
28 |
EXAMPLE USAGE: |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
29 |
from reportlab.lib import randomtext |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
30 |
print randomtext.randomText(randomtext.PYTHON, 10) |
887
9142fd106d18
Minor changes. Now allows you to specify the maximum number of sentences
johnprecedo
parents:
614
diff
changeset
|
31 |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
32 |
This prints a random number of random sentences (up to a limit |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
33 |
of ten) using the theme 'PYTHON'. |
1683 | 34 |
|
558 | 35 |
""" |
36 |
||
37 |
#theme one :-) |
|
559 | 38 |
STARTUP = ['strategic', 'direction', 'proactive', 'venture capital', |
39 |
'reengineering', 'forecast', 'resources', 'SWOT analysis', |
|
40 |
'forward-thinking', 'profit', 'growth', 'doubletalk', 'B2B', 'B2C', |
|
41 |
'venture capital', 'IPO', "NASDAQ meltdown - we're all doomed!"] |
|
42 |
||
43 |
#theme two - computery things. |
|
44 |
COMPUTERS = ['Python', 'Perl', 'Pascal', 'Java', 'Javascript', |
|
45 |
'VB', 'Basic', 'LISP', 'Fortran', 'ADA', 'APL', 'C', 'C++', |
|
46 |
'assembler', 'Larry Wall', 'Guido van Rossum', 'XML', 'HTML', |
|
47 |
'cgi', 'cgi-bin', 'Amiga', 'Macintosh', 'Dell', 'Microsoft', |
|
48 |
'firewall', 'server', 'Linux', 'Unix', 'MacOS', 'BeOS', 'AS/400', |
|
49 |
'sendmail', 'TCP/IP', 'SMTP', 'RFC822-compliant', 'dynamic', |
|
560
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
50 |
'Internet', 'A/UX', 'Amiga OS', 'BIOS', 'boot managers', 'CP/M', |
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
51 |
'DOS', 'file system', 'FreeBSD', 'Freeware', 'GEOS', 'GNU', |
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
52 |
'Hurd', 'Linux', 'Mach', 'Macintosh OS', 'mailing lists', 'Minix', |
559 | 53 |
'Multics', 'NetWare', 'NextStep', 'OS/2', 'Plan 9', 'Realtime', |
1683 | 54 |
'UNIX', 'VMS', 'Windows', 'X Windows', 'Xinu', 'security', 'Intel', |
560
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
55 |
'encryption', 'PGP' , 'software', 'ActiveX', 'AppleScript', 'awk', |
559 | 56 |
'BETA', 'COBOL', 'Delphi', 'Dylan', 'Eiffel', 'extreme programming', |
57 |
'Forth', 'Fortran', 'functional languages', 'Guile', 'format your hard drive', |
|
58 |
'Icon', 'IDL', 'Infer', 'Intercal', 'J', 'Java', 'JavaScript', 'CD-ROM', |
|
560
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
59 |
'JCL', 'Lisp', '"literate programming"', 'Logo', 'MUMPS', 'C: drive', |
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
60 |
'Modula-2', 'Modula-3', 'Oberon', 'Occam', 'OpenGL', 'parallel languages', |
559 | 61 |
'Pascal', 'Perl', 'PL/I', 'PostScript', 'Prolog', 'hardware', 'Blue Screen of Death', |
62 |
'Rexx', 'RPG', 'Scheme', 'scripting languages', 'Smalltalk', 'crash!', 'disc crash', |
|
560
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
63 |
'Spanner', 'SQL', 'Tcl/Tk', 'TeX', 'TOM', 'Visual', 'Visual Basic', '4GL', |
1683 | 64 |
'VRML', 'Virtual Reality Modeling Language', 'difference engine', '...went into "yo-yo mode"', |
559 | 65 |
'Sun', 'Sun Microsystems', 'Hewlett Packard', 'output device', |
1683 | 66 |
'CPU', 'memory', 'registers', 'monitor', 'TFT display', 'plasma screen', |
559 | 67 |
'bug report', '"mis-feature"', '...millions of bugs!', 'pizza', |
560
20c3fff1e37c
Minor tweaks (removing unneccesary capital letters etc).
johnprecedo
parents:
559
diff
changeset
|
68 |
'"illiterate programming"','...lots of pizza!', 'pepperoni pizza', |
559 | 69 |
'coffee', 'Jolt Cola[TM]', 'beer', 'BEER!'] |
70 |
||
71 |
#theme three - 'blah' - for when you want to be subtle. :-) |
|
72 |
BLAH = ['Blah', 'BLAH', 'blahblah', 'blahblahblah', 'blah-blah', |
|
73 |
'blah!', '"Blah Blah Blah"', 'blah-de-blah', 'blah?', 'blah!!!', |
|
74 |
'blah...', 'Blah.', 'blah;', 'blah, Blah, BLAH!', 'Blah!!!'] |
|
75 |
||
76 |
#theme four - 'buzzword bingo' time! |
|
77 |
BUZZWORD = ['intellectual capital', 'market segment', 'flattening', |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
78 |
'regroup', 'platform', 'client-based', 'long-term', 'proactive', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
79 |
'quality vector', 'out of the loop', 'implement', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
80 |
'streamline', 'cost-centered', 'phase', 'synergy', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
81 |
'synergize', 'interactive', 'facilitate', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
82 |
'appropriate', 'goal-setting', 'empowering', 'low-risk high-yield', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
83 |
'peel the onion', 'goal', 'downsize', 'result-driven', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
84 |
'conceptualize', 'multidisciplinary', 'gap analysis', 'dysfunctional', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
85 |
'networking', 'knowledge management', 'goal-setting', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
86 |
'mastery learning', 'communication', 'real-estate', 'quarterly', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
87 |
'scalable', 'Total Quality Management', 'best of breed', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
88 |
'nimble', 'monetize', 'benchmark', 'hardball', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
89 |
'client-centered', 'vision statement', 'empowerment', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
90 |
'lean & mean', 'credibility', 'synergistic', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
91 |
'backward-compatible', 'hardball', 'stretch the envelope', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
92 |
'bleeding edge', 'networking', 'motivation', 'best practice', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
93 |
'best of breed', 'implementation', 'Total Quality Management', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
94 |
'undefined', 'disintermediate', 'mindset', 'architect', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
95 |
'gap analysis', 'morale', 'objective', 'projection', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
96 |
'contribution', 'proactive', 'go the extra mile', 'dynamic', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
97 |
'world class', 'real estate', 'quality vector', 'credibility', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
98 |
'appropriate', 'platform', 'projection', 'mastery learning', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
99 |
'recognition', 'quality', 'scenario', 'performance based', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
100 |
'solutioning', 'go the extra mile', 'downsize', 'phase', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
101 |
'networking', 'experiencing slippage', 'knowledge management', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
102 |
'high priority', 'process', 'ethical', 'value-added', 'implement', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
103 |
're-factoring', 're-branding', 'embracing change'] |
559 | 104 |
|
105 |
#theme five - Star Trek |
|
106 |
STARTREK = ['Starfleet', 'Klingon', 'Romulan', 'Cardassian', 'Vulcan', |
|
107 |
'Benzite', 'IKV Pagh', 'emergency transponder', 'United Federation of Planets', |
|
108 |
'Bolian', "K'Vort Class Bird-of-Prey", 'USS Enterprise', 'USS Intrepid', |
|
109 |
'USS Reliant', 'USS Voyager', 'Starfleet Academy', 'Captain Picard', |
|
110 |
'Captain Janeway', 'Tom Paris', 'Harry Kim', 'Counsellor Troi', |
|
111 |
'Lieutenant Worf', 'Lieutenant Commander Data', 'Dr. Beverly Crusher', |
|
112 |
'Admiral Nakamura', 'Irumodic Syndrome', 'Devron system', 'Admiral Pressman', |
|
113 |
'asteroid field', 'sensor readings', 'Binars', 'distress signal', 'shuttlecraft', |
|
114 |
'cloaking device', 'shuttle bay 2', 'Dr. Pulaski', 'Lwaxana Troi', 'Pacifica', |
|
115 |
'William Riker', "Chief O'Brian", 'Soyuz class science vessel', 'Wolf-359', |
|
116 |
'Galaxy class vessel', 'Utopia Planitia yards', 'photon torpedo', 'Archer IV', |
|
117 |
'quantum flux', 'spacedock', 'Risa', 'Deep Space Nine', 'blood wine', |
|
118 |
'quantum torpedoes', 'holodeck', 'Romulan Warbird', 'Betazoid', 'turbolift', 'battle bridge', |
|
119 |
'Memory Alpha', '...with a phaser!', 'Romulan ale', 'Ferrengi', 'Klingon opera', |
|
120 |
'Quark', 'wormhole', 'Bajoran', 'cruiser', 'warship', 'battlecruiser', '"Intruder alert!"', |
|
121 |
'scout ship', 'science vessel', '"Borg Invasion imminent!" ', '"Abandon ship!"', |
|
122 |
'Red Alert!', 'warp-core breech', '"All hands abandon ship! This is not a drill!"'] |
|
123 |
||
124 |
#theme six - print-related terms |
|
1683 | 125 |
PRINTING = ['points', 'picas', 'leading', 'kerning', 'CMYK', 'offset litho', |
559 | 126 |
'type', 'font family', 'typography', 'type designer', |
127 |
'baseline', 'white-out type', 'WOB', 'bicameral', 'bitmap', |
|
128 |
'blockletter', 'bleed', 'margin', 'body', 'widow', 'orphan', |
|
129 |
'cicero', 'cursive', 'letterform', 'sidehead', 'dingbat', 'leader', |
|
130 |
'DPI', 'drop-cap', 'paragraph', 'En', 'Em', 'flush left', 'left justified', |
|
131 |
'right justified', 'centered', 'italic', 'Latin letterform', 'ligature', |
|
132 |
'uppercase', 'lowercase', 'serif', 'sans-serif', 'weight', 'type foundry', |
|
133 |
'fleuron', 'folio', 'gutter', 'whitespace', 'humanist letterform', 'caption', |
|
134 |
'page', 'frame', 'ragged setting', 'flush-right', 'rule', 'drop shadows', |
|
135 |
'prepress', 'spot-colour', 'duotones', 'colour separations', 'four-colour printing', |
|
136 |
'Pantone[TM]', 'service bureau', 'imagesetter'] |
|
558 | 137 |
|
613 | 138 |
#it had to be done!... |
139 |
#theme seven - the "full Monty"! |
|
140 |
PYTHON = ['Good evening ladies and Bruces','I want to buy some cheese', 'You do have some cheese, do you?', |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
141 |
"Of course sir, it's a cheese shop sir, we've got...",'discipline?... naked? ... With a melon!?', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
142 |
'The Church Police!!' , "There's a dead bishop on the landing", 'Would you like a twist of lemming sir?', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
143 |
'"Conquistador Coffee brings a new meaning to the word vomit"','Your lupins please', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
144 |
'Crelm Toothpaste, with the miracle ingredient Fraudulin', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
145 |
"Well there's the first result and the Silly Party has held Leicester.", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
146 |
'Hello, I would like to buy a fish license please', "Look, it's people like you what cause unrest!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
147 |
"When we got home, our Dad would thrash us to sleep with his belt!", 'Luxury', "Gumby Brain Specialist", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
148 |
"My brain hurts!!!", "My brain hurts too.", "How not to be seen", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
149 |
"In this picture there are 47 people. None of them can be seen", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
150 |
"Mrs Smegma, will you stand up please?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
151 |
"Mr. Nesbitt has learned the first lesson of 'Not Being Seen', not to stand up.", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
152 |
"My hovercraft is full of eels", "Ah. You have beautiful thighs.", "My nipples explode with delight", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
153 |
"Drop your panties Sir William, I cannot wait 'til lunchtime", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
154 |
"I'm a completely self-taught idiot.", "I always wanted to be a lumberjack!!!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
155 |
"Told you so!! Oh, coitus!!", "", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
156 |
"Nudge nudge?", "Know what I mean!", "Nudge nudge, nudge nudge?", "Say no more!!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
157 |
"Hello, well it's just after 8 o'clock, and time for the penguin on top of your television set to explode", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
158 |
"Oh, intercourse the penguin!!", "Funny that penguin being there, isn't it?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
159 |
"I wish to register a complaint.", "Now that's what I call a dead parrot", "Pining for the fjords???", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
160 |
"No, that's not dead, it's ,uhhhh, resting", "This is an ex-parrot!!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
161 |
"That parrot is definitely deceased.", "No, no, no - it's spelt Raymond Luxury Yach-t, but it's pronounced 'Throatwobbler Mangrove'.", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
162 |
"You're a very silly man and I'm not going to interview you.", "No Mungo... never kill a customer." |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
163 |
"And I'd like to conclude by putting my finger up my nose", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
164 |
"egg and Spam", "egg bacon and Spam", "egg bacon sausage and Spam", "Spam bacon sausage and Spam", |
1683 | 165 |
"Spam egg Spam Spam bacon and Spam", "Spam sausage Spam Spam Spam bacon Spam tomato and Spam", |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
166 |
"Spam Spam Spam egg and Spam", "Spam Spam Spam Spam Spam Spam baked beans Spam Spam Spam", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
167 |
"Spam!!", "I don't like Spam!!!", "You can't have egg, bacon, Spam and sausage without the Spam!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
168 |
"I'll have your Spam. I Love it!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
169 |
"I'm having Spam Spam Spam Spam Spam Spam Spam baked beans Spam Spam Spam and Spam", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
170 |
"Have you got anything without Spam?", "There's Spam egg sausage and Spam, that's not got much Spam in it.", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
171 |
"No one expects the Spanish Inquisition!!", "Our weapon is surprise, surprise and fear!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
172 |
"Get the comfy chair!", "Amongst our weaponry are such diverse elements as: fear, surprise, ruthless efficiency, an almost fanatical devotion to the Pope, and nice red uniforms - Oh damn!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
173 |
"Nobody expects the... Oh bugger!", "What swims in the sea and gets caught in nets? Henri Bergson?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
174 |
"Goats. Underwater goats with snorkels and flippers?", "A buffalo with an aqualung?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
175 |
"Dinsdale was a looney, but he was a happy looney.", "Dinsdale!!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
176 |
"The 127th Upper-Class Twit of the Year Show", "What a great Twit!", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
177 |
"thought by many to be this year's outstanding twit", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
178 |
"...and there's a big crowd here today to see these prize idiots in action.", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
179 |
"And now for something completely different.", "Stop that, it's silly", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
180 |
"We interrupt this program to annoy you and make things generally irritating", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
181 |
"This depraved and degrading spectacle is going to stop right now, do you hear me?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
182 |
"Stop right there!", "This is absolutely disgusting and I'm not going to stand for it", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
183 |
"I object to all this sex on the television. I mean, I keep falling off", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
184 |
"Right! Stop that, it's silly. Very silly indeed", "Very silly indeed", "Lemon curry?", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
185 |
"And now for something completely different, a man with 3 buttocks", |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
186 |
"I've heard of unisex, but I've never had it", "That's the end, stop the program! Stop it!"] |
2377 | 187 |
leadins=[ |
188 |
"To characterize a linguistic level L,", |
|
189 |
"On the other hand,", |
|
190 |
"This suggests that", |
|
191 |
"It appears that", |
|
192 |
"Furthermore,", |
|
193 |
"We will bring evidence in favor of the following thesis: ", |
|
194 |
"To provide a constituent structure for T(Z,K),", |
|
195 |
"From C1, it follows that", |
|
196 |
"For any transformation which is sufficiently diversified in application to be of any interest,", |
|
197 |
"Analogously,", |
|
198 |
"Clearly,", |
|
199 |
"Note that", |
|
200 |
"Of course,", |
|
201 |
"Suppose, for instance, that", |
|
202 |
"Thus", |
|
203 |
"With this clarification,", |
|
204 |
"Conversely,", |
|
205 |
"We have already seen that", |
|
206 |
"By combining adjunctions and certain deformations,", |
|
207 |
"I suggested that these results would follow from the assumption that", |
|
208 |
"If the position of the trace in (99c) were only relatively inaccessible to movement,", |
|
209 |
"However, this assumption is not correct, since", |
|
210 |
"Comparing these examples with their parasitic gap counterparts in (96) and (97), we see that", |
|
211 |
"In the discussion of resumptive pronouns following (81),", |
|
212 |
"So far,", |
|
213 |
"Nevertheless,", |
|
214 |
"For one thing,", |
|
215 |
"Summarizing, then, we assume that", |
|
216 |
"A consequence of the approach just outlined is that", |
|
217 |
"Presumably,", |
|
218 |
"On our assumptions,", |
|
219 |
"It may be, then, that", |
|
220 |
"It must be emphasized, once again, that", |
|
221 |
"Let us continue to suppose that", |
|
222 |
"Notice, incidentally, that", |
|
2381 | 223 |
"A majority of informed linguistic specialists agree that", |
3501 | 224 |
"There is also a different approach to the [unification] problem,", |
225 |
"This approach divorces the cognitive sciences from a biological setting,", |
|
226 |
"The approach relies on the \"Turing Test,\" devised by mathematician Alan Turing,", |
|
227 |
"Adopting this approach,", |
|
228 |
"There is no fact, no meaningful question to be answered,", |
|
229 |
"Another superficial similarity is the interest in simulation of behavior,", |
|
230 |
"A lot of sophistication has been developed about the utilization of machines for complex purposes,", |
|
2377 | 231 |
] |
232 |
||
233 |
subjects = [ |
|
234 |
"the notion of level of grammaticalness", |
|
235 |
"a case of semigrammaticalness of a different sort", |
|
236 |
"most of the methodological work in modern linguistics", |
|
237 |
"a subset of English sentences interesting on quite independent grounds", |
|
238 |
"the natural general principle that will subsume this case", |
|
239 |
"an important property of these three types of EC", |
|
240 |
"any associated supporting element", |
|
241 |
"the appearance of parasitic gaps in domains relatively inaccessible to ordinary extraction", |
|
242 |
"the speaker-hearer's linguistic intuition", |
|
243 |
"the descriptive power of the base component", |
|
244 |
"the earlier discussion of deviance", |
|
245 |
"this analysis of a formative as a pair of sets of features", |
|
246 |
"this selectionally introduced contextual feature", |
|
247 |
"a descriptively adequate grammar", |
|
248 |
"the fundamental error of regarding functional notions as categorial", |
|
249 |
"relational information", |
|
250 |
"the systematic use of complex symbols", |
|
251 |
"the theory of syntactic features developed earlier", |
|
252 |
] |
|
253 |
||
254 |
verbs= [ |
|
255 |
"can be defined in such a way as to impose", |
|
256 |
"delimits", |
|
257 |
"suffices to account for", |
|
258 |
"cannot be arbitrary in", |
|
259 |
"is not subject to", |
|
260 |
"does not readily tolerate", |
|
261 |
"raises serious doubts about", |
|
262 |
"is not quite equivalent to", |
|
263 |
"does not affect the structure of", |
|
264 |
"may remedy and, at the same time, eliminate", |
|
265 |
"is not to be considered in determining", |
|
266 |
"is to be regarded as", |
|
267 |
"is unspecified with respect to", |
|
268 |
"is, apparently, determined by", |
|
269 |
"is necessary to impose an interpretation on", |
|
270 |
"appears to correlate rather closely with", |
|
271 |
"is rather different from", |
|
272 |
] |
|
273 |
||
274 |
objects = [ |
|
275 |
"problems of phonemic and morphological analysis.", |
|
276 |
"a corpus of utterance tokens upon which conformity has been defined by the paired utterance test.", |
|
277 |
"the traditional practice of grammarians.", |
|
278 |
"the levels of acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g. (98d)).", |
|
279 |
"a stipulation to place the constructions into these various categories.", |
|
280 |
"a descriptive fact.", |
|
281 |
"a parasitic gap construction.", |
|
282 |
"the extended c-command discussed in connection with (34).", |
|
283 |
"the ultimate standard that determines the accuracy of any proposed grammar.", |
|
284 |
"the system of base rules exclusive of the lexicon.", |
|
285 |
"irrelevant intervening contexts in selectional rules.", |
|
286 |
"nondistinctness in the sense of distinctive feature theory.", |
|
287 |
"a general convention regarding the forms of the grammar.", |
|
288 |
"an abstract underlying order.", |
|
289 |
"an important distinction in language use.", |
|
290 |
"the requirement that branching is not tolerated within the dominance scope of a complex symbol.", |
|
291 |
"the strong generative capacity of the theory.", |
|
292 |
] |
|
293 |
||
294 |
def format_wisdom(text,line_length=72): |
|
2381 | 295 |
try: |
296 |
import textwrap |
|
297 |
return textwrap.fill(text, line_length) |
|
298 |
except: |
|
299 |
return text |
|
2377 | 300 |
|
301 |
def chomsky(times = 1): |
|
302 |
if not isinstance(times, int): |
|
303 |
return format_wisdom(__doc__) |
|
2381 | 304 |
import random |
2377 | 305 |
prevparts = [] |
306 |
newparts = [] |
|
307 |
output = [] |
|
3721 | 308 |
for i in range(times): |
2377 | 309 |
for partlist in (leadins, subjects, verbs, objects): |
310 |
while 1: |
|
311 |
part = random.choice(partlist) |
|
312 |
if part not in prevparts: |
|
313 |
break |
|
314 |
newparts.append(part) |
|
315 |
output.append(' '.join(newparts)) |
|
316 |
prevparts = newparts |
|
317 |
newparts = [] |
|
318 |
return format_wisdom(' '.join(output)) |
|
613 | 319 |
|
2084 | 320 |
from reportlab import rl_config |
321 |
if rl_config.invariant: |
|
322 |
if not getattr(rl_config,'_random',None): |
|
323 |
rl_config._random = 1 |
|
324 |
import random |
|
3721 | 325 |
random.seed(2342471922) |
2084 | 326 |
del random |
327 |
del rl_config |
|
558 | 328 |
|
887
9142fd106d18
Minor changes. Now allows you to specify the maximum number of sentences
johnprecedo
parents:
614
diff
changeset
|
329 |
def randomText(theme=STARTUP, sentences=5): |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
330 |
#this may or may not be appropriate in your company |
2380 | 331 |
if type(theme)==type(''): |
332 |
if theme.lower()=='chomsky': return chomsky(sentences) |
|
333 |
elif theme.upper() in ('STARTUP','COMPUTERS','BLAH','BUZZWORD','STARTREK','PRINTING','PYTHON'): |
|
3576 | 334 |
theme = globals()[theme.upper()] |
2380 | 335 |
else: |
336 |
raise ValueError('Unknown theme "%s"' % theme) |
|
337 |
||
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
338 |
from random import randint, choice |
558 | 339 |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
340 |
RANDOMWORDS = theme |
558 | 341 |
|
2377 | 342 |
#sentences = 5 |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
343 |
output = "" |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
344 |
for sentenceno in range(randint(1,sentences)): |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
345 |
output = output + 'Blah' |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
346 |
for wordno in range(randint(10,25)): |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
347 |
if randint(0,4)==0: |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
348 |
word = choice(RANDOMWORDS) |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
349 |
else: |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
350 |
word = 'blah' |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
351 |
output = output + ' ' +word |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
352 |
output = output+'. ' |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
887
diff
changeset
|
353 |
return output |
2377 | 354 |
|
355 |
if __name__=='__main__': |
|
3478 | 356 |
import sys |
357 |
argv = sys.argv[1:] |
|
358 |
if argv: |
|
359 |
theme = argv.pop(0) |
|
360 |
if argv: |
|
361 |
sentences = int(argv.pop(0)) |
|
3576 | 362 |
else: |
363 |
sentences = 5 |
|
364 |
try: |
|
3721 | 365 |
print(randomText(theme,sentences)) |
3576 | 366 |
except: |
3901 | 367 |
sys.stderr.write("Usage: randomtext.py [theme [#sentences]]\n") |
3904
2c1ff52e1f36
randomtext.py: add \n to final error line, spotted by Lele Gaifax
robin
parents:
3901
diff
changeset
|
368 |
sys.stderr.write(" theme in chomsky|STARTUP|COMPUTERS|BLAH|BUZZWORD|STARTREK|PRINTING|PYTHON\n") |
3576 | 369 |
raise |
3478 | 370 |
else: |
3721 | 371 |
print(chomsky(5)) |