wlapi 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/doc/WLAPI/API.html DELETED
@@ -1,1008 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: WLAPI::API</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/wlapi_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/wlapi.rb">lib/wlapi.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link">Object</p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-new">::new</a></li>
73
-
74
- <li><a href="#method-i-baseform">#baseform</a></li>
75
-
76
- <li><a href="#method-i-cooccurrences">#cooccurrences</a></li>
77
-
78
- <li><a href="#method-i-cooccurrences_all">#cooccurrences_all</a></li>
79
-
80
- <li><a href="#method-i-experimental_synonyms">#experimental_synonyms</a></li>
81
-
82
- <li><a href="#method-i-frequencies">#frequencies</a></li>
83
-
84
- <li><a href="#method-i-get_answer">#get_answer</a></li>
85
-
86
- <li><a href="#method-i-kookurrenzschnitt">#kookurrenzschnitt</a></li>
87
-
88
- <li><a href="#method-i-left_collocation_finder">#left_collocation_finder</a></li>
89
-
90
- <li><a href="#method-i-left_neighbours">#left_neighbours</a></li>
91
-
92
- <li><a href="#method-i-query">#query</a></li>
93
-
94
- <li><a href="#method-i-right_collocation_finder">#right_collocation_finder</a></li>
95
-
96
- <li><a href="#method-i-right_neighbours">#right_neighbours</a></li>
97
-
98
- <li><a href="#method-i-sachgebiet">#sachgebiet</a></li>
99
-
100
- <li><a href="#method-i-sentences">#sentences</a></li>
101
-
102
- <li><a href="#method-i-similarity">#similarity</a></li>
103
-
104
- <li><a href="#method-i-synonyms">#synonyms</a></li>
105
-
106
- <li><a href="#method-i-thesaurus">#thesaurus</a></li>
107
-
108
- <li><a href="#method-i-wordforms">#wordforms</a></li>
109
-
110
- </ul>
111
- </div>
112
-
113
-
114
- <!-- Included Modules -->
115
-
116
- </div>
117
-
118
- <div id="project-metadata">
119
-
120
-
121
- <div id="fileindex-section" class="section project-section">
122
- <h3 class="section-header">Files</h3>
123
- <ul>
124
-
125
- <li class="file"><a href="../INSTALL.html">INSTALL</a></li>
126
-
127
- <li class="file"><a href="../LICENSE.html">LICENSE</a></li>
128
-
129
- <li class="file"><a href="../README.html">README</a></li>
130
-
131
- </ul>
132
- </div>
133
-
134
-
135
- <div id="classindex-section" class="section project-section">
136
- <h3 class="section-header">Class Index
137
- <span class="search-toggle"><img src="../images/find.png"
138
- height="16" width="16" alt="[+]"
139
- title="show/hide quicksearch" /></span></h3>
140
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
141
- <fieldset>
142
- <legend>Quicksearch</legend>
143
- <input type="text" name="quicksearch" value=""
144
- class="quicksearch-field" />
145
- </fieldset>
146
- </form>
147
-
148
- <ul class="link-list">
149
-
150
- <li><a href="../WLAPI.html">WLAPI</a></li>
151
-
152
- <li><a href="../WLAPI/API.html">WLAPI::API</a></li>
153
-
154
- </ul>
155
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
156
- </div>
157
-
158
-
159
- </div>
160
- </div>
161
-
162
- <div id="documentation">
163
- <h1 class="class">WLAPI::API</h1>
164
-
165
- <div id="description">
166
- <p>
167
- This class represents an interface to the linguistic web services provided
168
- by the University of Leipzig.
169
- </p>
170
- <p>
171
- See the project &#8216;Wortschatz Leipzig&#8217; for more details.
172
- </p>
173
-
174
- </div>
175
-
176
- <!-- Constants -->
177
-
178
-
179
- <!-- Attributes -->
180
-
181
-
182
- <!-- Methods -->
183
-
184
- <div id="public-class-method-details" class="method-section section">
185
- <h3 class="section-header">Public Class Methods</h3>
186
-
187
-
188
- <div id="new-method" class="method-detail ">
189
- <a name="method-c-new"></a>
190
-
191
- <div class="method-heading">
192
-
193
- <span class="method-name">new</span><span
194
- class="method-args">(login = 'anonymous', pass = 'anonymous')</span>
195
- <span class="method-click-advice">click to toggle source</span>
196
-
197
- </div>
198
-
199
- <div class="method-description">
200
-
201
- <p>
202
- At the creation point clients for all services are being instantiated. You
203
- can also set the login and the password (it defaults to
204
- &#8216;anonymous&#8217;).
205
- </p>
206
-
207
-
208
-
209
- <div class="method-source-code"
210
- id="new-source">
211
- <pre>
212
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 24</span>
213
- 24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">login</span> = <span class="ruby-value str">'anonymous'</span>, <span class="ruby-identifier">pass</span> = <span class="ruby-value str">'anonymous'</span>)
214
- 25: <span class="ruby-comment cmt"># This hash contains the URLs to the single services.</span>
215
- 26: <span class="ruby-ivar">@services</span> = {
216
- 27: <span class="ruby-value str">'Thesaurus'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Thesaurus'</span>,
217
- 28: <span class="ruby-value str">'Baseform'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Baseform'</span>,
218
- 29: <span class="ruby-value str">'Similarity'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Similarity'</span>,
219
- 30: <span class="ruby-value str">'Synonyms'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Synonyms'</span>,
220
- 31: <span class="ruby-value str">'Sachgebiet'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Sachgebiet'</span>,
221
- 32: <span class="ruby-value str">'Frequencies'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Frequencies'</span>,
222
- 33: <span class="ruby-value str">'Kookurrenzschnitt'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Kookkurrenzschnitt'</span>,
223
- 34: <span class="ruby-value str">'ExperimentalSynonyms'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/ExperimentalSynonyms'</span>,
224
- 35: <span class="ruby-value str">'RightCollocationFinder'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/RightCollocationFinder'</span>,
225
- 36: <span class="ruby-value str">'LeftCollocationFinder'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/LeftCollocationFinder'</span>,
226
- 37: <span class="ruby-value str">'Wordforms'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Wordforms'</span>,
227
- 38: <span class="ruby-value str">'CooccurrencesAll'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/CooccurrencesAll'</span>,
228
- 39: <span class="ruby-value str">'LeftNeighbours'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/LeftNeighbours'</span>,
229
- 40: <span class="ruby-value str">'RightNeighbours'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/RightNeighbours'</span>,
230
- 41: <span class="ruby-value str">'Sentences'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Sentences'</span>,
231
- 42: <span class="ruby-value str">'Cooccurrences'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'http://wortschatz.uni-leipzig.de/axis/services/Cooccurrences'</span>
232
- 43: <span class="ruby-comment cmt"># no MARSService and Kreuzwortrraetsel</span>
233
- 44: }
234
- 45:
235
- 46: <span class="ruby-comment cmt"># cl short for client.</span>
236
- 47: <span class="ruby-comment cmt"># Dynamically create all the clients and set access credentials.</span>
237
- 48: <span class="ruby-comment cmt"># It can be a very bad idea to instantiate all the clients at once,</span>
238
- 49: <span class="ruby-comment cmt"># we should investigate the typical user behaviour.</span>
239
- 50: <span class="ruby-comment cmt"># If only one service is used in the separate session =&gt; rewrite the class!</span>
240
- 51: <span class="ruby-ivar">@services</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
241
- 52: <span class="ruby-identifier">cl_name</span> = <span class="ruby-value str">'@cl_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>
242
- 53: <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;#{cl_name} = Savon::Client.new(val)&quot;</span>)
243
- 54: <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;#{cl_name}.request.basic_auth(login, pass)&quot;</span>)
244
- 55: <span class="ruby-keyword kw">end</span>
245
- 56:
246
- 57: <span class="ruby-comment cmt"># Savon creates very verbose logs, switching off.</span>
247
- 58: <span class="ruby-constant">Savon</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">log</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$DEBUG</span>
248
- 59: <span class="ruby-keyword kw">end</span></pre>
249
- </div>
250
-
251
- </div>
252
-
253
-
254
-
255
-
256
- </div>
257
-
258
-
259
- </div>
260
-
261
- <div id="public-instance-method-details" class="method-section section">
262
- <h3 class="section-header">Public Instance Methods</h3>
263
-
264
-
265
- <div id="baseform-method" class="method-detail ">
266
- <a name="method-i-baseform"></a>
267
-
268
- <div class="method-heading">
269
-
270
- <span class="method-name">baseform</span><span
271
- class="method-args">()</span>
272
- <span class="method-click-advice">click to toggle source</span>
273
-
274
- </div>
275
-
276
- <div class="method-description">
277
-
278
- <p>
279
- This method gets the baseform (whatever it is :) not lemma). Returns the
280
- lemmatized (base) form of the input word.
281
- </p>
282
-
283
-
284
-
285
- <div class="method-source-code"
286
- id="baseform-source">
287
- <pre>
288
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 81</span>
289
- 81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">baseform</span>
290
- 82: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
291
- 83: <span class="ruby-keyword kw">end</span></pre>
292
- </div>
293
-
294
- </div>
295
-
296
-
297
-
298
-
299
- </div>
300
-
301
-
302
- <div id="cooccurrences-method" class="method-detail ">
303
- <a name="method-i-cooccurrences"></a>
304
-
305
- <div class="method-heading">
306
-
307
- <span class="method-name">cooccurrences</span><span
308
- class="method-args">()</span>
309
- <span class="method-click-advice">click to toggle source</span>
310
-
311
- </div>
312
-
313
- <div class="method-description">
314
-
315
- <p>
316
- Returns statistically significant co-occurrences of the input word.
317
- </p>
318
-
319
-
320
-
321
- <div class="method-source-code"
322
- id="cooccurrences-source">
323
- <pre>
324
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 185</span>
325
- 185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cooccurrences</span>
326
- 186: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
327
- 187: <span class="ruby-keyword kw">end</span></pre>
328
- </div>
329
-
330
- </div>
331
-
332
-
333
-
334
-
335
- </div>
336
-
337
-
338
- <div id="cooccurrences-all-method" class="method-detail ">
339
- <a name="method-i-cooccurrences_all"></a>
340
-
341
- <div class="method-heading">
342
-
343
- <span class="method-name">cooccurrences_all</span><span
344
- class="method-args">()</span>
345
- <span class="method-click-advice">click to toggle source</span>
346
-
347
- </div>
348
-
349
- <div class="method-description">
350
-
351
- <p>
352
- Returns statistically significant co-occurrences of the input word.
353
- However, it searches in the unrestricted version of the co-occurrences
354
- table as in the Cooccurrences services, which means significantly longer
355
- wait times.
356
- </p>
357
-
358
-
359
-
360
- <div class="method-source-code"
361
- id="cooccurrences-all-source">
362
- <pre>
363
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 193</span>
364
- 193: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cooccurrences_all</span>
365
- 194: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
366
- 195: <span class="ruby-keyword kw">end</span></pre>
367
- </div>
368
-
369
- </div>
370
-
371
-
372
-
373
-
374
- </div>
375
-
376
-
377
- <div id="experimental-synonyms-method" class="method-detail ">
378
- <a name="method-i-experimental_synonyms"></a>
379
-
380
- <div class="method-heading">
381
-
382
- <span class="method-name">experimental_synonyms</span><span
383
- class="method-args">()</span>
384
- <span class="method-click-advice">click to toggle source</span>
385
-
386
- </div>
387
-
388
- <div class="method-description">
389
-
390
- <p>
391
- This service delivers an experimental synonyms request for internal tests.
392
- &#8212; don&#8217;t know, if we have to include this service...
393
- </p>
394
-
395
-
396
-
397
- <div class="method-source-code"
398
- id="experimental-synonyms-source">
399
- <pre>
400
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 159</span>
401
- 159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">experimental_synonyms</span>
402
- 160: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
403
- 161: <span class="ruby-keyword kw">end</span></pre>
404
- </div>
405
-
406
- </div>
407
-
408
-
409
-
410
-
411
- </div>
412
-
413
-
414
- <div id="frequencies-method" class="method-detail ">
415
- <a name="method-i-frequencies"></a>
416
-
417
- <div class="method-heading">
418
-
419
- <span class="method-name">frequencies</span><span
420
- class="method-args">()</span>
421
- <span class="method-click-advice">click to toggle source</span>
422
-
423
- </div>
424
-
425
- <div class="method-description">
426
-
427
- <p>
428
- Returns the frequency and frequency class of the input word. Frequency
429
- class is computed in relation to the most frequent word in the corpus. The
430
- higher the class, the rarer the word.
431
- </p>
432
-
433
-
434
-
435
- <div class="method-source-code"
436
- id="frequencies-source">
437
- <pre>
438
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 75</span>
439
- 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">frequencies</span>
440
- 76: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
441
- 77: <span class="ruby-keyword kw">end</span></pre>
442
- </div>
443
-
444
- </div>
445
-
446
-
447
-
448
-
449
- </div>
450
-
451
-
452
- <div id="kookurrenzschnitt-method" class="method-detail ">
453
- <a name="method-i-kookurrenzschnitt"></a>
454
-
455
- <div class="method-heading">
456
-
457
- <span class="method-name">kookurrenzschnitt</span><span
458
- class="method-args">()</span>
459
- <span class="method-click-advice">click to toggle source</span>
460
-
461
- </div>
462
-
463
- <div class="method-description">
464
-
465
- <p>
466
- Returns the intersection of the co-occurrences of the two given words. The
467
- result set is ordered according to the sum of the significances in
468
- descending order. Note that due to the join involved, this make take some
469
- time.
470
- </p>
471
-
472
-
473
-
474
- <div class="method-source-code"
475
- id="kookurrenzschnitt-source">
476
- <pre>
477
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 201</span>
478
- 201: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">kookurrenzschnitt</span>
479
- 202: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
480
- 203: <span class="ruby-keyword kw">end</span></pre>
481
- </div>
482
-
483
- </div>
484
-
485
-
486
-
487
-
488
- </div>
489
-
490
-
491
- <div id="left-collocation-finder-method" class="method-detail ">
492
- <a name="method-i-left_collocation_finder"></a>
493
-
494
- <div class="method-heading">
495
-
496
- <span class="method-name">left_collocation_finder</span><span
497
- class="method-args">()</span>
498
- <span class="method-click-advice">click to toggle source</span>
499
-
500
- </div>
501
-
502
- <div class="method-description">
503
-
504
- <p>
505
- Attempts to find linguistic collocations that occur to the left of the
506
- given input word. The parameter Wortart accepts four values A,V,N,S which
507
- stand for adjective, verb, noun and stopword, respectively. The parameter
508
- restricts the type of words found.
509
- </p>
510
-
511
-
512
-
513
- <div class="method-source-code"
514
- id="left-collocation-finder-source">
515
- <pre>
516
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 180</span>
517
- 180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_collocation_finder</span>
518
- 181: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
519
- 182: <span class="ruby-keyword kw">end</span></pre>
520
- </div>
521
-
522
- </div>
523
-
524
-
525
-
526
-
527
- </div>
528
-
529
-
530
- <div id="left-neighbours-method" class="method-detail ">
531
- <a name="method-i-left_neighbours"></a>
532
-
533
- <div class="method-heading">
534
-
535
- <span class="method-name">left_neighbours</span><span
536
- class="method-args">(word, limit)</span>
537
- <span class="method-click-advice">click to toggle source</span>
538
-
539
- </div>
540
-
541
- <div class="method-description">
542
-
543
- <p>
544
- For a given input word, returns statistically significant left neighbours
545
- (words co-occurring immediately to the left of the input word). &#8212; ok,
546
- but results should be filtered
547
- </p>
548
-
549
-
550
-
551
- <div class="method-source-code"
552
- id="left-neighbours-source">
553
- <pre>
554
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 132</span>
555
- 132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_neighbours</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>)
556
- 133: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_LeftNeighbours</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'LeftNeighbours'</span>])
557
- 134: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
558
- 135: <span class="ruby-keyword kw">end</span></pre>
559
- </div>
560
-
561
- </div>
562
-
563
-
564
-
565
-
566
- </div>
567
-
568
-
569
- <div id="right-collocation-finder-method" class="method-detail ">
570
- <a name="method-i-right_collocation_finder"></a>
571
-
572
- <div class="method-heading">
573
-
574
- <span class="method-name">right_collocation_finder</span><span
575
- class="method-args">()</span>
576
- <span class="method-click-advice">click to toggle source</span>
577
-
578
- </div>
579
-
580
- <div class="method-description">
581
-
582
- <p>
583
- Attempts to find linguistic collocations that occur to the right of the
584
- given input word. The parameter Wortart accepts four values A,V,N,S which
585
- stand for adjective, verb, noun and stopword, respectively. The parameter
586
- restricts the type of words found.
587
- </p>
588
-
589
-
590
-
591
- <div class="method-source-code"
592
- id="right-collocation-finder-source">
593
- <pre>
594
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 171</span>
595
- 171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_collocation_finder</span>
596
- 172: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
597
- 173: <span class="ruby-keyword kw">end</span></pre>
598
- </div>
599
-
600
- </div>
601
-
602
-
603
-
604
-
605
- </div>
606
-
607
-
608
- <div id="right-neighbours-method" class="method-detail ">
609
- <a name="method-i-right_neighbours"></a>
610
-
611
- <div class="method-heading">
612
-
613
- <span class="method-name">right_neighbours</span><span
614
- class="method-args">(word, limit)</span>
615
- <span class="method-click-advice">click to toggle source</span>
616
-
617
- </div>
618
-
619
- <div class="method-description">
620
-
621
- <p>
622
- For a given input word, returns statistically significant right neighbours
623
- (words co-occurring immediately to the right of the input word). &#8212;
624
- ok, but results should be filtered
625
- </p>
626
-
627
-
628
-
629
- <div class="method-source-code"
630
- id="right-neighbours-source">
631
- <pre>
632
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 141</span>
633
- 141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_neighbours</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>)
634
- 142: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_RightNeighbours</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'RightNeighbours'</span>])
635
- 143: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
636
- 144: <span class="ruby-keyword kw">end</span></pre>
637
- </div>
638
-
639
- </div>
640
-
641
-
642
-
643
-
644
- </div>
645
-
646
-
647
- <div id="sachgebiet-method" class="method-detail ">
648
- <a name="method-i-sachgebiet"></a>
649
-
650
- <div class="method-heading">
651
-
652
- <span class="method-name">sachgebiet</span><span
653
- class="method-args">()</span>
654
- <span class="method-click-advice">click to toggle source</span>
655
-
656
- </div>
657
-
658
- <div class="method-description">
659
-
660
- <p>
661
- Returns categories for a given input word. &#8212; Is it a good name? all
662
- names are in English, but here...
663
- </p>
664
-
665
-
666
-
667
- <div class="method-source-code"
668
- id="sachgebiet-source">
669
- <pre>
670
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 88</span>
671
- 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sachgebiet</span>
672
- 89: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
673
- 90: <span class="ruby-keyword kw">end</span></pre>
674
- </div>
675
-
676
- </div>
677
-
678
-
679
-
680
-
681
- </div>
682
-
683
-
684
- <div id="sentences-method" class="method-detail ">
685
- <a name="method-i-sentences"></a>
686
-
687
- <div class="method-heading">
688
-
689
- <span class="method-name">sentences</span><span
690
- class="method-args">(word, limit)</span>
691
- <span class="method-click-advice">click to toggle source</span>
692
-
693
- </div>
694
-
695
- <div class="method-description">
696
-
697
- <p>
698
- ok, but results should be filtered Returns sample sentences containing the
699
- input word.
700
- </p>
701
-
702
-
703
-
704
- <div class="method-source-code"
705
- id="sentences-source">
706
- <pre>
707
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 123</span>
708
- 123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sentences</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>)
709
- 124: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_Sentences</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'Sentences'</span>])
710
- 125: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
711
- 126: <span class="ruby-keyword kw">end</span></pre>
712
- </div>
713
-
714
- </div>
715
-
716
-
717
-
718
-
719
- </div>
720
-
721
-
722
- <div id="similarity-method" class="method-detail ">
723
- <a name="method-i-similarity"></a>
724
-
725
- <div class="method-heading">
726
-
727
- <span class="method-name">similarity</span><span
728
- class="method-args">()</span>
729
- <span class="method-click-advice">click to toggle source</span>
730
-
731
- </div>
732
-
733
- <div class="method-description">
734
-
735
- <p>
736
- Returns automatically computed contextually similar words of the input
737
- word. Such similar words may be antonyms, hyperonyms, synonyms, cohyponyms
738
- or other. Note that due to the huge amount of data any query to this
739
- services may take a long time.
740
- </p>
741
-
742
-
743
-
744
- <div class="method-source-code"
745
- id="similarity-source">
746
- <pre>
747
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 152</span>
748
- 152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">similarity</span>
749
- 153: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
750
- 154: <span class="ruby-keyword kw">end</span></pre>
751
- </div>
752
-
753
- </div>
754
-
755
-
756
-
757
-
758
- </div>
759
-
760
-
761
- <div id="synonyms-method" class="method-detail ">
762
- <a name="method-i-synonyms"></a>
763
-
764
- <div class="method-heading">
765
-
766
- <span class="method-name">synonyms</span><span
767
- class="method-args">(word, limit = 10)</span>
768
- <span class="method-click-advice">click to toggle source</span>
769
-
770
- </div>
771
-
772
- <div class="method-description">
773
-
774
- <p>
775
- This method searches for synonyms. Returns synonyms of the input word. In
776
- other words, this is a thesaurus.
777
- </p>
778
-
779
-
780
-
781
- <div class="method-source-code"
782
- id="synonyms-source">
783
- <pre>
784
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 115</span>
785
- 115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">synonyms</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">10</span>)
786
- 116: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_Synonyms</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'Synonyms'</span>])
787
- 117: <span class="ruby-comment cmt"># Synonym service provide multiple values, so we take only odd. </span>
788
- 118: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>, <span class="ruby-value str">'[position() mod 2 = 1 ]'</span>)
789
- 119: <span class="ruby-keyword kw">end</span></pre>
790
- </div>
791
-
792
- </div>
793
-
794
-
795
-
796
-
797
- </div>
798
-
799
-
800
- <div id="thesaurus-method" class="method-detail ">
801
- <a name="method-i-thesaurus"></a>
802
-
803
- <div class="method-heading">
804
-
805
- <span class="method-name">thesaurus</span><span
806
- class="method-args">(word, limit = 10)</span>
807
- <span class="method-click-advice">click to toggle source</span>
808
-
809
- </div>
810
-
811
- <div class="method-description">
812
-
813
- <p>
814
- As the Synonyms service returns synonyms of the given input word. However,
815
- this first builds a lemma of the input word and thus returns more synonyms.
816
- </p>
817
-
818
-
819
-
820
- <div class="method-source-code"
821
- id="thesaurus-source">
822
- <pre>
823
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 108</span>
824
- 108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">thesaurus</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">10</span>)
825
- 109: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_Thesaurus</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'Thesaurus'</span>])
826
- 110: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
827
- 111: <span class="ruby-keyword kw">end</span></pre>
828
- </div>
829
-
830
- </div>
831
-
832
-
833
-
834
-
835
- </div>
836
-
837
-
838
- <div id="wordforms-method" class="method-detail ">
839
- <a name="method-i-wordforms"></a>
840
-
841
- <div class="method-heading">
842
-
843
- <span class="method-name">wordforms</span><span
844
- class="method-args">(word, limit)</span>
845
- <span class="method-click-advice">click to toggle source</span>
846
-
847
- </div>
848
-
849
- <div class="method-description">
850
-
851
- <p>
852
- Returns all other word forms of the same lemma for a given word form .
853
- &#8212; malformed soap, investigate!!! doesn&#8217;t function
854
- </p>
855
-
856
-
857
-
858
- <div class="method-source-code"
859
- id="wordforms-source">
860
- <pre>
861
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 99</span>
862
- 99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wordforms</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>)
863
- 100: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span> <span class="ruby-comment cmt"># remove later</span>
864
- 101: <span class="ruby-identifier">answer</span> = <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@cl_Wordforms</span>, <span class="ruby-ivar">@services</span>[<span class="ruby-value str">'Wordforms'</span>])
865
- 102: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
866
- 103: <span class="ruby-keyword kw">end</span></pre>
867
- </div>
868
-
869
- </div>
870
-
871
-
872
-
873
-
874
- </div>
875
-
876
-
877
- </div>
878
-
879
- <div id="private-instance-method-details" class="method-section section">
880
- <h3 class="section-header">Private Instance Methods</h3>
881
-
882
-
883
- <div id="get-answer-method" class="method-detail ">
884
- <a name="method-i-get_answer"></a>
885
-
886
- <div class="method-heading">
887
-
888
- <span class="method-name">get_answer</span><span
889
- class="method-args">(doc, mod='')</span>
890
- <span class="method-click-advice">click to toggle source</span>
891
-
892
- </div>
893
-
894
- <div class="method-description">
895
-
896
- <p>
897
- This method extracts valuable data from the XML structure of the soap
898
- response. It returns an array with extracted xml text nodes and prints out
899
- the same collection in the DEBUG mode.
900
- </p>
901
-
902
-
903
-
904
- <div class="method-source-code"
905
- id="get-answer-source">
906
- <pre>
907
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 254</span>
908
- 254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">doc</span>, <span class="ruby-identifier">mod</span>=<span class="ruby-value str">''</span>)
909
- 255: <span class="ruby-identifier">result</span> = []
910
- 256: <span class="ruby-comment cmt"># The path seems to be weird, but the namespaces change incrementally</span>
911
- 257: <span class="ruby-comment cmt"># in the output, so I don't want to treat it here.</span>
912
- 258: <span class="ruby-comment cmt"># A modifier needed because synonyms service provides duplicate values.</span>
913
- 259: <span class="ruby-constant">XPath</span>.<span class="ruby-identifier">each</span>(<span class="ruby-identifier">doc</span>, <span class="ruby-node">&quot;//result/*/*#{mod}&quot;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
914
- 260: <span class="ruby-constant">XPath</span>.<span class="ruby-identifier">each</span>(<span class="ruby-identifier">doc</span>, <span class="ruby-node">&quot;//result/*/*#{mod}&quot;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>}
915
- 261: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
916
- 262: <span class="ruby-keyword kw">end</span></pre>
917
- </div>
918
-
919
- </div>
920
-
921
-
922
-
923
-
924
- </div>
925
-
926
-
927
- <div id="query-method" class="method-detail ">
928
- <a name="method-i-query"></a>
929
-
930
- <div class="method-heading">
931
-
932
- <span class="method-name">query</span><span
933
- class="method-args">(word, limit, cl, namespace)</span>
934
- <span class="method-click-advice">click to toggle source</span>
935
-
936
- </div>
937
-
938
- <div class="method-description">
939
-
940
- <p>
941
- Main query method, it invokes the soap engine. This method combines all the
942
- data to one SOAP request and gets the answer. It is not compatible with one
943
- and three parameter methods yet.
944
- </p>
945
-
946
-
947
-
948
- <div class="method-source-code"
949
- id="query-source">
950
- <pre>
951
- <span class="ruby-comment cmt"># File lib/wlapi.rb, line 210</span>
952
- 210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-identifier">cl</span>, <span class="ruby-identifier">namespace</span>)
953
- 211: <span class="ruby-comment cmt"># Calling the action with ! (disables the wsdl query).</span>
954
- 212: <span class="ruby-comment cmt"># wsdl is disabled since calling the server for wsdl can last too long.</span>
955
- 213: <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">cl</span>.<span class="ruby-identifier">execute!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">soap</span><span class="ruby-operator">|</span>
956
- 214:
957
- 215: <span class="ruby-comment cmt"># adding a namespace, wsdl is disabled</span>
958
- 216: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">namespace</span> = <span class="ruby-identifier">namespace</span>
959
- 217:
960
- 218: <span class="ruby-identifier">body</span> = <span class="ruby-value str">&lt;urn:objRequestParameters&gt; &lt;urn:corpus&gt;de&lt;/urn:corpus&gt; &lt;urn:parameters&gt; &lt;urn:dataVectors&gt; &lt;dat:dataRow&gt;Wort&lt;/dat:dataRow&gt; &lt;dat:dataRow&gt;#{word}&lt;/dat:dataRow&gt; &lt;/urn:dataVectors&gt; &lt;urn:dataVectors&gt; &lt;dat:dataRow&gt;Limit&lt;/dat:dataRow&gt; &lt;dat:dataRow&gt;#{limit}&lt;/dat:dataRow&gt; &lt;/urn:dataVectors&gt; &lt;/urn:parameters&gt;&lt;/urn:objRequestParameters&gt;</span>
961
- 219:
962
- 220: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">body</span>
963
- 221:
964
- 222: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">namespaces</span>[<span class="ruby-value str">'xmlns:soapenv'</span>] = <span class="ruby-value str">&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;</span>
965
- 223: <span class="ruby-comment cmt"># Every service has a different namespace, but it doesn't matter.</span>
966
- 224: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">namespaces</span>[<span class="ruby-value str">'xmlns:urn'</span>] = <span class="ruby-node">&quot;urn:#{namespace.sub(/.+ces\//, '')}&quot;</span>
967
- 225:
968
- 226: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">namespaces</span>[<span class="ruby-value str">'xmlns:dat'</span>] = <span class="ruby-value str">&quot;http://datatypes.webservice.wortschatz.uni_leipzig.de&quot;</span>
969
- 227: <span class="ruby-keyword kw">end</span>
970
- 228:
971
- 229: <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">to_xml</span>)
972
- 230:
973
- 231: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">doc</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
974
- 232:
975
- 233: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">doc</span>
976
- 234:
977
- 235: <span class="ruby-keyword kw">end</span></pre>
978
- </div>
979
-
980
- </div>
981
-
982
-
983
-
984
-
985
- </div>
986
-
987
-
988
- </div>
989
-
990
-
991
- </div>
992
-
993
-
994
- <div id="rdoc-debugging-section-dump" class="debugging-section">
995
-
996
- <p>Disabled; run with --debug to generate this.</p>
997
-
998
- </div>
999
-
1000
- <div id="validator-badges">
1001
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1002
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
1003
- Rdoc Generator</a> 1.1.6</small>.</p>
1004
- </div>
1005
-
1006
- </body>
1007
- </html>
1008
-