wlapi 0.0.3

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