|
24 | 24 | address=admin_email, roles='Admin') |
25 | 25 | user.create(username="anonymous", roles='Anonymous') |
26 | 26 | user.create(username='testuser', password=password.Password('testuser'), |
27 | | - realname='Test User', address='[email protected]') |
28 | | - |
29 | | -""" |
30 | | - http://code.activestate.com/recipes/440546-chomsky-random-text-generator/ |
31 | | -
|
32 | | - CHOMSKY is an aid to writing linguistic papers in the style |
33 | | - of the great master. It is based on selected phrases taken |
34 | | - from actual books and articles written by Noam Chomsky. |
35 | | - Upon request, it assembles the phrases in the elegant |
36 | | - stylistic patterns that Chomsky is noted for. |
37 | | - To generate n sentences of linguistic wisdom, type |
38 | | - (CHOMSKY n) -- for example |
39 | | - (CHOMSKY 5) generates half a screen of linguistic truth.""" |
40 | | - |
41 | | -leadins = """To characterize a linguistic level L, |
42 | | - On the other hand, |
43 | | - This suggests that |
44 | | - It appears that |
45 | | - Furthermore, |
46 | | - We will bring evidence in favor of the following thesis: |
47 | | - To provide a constituent structure for T(Z,K), |
48 | | - From C1, it follows that |
49 | | - For any transformation which is sufficiently diversified in application to be of any interest, |
50 | | - Analogously, |
51 | | - Clearly, |
52 | | - Note that |
53 | | - Of course, |
54 | | - Suppose, for instance, that |
55 | | - Thus |
56 | | - With this clarification, |
57 | | - Conversely, |
58 | | - We have already seen that |
59 | | - By combining adjunctions and certain deformations, |
60 | | - I suggested that these results would follow from the assumption that |
61 | | - If the position of the trace in (99c) were only relatively inaccessible to movement, |
62 | | - However, this assumption is not correct, since |
63 | | - Comparing these examples with their parasitic gap counterparts in (96) and (97), we see that |
64 | | - In the discussion of resumptive pronouns following (81), |
65 | | - So far, |
66 | | - Nevertheless, |
67 | | - For one thing, |
68 | | - Summarizing, then, we assume that |
69 | | - A consequence of the approach just outlined is that |
70 | | - Presumably, |
71 | | - On our assumptions, |
72 | | - It may be, then, that |
73 | | - It must be emphasized, once again, that |
74 | | - Let us continue to suppose that |
75 | | - Notice, incidentally, that """ |
76 | | -# List of LEADINs to buy time. |
77 | | - |
78 | | -subjects = """ the notion of level of grammaticalness |
79 | | - a case of semigrammaticalness of a different sort |
80 | | - most of the methodological work in modern linguistics |
81 | | - a subset of English sentences interesting on quite independent grounds |
82 | | - the natural general principle that will subsume this case |
83 | | - an important property of these three types of EC |
84 | | - any associated supporting element |
85 | | - the appearance of parasitic gaps in domains relatively inaccessible to ordinary extraction |
86 | | - the speaker-hearer's linguistic intuition |
87 | | - the descriptive power of the base component |
88 | | - the earlier discussion of deviance |
89 | | - this analysis of a formative as a pair of sets of features |
90 | | - this selectionally introduced contextual feature |
91 | | - a descriptively adequate grammar |
92 | | - the fundamental error of regarding functional notions as categorial |
93 | | - relational information |
94 | | - the systematic use of complex symbols |
95 | | - the theory of syntactic features developed earlier""" |
96 | | -# List of SUBJECTs chosen for maximum professorial macho. |
97 | | - |
98 | | -verbs = """can be defined in such a way as to impose |
99 | | - delimits |
100 | | - suffices to account for |
101 | | - cannot be arbitrary in |
102 | | - is not subject to |
103 | | - does not readily tolerate |
104 | | - raises serious doubts about |
105 | | - is not quite equivalent to |
106 | | - does not affect the structure of |
107 | | - may remedy and, at the same time, eliminate |
108 | | - is not to be considered in determining |
109 | | - is to be regarded as |
110 | | - is unspecified with respect to |
111 | | - is, apparently, determined by |
112 | | - is necessary to impose an interpretation on |
113 | | - appears to correlate rather closely with |
114 | | - is rather different from""" |
115 | | -#List of VERBs chosen for autorecursive obfuscation. |
116 | | - |
117 | | -objects = """ problems of phonemic and morphological analysis. |
118 | | - a corpus of utterance tokens upon which conformity has been defined by the paired utterance test. |
119 | | - the traditional practice of grammarians. |
120 | | - the levels of acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g. (98d)). |
121 | | - a stipulation to place the constructions into these various categories. |
122 | | - a descriptive fact. |
123 | | - a parasitic gap construction. |
124 | | - the extended c-command discussed in connection with (34). |
125 | | - the ultimate standard that determines the accuracy of any proposed grammar. |
126 | | - the system of base rules exclusive of the lexicon. |
127 | | - irrelevant intervening contexts in selectional rules. |
128 | | - nondistinctness in the sense of distinctive feature theory. |
129 | | - a general convention regarding the forms of the grammar. |
130 | | - an abstract underlying order. |
131 | | - an important distinction in language use. |
132 | | - the requirement that branching is not tolerated within the dominance scope of a complex symbol. |
133 | | - the strong generative capacity of the theory.""" |
134 | | -# List of OBJECTs selected for profound sententiousness. |
135 | | - |
136 | | -import textwrap, random |
137 | | -from itertools import chain, islice, izip |
138 | | - |
139 | | -def chomsky(times=1, line_length=72): |
140 | | - parts = [] |
141 | | - for part in (leadins, subjects, verbs, objects): |
142 | | - phraselist = map(str.strip, part.splitlines()) |
143 | | - random.shuffle(phraselist) |
144 | | - parts.append(phraselist) |
145 | | - output = chain(*islice(izip(*parts), 0, times)) |
146 | | - return textwrap.fill(' '.join(output), line_length) |
147 | | - |
148 | | -class IssueGenerator(): |
149 | | - """ See test/db_test_base.py """ |
150 | | - |
151 | | - def __init__(self, db): |
152 | | - """ Create a set of users with messages and issues """ |
153 | | - |
154 | | - self.subjects = map(str.strip, subjects.splitlines()) |
155 | | - u_m = {} |
156 | | - k = 30 |
157 | | - for user in ( |
158 | | - { 'username': 'ceo', 'address': '[email protected]'}, |
159 | | - { 'username': 'worker1', 'address': '[email protected]'}, |
160 | | - { 'username': 'worker2', 'address': '[email protected]'}, |
161 | | - { 'username': 'worker3', 'address': '[email protected]'}, |
162 | | - { 'username': 'worker4', 'address': '[email protected]'}, |
163 | | - { 'username': 'worker5', 'address': '[email protected]'}, |
164 | | - { 'username': 'worker6', 'address': '[email protected]'}): |
165 | | - u = db.user.create(**user) |
166 | | - u_m [u] = db.msg.create(author = u, content = chomsky(5) |
167 | | - , date = date.Date ('2013-01-%s' % k)) |
168 | | - k -= 1 |
169 | | - i = date.Interval('-1d') |
170 | | - for issue in ( |
171 | | - {'title': self.subject(), 'status': '2', 'assignedto': '6', |
172 | | - 'priority': '3', 'messages' : [u_m ['6']], 'nosy' : ['4']}, |
173 | | - {'title': self.subject(), 'status': '1', 'assignedto': '6', |
174 | | - 'priority': '3', 'messages' : [u_m ['6']], 'nosy' : ['5']}, |
175 | | - {'title': self.subject(), 'status': '2', 'assignedto': '7', |
176 | | - 'priority': '3', 'messages' : [u_m ['7']]}, |
177 | | - {'title': self.subject(), 'status': '1', 'assignedto': '8', |
178 | | - 'priority': '3', 'messages' : [u_m ['8']]}, |
179 | | - {'title': self.subject(), 'status': '2', 'assignedto': '9', |
180 | | - 'priority': '3', 'messages' : [u_m ['9']]}, |
181 | | - {'title': self.subject(), 'status': '1', 'assignedto': '10', |
182 | | - 'priority': '3', 'messages' : [u_m ['10']]}, |
183 | | - {'title': self.subject(), 'status': '2', 'assignedto': '10', |
184 | | - 'priority': '3', 'messages' : [u_m ['10']]}, |
185 | | - {'title': self.subject(), 'status': '1', 'assignedto': '10', |
186 | | - 'priority': '3', 'messages' : [u_m ['10'], u_m ['9']]}): |
187 | | - db.issue.create(**issue) |
188 | | - |
189 | | - def subject(self): |
190 | | - return self.subjects[random.randint(0, len(self.subjects))] |
191 | | - |
192 | | -IssueGenerator(db) |
| 27 | + realname='Test User', roles='User', address='[email protected]') |
0 commit comments