wordnik 4.06.00 → 4.06.01

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,453 @@
1
+ # HEY HACKER! THIS IS AN AUTO-GENERATED FILE.
2
+ # So don't bother editing it. To see how it's built, take a look at the Rakefile
3
+
4
+ module CorpusMethods
5
+
6
+ # Fetches recent views from the website.
7
+ #
8
+ def get_recent_views(*args)
9
+ http_method = :get
10
+ path = '/corpus/recentViews'
11
+
12
+ # Ruby turns all key-value arguments at the end into a single hash
13
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
14
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
15
+ last_arg = args.pop if args.last.is_a?(Hash)
16
+ last_arg = args.pop if args.last.is_a?(Array)
17
+ last_arg ||= {}
18
+
19
+ # Look for a kwarg called :request_only, whose presence indicates
20
+ # that we want the request itself back, not the response body
21
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
22
+ request_only = true
23
+ last_arg.delete(:request_only)
24
+ end
25
+
26
+ params = last_arg
27
+ body ||= {}
28
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
29
+ request_only ? request : request.response.body
30
+ end
31
+
32
+ # Gets WordFrequency data
33
+ #
34
+ def get_word_frequencies(statsType, object, *args)
35
+ http_method = :get
36
+ path = '/corpus/words/{statsType}/{object}'
37
+ path.sub!('{statsType}', statsType.to_s)
38
+ path.sub!('{object}', object.to_s)
39
+
40
+ # Ruby turns all key-value arguments at the end into a single hash
41
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
42
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
43
+ last_arg = args.pop if args.last.is_a?(Hash)
44
+ last_arg = args.pop if args.last.is_a?(Array)
45
+ last_arg ||= {}
46
+
47
+ # Look for a kwarg called :request_only, whose presence indicates
48
+ # that we want the request itself back, not the response body
49
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
50
+ request_only = true
51
+ last_arg.delete(:request_only)
52
+ end
53
+
54
+ params = last_arg
55
+ body ||= {}
56
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
57
+ request_only ? request : request.response.body
58
+ end
59
+
60
+ # Gets Dictionary Statistics data
61
+ #
62
+ def get_word_frequencies(*args)
63
+ http_method = :get
64
+ path = '/corpus/dictionaryStats'
65
+
66
+ # Ruby turns all key-value arguments at the end into a single hash
67
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
68
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
69
+ last_arg = args.pop if args.last.is_a?(Hash)
70
+ last_arg = args.pop if args.last.is_a?(Array)
71
+ last_arg ||= {}
72
+
73
+ # Look for a kwarg called :request_only, whose presence indicates
74
+ # that we want the request itself back, not the response body
75
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
76
+ request_only = true
77
+ last_arg.delete(:request_only)
78
+ end
79
+
80
+ params = last_arg
81
+ body ||= {}
82
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
83
+ request_only ? request : request.response.body
84
+ end
85
+
86
+ # Gets Dictionary Statistics data
87
+ #
88
+ def get_word_frequencies(*args)
89
+ http_method = :get
90
+ path = '/corpus/firstUsed'
91
+
92
+ # Ruby turns all key-value arguments at the end into a single hash
93
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
94
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
95
+ last_arg = args.pop if args.last.is_a?(Hash)
96
+ last_arg = args.pop if args.last.is_a?(Array)
97
+ last_arg ||= {}
98
+
99
+ # Look for a kwarg called :request_only, whose presence indicates
100
+ # that we want the request itself back, not the response body
101
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
102
+ request_only = true
103
+ last_arg.delete(:request_only)
104
+ end
105
+
106
+ params = last_arg
107
+ body ||= {}
108
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
109
+ request_only ? request : request.response.body
110
+ end
111
+
112
+ # Returns information about API parameters
113
+ #
114
+ def get_help(*args)
115
+ http_method = :get
116
+ path = '/corpus'
117
+
118
+ # Ruby turns all key-value arguments at the end into a single hash
119
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
120
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
121
+ last_arg = args.pop if args.last.is_a?(Hash)
122
+ last_arg = args.pop if args.last.is_a?(Array)
123
+ last_arg ||= {}
124
+
125
+ # Look for a kwarg called :request_only, whose presence indicates
126
+ # that we want the request itself back, not the response body
127
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
128
+ request_only = true
129
+ last_arg.delete(:request_only)
130
+ end
131
+
132
+ params = last_arg
133
+ body ||= {}
134
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
135
+ request_only ? request : request.response.body
136
+ end
137
+
138
+ # Returns the count of documents in the Corpus.
139
+ #
140
+ def get_total_document_count(*args)
141
+ http_method = :get
142
+ path = '/corpus/totalDocumentCount'
143
+
144
+ # Ruby turns all key-value arguments at the end into a single hash
145
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
146
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
147
+ last_arg = args.pop if args.last.is_a?(Hash)
148
+ last_arg = args.pop if args.last.is_a?(Array)
149
+ last_arg ||= {}
150
+
151
+ # Look for a kwarg called :request_only, whose presence indicates
152
+ # that we want the request itself back, not the response body
153
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
154
+ request_only = true
155
+ last_arg.delete(:request_only)
156
+ end
157
+
158
+ params = last_arg
159
+ body ||= {}
160
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
161
+ request_only ? request : request.response.body
162
+ end
163
+
164
+ # Processes text input.
165
+ # Returns tagged and processed text based on the input string.
166
+ #
167
+ def process_text(body, *args)
168
+ http_method = :post
169
+ path = '/corpus/processText'
170
+
171
+ # Ruby turns all key-value arguments at the end into a single hash
172
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
173
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
174
+ last_arg = args.pop if args.last.is_a?(Hash)
175
+ last_arg = args.pop if args.last.is_a?(Array)
176
+ last_arg ||= {}
177
+
178
+ # Look for a kwarg called :request_only, whose presence indicates
179
+ # that we want the request itself back, not the response body
180
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
181
+ request_only = true
182
+ last_arg.delete(:request_only)
183
+ end
184
+
185
+ params = last_arg
186
+ body ||= {}
187
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
188
+ request_only ? request : request.response.body
189
+ end
190
+
191
+ # Returns corpus-wide PunctuationFactor.
192
+ #
193
+ def get_punctuation_factor(*args)
194
+ http_method = :get
195
+ path = '/corpus/punctuationFactor'
196
+
197
+ # Ruby turns all key-value arguments at the end into a single hash
198
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
199
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
200
+ last_arg = args.pop if args.last.is_a?(Hash)
201
+ last_arg = args.pop if args.last.is_a?(Array)
202
+ last_arg ||= {}
203
+
204
+ # Look for a kwarg called :request_only, whose presence indicates
205
+ # that we want the request itself back, not the response body
206
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
207
+ request_only = true
208
+ last_arg.delete(:request_only)
209
+ end
210
+
211
+ params = last_arg
212
+ body ||= {}
213
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
214
+ request_only ? request : request.response.body
215
+ end
216
+
217
+ # Receives info on phrases which should be captured
218
+ #
219
+ def get_punctuation_factor(body, *args)
220
+ http_method = :post
221
+ path = '/corpus/phraseFeedback'
222
+
223
+ # Ruby turns all key-value arguments at the end into a single hash
224
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
225
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
226
+ last_arg = args.pop if args.last.is_a?(Hash)
227
+ last_arg = args.pop if args.last.is_a?(Array)
228
+ last_arg ||= {}
229
+
230
+ # Look for a kwarg called :request_only, whose presence indicates
231
+ # that we want the request itself back, not the response body
232
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
233
+ request_only = true
234
+ last_arg.delete(:request_only)
235
+ end
236
+
237
+ params = last_arg
238
+ body ||= {}
239
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
240
+ request_only ? request : request.response.body
241
+ end
242
+
243
+ # Returns document-level stats.
244
+ #
245
+ def get_document_stats(*args)
246
+ http_method = :get
247
+ path = '/corpus/documentStats'
248
+
249
+ # Ruby turns all key-value arguments at the end into a single hash
250
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
251
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
252
+ last_arg = args.pop if args.last.is_a?(Hash)
253
+ last_arg = args.pop if args.last.is_a?(Array)
254
+ last_arg ||= {}
255
+
256
+ # Look for a kwarg called :request_only, whose presence indicates
257
+ # that we want the request itself back, not the response body
258
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
259
+ request_only = true
260
+ last_arg.delete(:request_only)
261
+ end
262
+
263
+ params = last_arg
264
+ body ||= {}
265
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
266
+ request_only ? request : request.response.body
267
+ end
268
+
269
+ # Gets corpus-level WordFrequency
270
+ #
271
+ def get_corpus_word_frequencies(*args)
272
+ http_method = :get
273
+ path = '/corpus/words'
274
+
275
+ # Ruby turns all key-value arguments at the end into a single hash
276
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
277
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
278
+ last_arg = args.pop if args.last.is_a?(Hash)
279
+ last_arg = args.pop if args.last.is_a?(Array)
280
+ last_arg ||= {}
281
+
282
+ # Look for a kwarg called :request_only, whose presence indicates
283
+ # that we want the request itself back, not the response body
284
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
285
+ request_only = true
286
+ last_arg.delete(:request_only)
287
+ end
288
+
289
+ params = last_arg
290
+ body ||= {}
291
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
292
+ request_only ? request : request.response.body
293
+ end
294
+
295
+ # Returns word relationships.
296
+ #
297
+ def get_dym(wordstring, *args)
298
+ http_method = :get
299
+ path = '/corpus/dymInternal/{wordstring}'
300
+ path.sub!('{wordstring}', wordstring.to_s)
301
+
302
+ # Ruby turns all key-value arguments at the end into a single hash
303
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
304
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
305
+ last_arg = args.pop if args.last.is_a?(Hash)
306
+ last_arg = args.pop if args.last.is_a?(Array)
307
+ last_arg ||= {}
308
+
309
+ # Look for a kwarg called :request_only, whose presence indicates
310
+ # that we want the request itself back, not the response body
311
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
312
+ request_only = true
313
+ last_arg.delete(:request_only)
314
+ end
315
+
316
+ params = last_arg
317
+ body ||= {}
318
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
319
+ request_only ? request : request.response.body
320
+ end
321
+
322
+ # Returns recently listed words.
323
+ #
324
+ def get_recent_listed_words(*args)
325
+ http_method = :get
326
+ path = '/corpus/recentListedWords'
327
+
328
+ # Ruby turns all key-value arguments at the end into a single hash
329
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
330
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
331
+ last_arg = args.pop if args.last.is_a?(Hash)
332
+ last_arg = args.pop if args.last.is_a?(Array)
333
+ last_arg ||= {}
334
+
335
+ # Look for a kwarg called :request_only, whose presence indicates
336
+ # that we want the request itself back, not the response body
337
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
338
+ request_only = true
339
+ last_arg.delete(:request_only)
340
+ end
341
+
342
+ params = last_arg
343
+ body ||= {}
344
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
345
+ request_only ? request : request.response.body
346
+ end
347
+
348
+ # Mock method to return Contextual Lookup info.
349
+ # Internal Only
350
+ #
351
+ def get_mock_contextual_lookup_info(*args)
352
+ http_method = :get
353
+ path = '/corpus/contextualLookup'
354
+
355
+ # Ruby turns all key-value arguments at the end into a single hash
356
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
357
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
358
+ last_arg = args.pop if args.last.is_a?(Hash)
359
+ last_arg = args.pop if args.last.is_a?(Array)
360
+ last_arg ||= {}
361
+
362
+ # Look for a kwarg called :request_only, whose presence indicates
363
+ # that we want the request itself back, not the response body
364
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
365
+ request_only = true
366
+ last_arg.delete(:request_only)
367
+ end
368
+
369
+ params = last_arg
370
+ body ||= {}
371
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
372
+ request_only ? request : request.response.body
373
+ end
374
+
375
+ # Fetches ContextualLookup info.
376
+ #
377
+ def get_contextual_lookup_info(*args)
378
+ http_method = :post
379
+ path = '/corpus/contextualLookup'
380
+
381
+ # Ruby turns all key-value arguments at the end into a single hash
382
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
383
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
384
+ last_arg = args.pop if args.last.is_a?(Hash)
385
+ last_arg = args.pop if args.last.is_a?(Array)
386
+ last_arg ||= {}
387
+
388
+ # Look for a kwarg called :request_only, whose presence indicates
389
+ # that we want the request itself back, not the response body
390
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
391
+ request_only = true
392
+ last_arg.delete(:request_only)
393
+ end
394
+
395
+ params = last_arg
396
+ body ||= {}
397
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
398
+ request_only ? request : request.response.body
399
+ end
400
+
401
+ # Returns the count of tokens in the Corpus.
402
+ #
403
+ def get_total_tokens_count(*args)
404
+ http_method = :get
405
+ path = '/corpus/totalWordCount'
406
+
407
+ # Ruby turns all key-value arguments at the end into a single hash
408
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
409
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
410
+ last_arg = args.pop if args.last.is_a?(Hash)
411
+ last_arg = args.pop if args.last.is_a?(Array)
412
+ last_arg ||= {}
413
+
414
+ # Look for a kwarg called :request_only, whose presence indicates
415
+ # that we want the request itself back, not the response body
416
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
417
+ request_only = true
418
+ last_arg.delete(:request_only)
419
+ end
420
+
421
+ params = last_arg
422
+ body ||= {}
423
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
424
+ request_only ? request : request.response.body
425
+ end
426
+
427
+ # Returns the count of sentences in the Corpus.
428
+ #
429
+ def get_total_sentences_count(*args)
430
+ http_method = :get
431
+ path = '/corpus/sentenceCount'
432
+
433
+ # Ruby turns all key-value arguments at the end into a single hash
434
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
435
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
436
+ last_arg = args.pop if args.last.is_a?(Hash)
437
+ last_arg = args.pop if args.last.is_a?(Array)
438
+ last_arg ||= {}
439
+
440
+ # Look for a kwarg called :request_only, whose presence indicates
441
+ # that we want the request itself back, not the response body
442
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
443
+ request_only = true
444
+ last_arg.delete(:request_only)
445
+ end
446
+
447
+ params = last_arg
448
+ body ||= {}
449
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
450
+ request_only ? request : request.response.body
451
+ end
452
+
453
+ end