wlapi 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1008 @@
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-domain">#domain</a></li>
81
+
82
+ <li><a href="#method-i-experimental_synonyms">#experimental_synonyms</a></li>
83
+
84
+ <li><a href="#method-i-frequencies">#frequencies</a></li>
85
+
86
+ <li><a href="#method-i-get_answer">#get_answer</a></li>
87
+
88
+ <li><a href="#method-i-intersection">#intersection</a></li>
89
+
90
+ <li><a href="#method-i-left_collocation_finder">#left_collocation_finder</a></li>
91
+
92
+ <li><a href="#method-i-left_neighbours">#left_neighbours</a></li>
93
+
94
+ <li><a href="#method-i-query">#query</a></li>
95
+
96
+ <li><a href="#method-i-right_collocation_finder">#right_collocation_finder</a></li>
97
+
98
+ <li><a href="#method-i-right_neighbours">#right_neighbours</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 186</span>
325
+ 186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cooccurrences</span>
326
+ 187: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
327
+ 188: <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 194</span>
364
+ 194: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cooccurrences_all</span>
365
+ 195: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
366
+ 196: <span class="ruby-keyword kw">end</span></pre>
367
+ </div>
368
+
369
+ </div>
370
+
371
+
372
+
373
+
374
+ </div>
375
+
376
+
377
+ <div id="domain-method" class="method-detail ">
378
+ <a name="method-i-domain"></a>
379
+
380
+ <div class="method-heading">
381
+
382
+ <span class="method-name">domain</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
+ Returns categories for a given input word. &#8212; Is it a good name? all
392
+ names are in English, but here.. let&#8217;s call it domain, not sachgebiet
393
+ </p>
394
+
395
+
396
+
397
+ <div class="method-source-code"
398
+ id="domain-source">
399
+ <pre>
400
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 89</span>
401
+ 89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">domain</span>
402
+ 90: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
403
+ 91: <span class="ruby-keyword kw">end</span></pre>
404
+ </div>
405
+
406
+ </div>
407
+
408
+
409
+
410
+
411
+ </div>
412
+
413
+
414
+ <div id="experimental-synonyms-method" class="method-detail ">
415
+ <a name="method-i-experimental_synonyms"></a>
416
+
417
+ <div class="method-heading">
418
+
419
+ <span class="method-name">experimental_synonyms</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
+ This service delivers an experimental synonyms request for internal tests.
429
+ &#8212; don&#8217;t know, if we have to include this service...
430
+ </p>
431
+
432
+
433
+
434
+ <div class="method-source-code"
435
+ id="experimental-synonyms-source">
436
+ <pre>
437
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 160</span>
438
+ 160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">experimental_synonyms</span>
439
+ 161: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
440
+ 162: <span class="ruby-keyword kw">end</span></pre>
441
+ </div>
442
+
443
+ </div>
444
+
445
+
446
+
447
+
448
+ </div>
449
+
450
+
451
+ <div id="frequencies-method" class="method-detail ">
452
+ <a name="method-i-frequencies"></a>
453
+
454
+ <div class="method-heading">
455
+
456
+ <span class="method-name">frequencies</span><span
457
+ class="method-args">()</span>
458
+ <span class="method-click-advice">click to toggle source</span>
459
+
460
+ </div>
461
+
462
+ <div class="method-description">
463
+
464
+ <p>
465
+ Returns the frequency and frequency class of the input word. Frequency
466
+ class is computed in relation to the most frequent word in the corpus. The
467
+ higher the class, the rarer the word.
468
+ </p>
469
+
470
+
471
+
472
+ <div class="method-source-code"
473
+ id="frequencies-source">
474
+ <pre>
475
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 75</span>
476
+ 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">frequencies</span>
477
+ 76: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
478
+ 77: <span class="ruby-keyword kw">end</span></pre>
479
+ </div>
480
+
481
+ </div>
482
+
483
+
484
+
485
+
486
+ </div>
487
+
488
+
489
+ <div id="intersection-method" class="method-detail ">
490
+ <a name="method-i-intersection"></a>
491
+
492
+ <div class="method-heading">
493
+
494
+ <span class="method-name">intersection</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
+ Returns the intersection of the co-occurrences of the two given words. The
504
+ result set is ordered according to the sum of the significances in
505
+ descending order. Note that due to the join involved, this make take some
506
+ time. &#8212; let&#8217;s call it intersection, not kookurrenzschnitt
507
+ </p>
508
+
509
+
510
+
511
+ <div class="method-source-code"
512
+ id="intersection-source">
513
+ <pre>
514
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 204</span>
515
+ 204: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">intersection</span>
516
+ 205: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
517
+ 206: <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-collocation-finder-method" class="method-detail ">
529
+ <a name="method-i-left_collocation_finder"></a>
530
+
531
+ <div class="method-heading">
532
+
533
+ <span class="method-name">left_collocation_finder</span><span
534
+ class="method-args">()</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
+ Attempts to find linguistic collocations that occur to the left of the
543
+ given input word. The parameter Wortart accepts four values A,V,N,S which
544
+ stand for adjective, verb, noun and stopword, respectively. The parameter
545
+ restricts the type of words found.
546
+ </p>
547
+
548
+
549
+
550
+ <div class="method-source-code"
551
+ id="left-collocation-finder-source">
552
+ <pre>
553
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 181</span>
554
+ 181: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">left_collocation_finder</span>
555
+ 182: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
556
+ 183: <span class="ruby-keyword kw">end</span></pre>
557
+ </div>
558
+
559
+ </div>
560
+
561
+
562
+
563
+
564
+ </div>
565
+
566
+
567
+ <div id="left-neighbours-method" class="method-detail ">
568
+ <a name="method-i-left_neighbours"></a>
569
+
570
+ <div class="method-heading">
571
+
572
+ <span class="method-name">left_neighbours</span><span
573
+ class="method-args">(word, limit)</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
+ For a given input word, returns statistically significant left neighbours
582
+ (words co-occurring immediately to the left of the input word). &#8212; ok,
583
+ but results should be filtered
584
+ </p>
585
+
586
+
587
+
588
+ <div class="method-source-code"
589
+ id="left-neighbours-source">
590
+ <pre>
591
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 133</span>
592
+ 133: <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>)
593
+ 134: <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>])
594
+ 135: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
595
+ 136: <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-collocation-finder-method" class="method-detail ">
607
+ <a name="method-i-right_collocation_finder"></a>
608
+
609
+ <div class="method-heading">
610
+
611
+ <span class="method-name">right_collocation_finder</span><span
612
+ class="method-args">()</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
+ Attempts to find linguistic collocations that occur to the right of the
621
+ given input word. The parameter Wortart accepts four values A,V,N,S which
622
+ stand for adjective, verb, noun and stopword, respectively. The parameter
623
+ restricts the type of words found.
624
+ </p>
625
+
626
+
627
+
628
+ <div class="method-source-code"
629
+ id="right-collocation-finder-source">
630
+ <pre>
631
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 172</span>
632
+ 172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">right_collocation_finder</span>
633
+ 173: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
634
+ 174: <span class="ruby-keyword kw">end</span></pre>
635
+ </div>
636
+
637
+ </div>
638
+
639
+
640
+
641
+
642
+ </div>
643
+
644
+
645
+ <div id="right-neighbours-method" class="method-detail ">
646
+ <a name="method-i-right_neighbours"></a>
647
+
648
+ <div class="method-heading">
649
+
650
+ <span class="method-name">right_neighbours</span><span
651
+ class="method-args">(word, limit)</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
+ For a given input word, returns statistically significant right neighbours
660
+ (words co-occurring immediately to the right of the input word). &#8212;
661
+ ok, but results should be filtered
662
+ </p>
663
+
664
+
665
+
666
+ <div class="method-source-code"
667
+ id="right-neighbours-source">
668
+ <pre>
669
+ <span class="ruby-comment cmt"># File lib/wlapi.rb, line 142</span>
670
+ 142: <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>)
671
+ 143: <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>])
672
+ 144: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
673
+ 145: <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 124</span>
708
+ 124: <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
+ 125: <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
+ 126: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
711
+ 127: <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 153</span>
748
+ 153: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">similarity</span>
749
+ 154: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span>
750
+ 155: <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 116</span>
785
+ 116: <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
+ 117: <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
+ 118: <span class="ruby-comment cmt"># Synonym service provide multiple values, so we take only odd. </span>
788
+ 119: <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
+ 120: <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 109</span>
824
+ 109: <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
+ 110: <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
+ 111: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
827
+ 112: <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 100</span>
862
+ 100: <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
+ 101: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Not implemented yet!'</span> <span class="ruby-comment cmt"># remove later</span>
864
+ 102: <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
+ 103: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_answer</span>(<span class="ruby-identifier">answer</span>)
866
+ 104: <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 257</span>
908
+ 257: <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
+ 258: <span class="ruby-identifier">result</span> = []
910
+ 259: <span class="ruby-comment cmt"># The path seems to be weird, but the namespaces change incrementally</span>
911
+ 260: <span class="ruby-comment cmt"># in the output, so I don't want to treat it here.</span>
912
+ 261: <span class="ruby-comment cmt"># A modifier needed because synonyms service provides duplicate values.</span>
913
+ 262: <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
+ 263: <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
+ 264: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
916
+ 265: <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 213</span>
952
+ 213: <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
+ 214: <span class="ruby-comment cmt"># Calling the action with ! (disables the wsdl query).</span>
954
+ 215: <span class="ruby-comment cmt"># wsdl is disabled since calling the server for wsdl can last too long.</span>
955
+ 216: <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
+ 217:
957
+ 218: <span class="ruby-comment cmt"># adding a namespace, wsdl is disabled</span>
958
+ 219: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">namespace</span> = <span class="ruby-identifier">namespace</span>
959
+ 220:
960
+ 221: <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
+ 222:
962
+ 223: <span class="ruby-identifier">soap</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">body</span>
963
+ 224:
964
+ 225: <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
+ 226: <span class="ruby-comment cmt"># Every service has a different namespace, but it doesn't matter.</span>
966
+ 227: <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
+ 228:
968
+ 229: <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
+ 230: <span class="ruby-keyword kw">end</span>
970
+ 231:
971
+ 232: <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
+ 233:
973
+ 234: <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
+ 235:
975
+ 236: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">doc</span>
976
+ 237:
977
+ 238: <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
+