src/reportlab/lib/randomtext.py
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--
changes for release 3.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
     1
#!/bin/env python
4330
617ffa6bbdc8 changes for release 3.4.0
robin <robin@reportlab.com>
parents: 4252
diff changeset
     2
#Copyright ReportLab Europe Ltd. 2000-2017
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
     3
#see license.txt for license details
2332
2a7ab4405e18 Remove $Header:, fix CopyRight & history
rgbecker
parents: 2084
diff changeset
     4
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/randomtext.py
565
179927300074 Minor changes.
dinu_gherman
parents: 560
diff changeset
     5
4252
fe660f227cac changes for release 3.3.0
robin
parents: 3904
diff changeset
     6
__version__='3.3.0'
565
179927300074 Minor changes.
dinu_gherman
parents: 560
diff changeset
     7
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
     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
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    10
###############################################################################
3029
eded59f94021 adding docstrings to lib
andy
parents: 2964
diff changeset
    11
__doc__="""Like Lorem Ipsum, but more fun and extensible.
eded59f94021 adding docstrings to lib
andy
parents: 2964
diff changeset
    12
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    13
This module exposes a function randomText() which generates paragraphs.
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    14
These can be used when testing out document templates and stylesheets.
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    15
A number of 'themes' are provided - please contribute more!
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    16
We need some real Greek text too.
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    17
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
    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
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
    34
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    35
"""
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    36
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
    37
#theme one :-)
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    38
STARTUP = ['strategic', 'direction', 'proactive', 'venture capital',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    39
    'reengineering', 'forecast', 'resources', 'SWOT analysis',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    40
    'forward-thinking', 'profit', 'growth', 'doubletalk', 'B2B', 'B2C',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    41
    'venture capital', 'IPO', "NASDAQ meltdown - we're all doomed!"]
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    42
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    43
#theme two - computery things.
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    44
COMPUTERS = ['Python', 'Perl', 'Pascal', 'Java', 'Javascript',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    45
    'VB', 'Basic', 'LISP', 'Fortran', 'ADA', 'APL', 'C', 'C++',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    46
    'assembler', 'Larry Wall', 'Guido van Rossum', 'XML', 'HTML',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    47
    'cgi', 'cgi-bin', 'Amiga', 'Macintosh', 'Dell', 'Microsoft',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    48
    'firewall', 'server', 'Linux', 'Unix', 'MacOS', 'BeOS', 'AS/400',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    53
    'Multics', 'NetWare', 'NextStep', 'OS/2', 'Plan 9', 'Realtime',
1683
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
    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
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    56
    'BETA', 'COBOL', 'Delphi', 'Dylan', 'Eiffel', 'extreme programming',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    57
    'Forth', 'Fortran', 'functional languages', 'Guile', 'format your hard drive',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    61
    'Pascal', 'Perl', 'PL/I', 'PostScript', 'Prolog', 'hardware', 'Blue Screen of Death',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
    64
    'VRML', 'Virtual Reality Modeling Language', 'difference engine', '...went into "yo-yo mode"',
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    65
    'Sun', 'Sun Microsystems', 'Hewlett Packard', 'output device',
1683
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
    66
    'CPU', 'memory', 'registers', 'monitor', 'TFT display', 'plasma screen',
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    69
    'coffee', 'Jolt Cola[TM]', 'beer', 'BEER!']
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    70
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    71
#theme three - 'blah' - for when you want to be subtle. :-)
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    72
BLAH = ['Blah', 'BLAH', 'blahblah', 'blahblahblah', 'blah-blah',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    73
    'blah!', '"Blah Blah Blah"', 'blah-de-blah', 'blah?', 'blah!!!',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    74
    'blah...', 'Blah.', 'blah;', 'blah, Blah, BLAH!', 'Blah!!!']
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    75
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    76
#theme four - 'buzzword bingo' time!
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
    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
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   104
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   105
#theme five - Star Trek
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   106
STARTREK = ['Starfleet', 'Klingon', 'Romulan', 'Cardassian', 'Vulcan',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   107
    'Benzite', 'IKV Pagh', 'emergency transponder', 'United Federation of Planets',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   108
    'Bolian', "K'Vort Class Bird-of-Prey", 'USS Enterprise', 'USS Intrepid',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   109
    'USS Reliant', 'USS Voyager', 'Starfleet Academy', 'Captain Picard',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   110
    'Captain Janeway', 'Tom Paris', 'Harry Kim', 'Counsellor Troi',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   111
    'Lieutenant Worf', 'Lieutenant Commander Data', 'Dr. Beverly Crusher',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   112
    'Admiral Nakamura', 'Irumodic Syndrome', 'Devron system', 'Admiral Pressman',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   113
    'asteroid field', 'sensor readings', 'Binars', 'distress signal', 'shuttlecraft',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   114
    'cloaking device', 'shuttle bay 2', 'Dr. Pulaski', 'Lwaxana Troi', 'Pacifica',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   115
    'William Riker', "Chief O'Brian", 'Soyuz class science vessel', 'Wolf-359',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   116
    'Galaxy class vessel', 'Utopia Planitia yards', 'photon torpedo', 'Archer IV',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   117
    'quantum flux', 'spacedock', 'Risa', 'Deep Space Nine', 'blood wine',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   118
    'quantum torpedoes', 'holodeck', 'Romulan Warbird', 'Betazoid', 'turbolift', 'battle bridge',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   119
    'Memory Alpha', '...with a phaser!', 'Romulan ale', 'Ferrengi', 'Klingon opera',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   120
    'Quark', 'wormhole', 'Bajoran', 'cruiser', 'warship', 'battlecruiser', '"Intruder alert!"',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   121
    'scout ship', 'science vessel', '"Borg Invasion imminent!" ', '"Abandon ship!"',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   122
    'Red Alert!', 'warp-core breech', '"All hands abandon ship! This is not a drill!"']
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   123
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   124
#theme six - print-related terms
1683
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
   125
PRINTING = ['points', 'picas', 'leading', 'kerning', 'CMYK', 'offset litho',
559
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   126
    'type', 'font family', 'typography', 'type designer',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   127
    'baseline', 'white-out type', 'WOB', 'bicameral', 'bitmap',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   128
    'blockletter', 'bleed', 'margin', 'body', 'widow', 'orphan',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   129
    'cicero', 'cursive', 'letterform', 'sidehead', 'dingbat', 'leader',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   130
    'DPI', 'drop-cap', 'paragraph', 'En', 'Em', 'flush left', 'left justified',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   131
    'right justified', 'centered', 'italic', 'Latin letterform', 'ligature',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   132
    'uppercase', 'lowercase', 'serif', 'sans-serif', 'weight', 'type foundry',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   133
    'fleuron', 'folio', 'gutter', 'whitespace', 'humanist letterform', 'caption',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   134
    'page', 'frame', 'ragged setting', 'flush-right', 'rule', 'drop shadows',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   135
    'prepress', 'spot-colour', 'duotones', 'colour separations', 'four-colour printing',
ea477fb0b68b Added 5 new themes.
johnprecedo
parents: 558
diff changeset
   136
    'Pantone[TM]', 'service bureau', 'imagesetter']
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
   137
613
40c5465a6a7c Added a PYTHON theme (it had to be done...).
johnprecedo
parents: 565
diff changeset
   138
#it had to be done!...
40c5465a6a7c Added a PYTHON theme (it had to be done...).
johnprecedo
parents: 565
diff changeset
   139
#theme seven - the "full Monty"!
40c5465a6a7c Added a PYTHON theme (it had to be done...).
johnprecedo
parents: 565
diff changeset
   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
7fa753e4420a Removed all trailing whitespace
andy_robinson
parents: 1677
diff changeset
   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
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   187
leadins=[
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   188
    "To characterize a linguistic level L,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   189
    "On the other hand,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   190
    "This suggests that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   191
    "It appears that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   192
    "Furthermore,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   193
    "We will bring evidence in favor of the following thesis: ",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   194
    "To provide a constituent structure for T(Z,K),",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   195
    "From C1, it follows that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   196
    "For any transformation which is sufficiently diversified in application to be of any interest,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   197
    "Analogously,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   198
    "Clearly,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   199
    "Note that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   200
    "Of course,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   201
    "Suppose, for instance, that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   202
    "Thus",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   203
    "With this clarification,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   204
    "Conversely,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   205
    "We have already seen that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   206
    "By combining adjunctions and certain deformations,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   207
    "I suggested that these results would follow from the assumption that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   208
    "If the position of the trace in (99c) were only relatively inaccessible to movement,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   209
    "However, this assumption is not correct, since",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   210
    "Comparing these examples with their parasitic gap counterparts in (96) and (97), we see that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   211
    "In the discussion of resumptive pronouns following (81),",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   212
    "So far,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   213
    "Nevertheless,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   214
    "For one thing,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   215
    "Summarizing, then, we assume that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   216
    "A consequence of the approach just outlined is that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   217
    "Presumably,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   218
    "On our assumptions,",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   219
    "It may be, then, that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   220
    "It must be emphasized, once again, that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   221
    "Let us continue to suppose that",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   222
    "Notice, incidentally, that",
2381
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   223
    "A majority  of informed linguistic specialists agree that",
3501
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   224
    "There is also a different approach to the [unification] problem,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   225
    "This approach divorces the cognitive sciences from a biological setting,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   226
    "The approach relies on the \"Turing Test,\" devised by mathematician Alan Turing,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   227
    "Adopting this approach,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   228
    "There is no fact, no meaningful question to be answered,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   229
    "Another superficial similarity is the interest in simulation of behavior,",
6542e870d41c more chomsky
rgbecker
parents: 3478
diff changeset
   230
    "A lot of sophistication has been developed about the utilization of machines for complex purposes,",
2377
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   231
    ]
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   232
 
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   233
subjects = [
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   234
    "the notion of level of grammaticalness",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   235
    "a case of semigrammaticalness of a different sort",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   236
    "most of the methodological work in modern linguistics",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   237
    "a subset of English sentences interesting on quite independent grounds",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   238
    "the natural general principle that will subsume this case",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   239
    "an important property of these three types of EC",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   240
    "any associated supporting element",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   241
    "the appearance of parasitic gaps in domains relatively inaccessible to ordinary extraction",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   242
    "the speaker-hearer's linguistic intuition",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   243
    "the descriptive power of the base component",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   244
    "the earlier discussion of deviance",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   245
    "this analysis of a formative as a pair of sets of features",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   246
    "this selectionally introduced contextual feature",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   247
    "a descriptively adequate grammar",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   248
    "the fundamental error of regarding functional notions as categorial",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   249
    "relational information",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   250
    "the systematic use of complex symbols",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   251
    "the theory of syntactic features developed earlier",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   252
    ]
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   253
 
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   254
verbs= [
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   255
    "can be defined in such a way as to impose",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   256
    "delimits",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   257
    "suffices to account for",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   258
    "cannot be arbitrary in",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   259
    "is not subject to",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   260
    "does not readily tolerate",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   261
    "raises serious doubts about",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   262
    "is not quite equivalent to",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   263
    "does not affect the structure of",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   264
    "may remedy and, at the same time, eliminate",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   265
    "is not to be considered in determining",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   266
    "is to be regarded as",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   267
    "is unspecified with respect to",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   268
    "is, apparently, determined by",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   269
    "is necessary to impose an interpretation on",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   270
    "appears to correlate rather closely with",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   271
    "is rather different from",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   272
    ]
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   273
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   274
objects = [
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   275
    "problems of phonemic and morphological analysis.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   276
    "a corpus of utterance tokens upon which conformity has been defined by the paired utterance test.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   277
    "the traditional practice of grammarians.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   278
    "the levels of acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g. (98d)).",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   279
    "a stipulation to place the constructions into these various categories.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   280
    "a descriptive fact.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   281
    "a parasitic gap construction.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   282
    "the extended c-command discussed in connection with (34).",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   283
    "the ultimate standard that determines the accuracy of any proposed grammar.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   284
    "the system of base rules exclusive of the lexicon.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   285
    "irrelevant intervening contexts in selectional rules.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   286
    "nondistinctness in the sense of distinctive feature theory.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   287
    "a general convention regarding the forms of the grammar.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   288
    "an abstract underlying order.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   289
    "an important distinction in language use.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   290
    "the requirement that branching is not tolerated within the dominance scope of a complex symbol.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   291
    "the strong generative capacity of the theory.",
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   292
    ]
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   293
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   294
def format_wisdom(text,line_length=72):
2381
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   295
    try:
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   296
        import textwrap
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   297
        return textwrap.fill(text, line_length)
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   298
    except:
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   299
        return text
2377
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   300
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   301
def chomsky(times = 1):
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   302
    if not isinstance(times, int):
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   303
        return format_wisdom(__doc__)
2381
9f858b4f5b68 randomtext.py: robustify textwrap import
rgbecker
parents: 2380
diff changeset
   304
    import random
2377
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   305
    prevparts = []
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   306
    newparts = []
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   307
    output = []
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3617
diff changeset
   308
    for i in range(times):
2377
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   309
        for partlist in (leadins, subjects, verbs, objects):
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   310
            while 1:
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   311
                part = random.choice(partlist)
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   312
                if part not in prevparts:
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   313
                    break
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   314
            newparts.append(part)
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   315
        output.append(' '.join(newparts))
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   316
        prevparts = newparts
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   317
        newparts = []
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   318
    return format_wisdom('  '.join(output))
613
40c5465a6a7c Added a PYTHON theme (it had to be done...).
johnprecedo
parents: 565
diff changeset
   319
2084
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   320
from reportlab import rl_config
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   321
if rl_config.invariant:
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   322
    if not getattr(rl_config,'_random',None):
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   323
        rl_config._random = 1
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   324
        import random
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3617
diff changeset
   325
        random.seed(2342471922)
2084
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   326
        del random
3db238ce25a8 Allow for rl_config.invariant
rgbecker
parents: 1683
diff changeset
   327
del rl_config
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
   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
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   331
    if type(theme)==type(''):
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   332
        if theme.lower()=='chomsky': return chomsky(sentences)
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   333
        elif theme.upper() in ('STARTUP','COMPUTERS','BLAH','BUZZWORD','STARTREK','PRINTING','PYTHON'):
3576
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   334
            theme = globals()[theme.upper()]
2380
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   335
        else:
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   336
            raise ValueError('Unknown theme "%s"' % theme)
f866c5fec142 randomtext.py: fix argument handling
rgbecker
parents: 2377
diff changeset
   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
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
   339
1677
1450177dd19e Exterminated all tab characters and added a test to make sure
andy_robinson
parents: 887
diff changeset
   340
    RANDOMWORDS = theme
558
f9013e25af9d Added a random text module
andy_robinson
parents:
diff changeset
   341
2377
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   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
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   354
e21ab2f40d6f randomtext.py: some improvements
rgbecker
parents: 2332
diff changeset
   355
if __name__=='__main__':
3478
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   356
    import sys
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   357
    argv = sys.argv[1:]
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   358
    if argv:
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   359
        theme = argv.pop(0)
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   360
        if argv:
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   361
            sentences = int(argv.pop(0))
3576
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   362
        else:
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   363
            sentences = 5
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   364
        try:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3617
diff changeset
   365
            print(randomText(theme,sentences))
3576
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   366
        except:
3901
8ec6fb062dee randomtext.py: fix 2.7 syntax
robin
parents: 3721
diff changeset
   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
c523e0c86e05 reportlab: make arguments easier in randomtext
rgbecker
parents: 3501
diff changeset
   369
            raise
3478
eda077ed3823 randomtext.py: add more main prog stuff
rgbecker
parents: 3029
diff changeset
   370
    else:
3721
0c93dd8ff567 initial changes from 2to3-3.3
rptlab
parents: 3617
diff changeset
   371
        print(chomsky(5))