wlapi 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +14 -3
- data/doc/INSTALL.html +2 -0
- data/doc/LICENSE.html +2 -0
- data/doc/README.html +28 -1
- data/doc/WLAPI.html +12 -863
- data/doc/WLAPI/API.html +1008 -0
- data/doc/created.rid +6 -1
- data/doc/{bin → example}/example_rb.html +13 -2
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +127 -20
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/wlapi_rb.html +2 -2
- data/example/example.rb +2 -0
- data/lib/wlapi.rb +8 -7
- data/wlapi.gemspec +5 -3
- metadata +51 -39
- data/doc/classes/WLAPI.html +0 -121
- data/doc/classes/WLAPI/API.html +0 -463
- data/doc/classes/WLAPI/API.src/M000001.html +0 -51
- data/doc/classes/WLAPI/API.src/M000002.html +0 -18
- data/doc/classes/WLAPI/API.src/M000003.html +0 -18
- data/doc/classes/WLAPI/API.src/M000004.html +0 -18
- data/doc/classes/WLAPI/API.src/M000005.html +0 -20
- data/doc/classes/WLAPI/API.src/M000006.html +0 -19
- data/doc/classes/WLAPI/API.src/M000007.html +0 -20
- data/doc/classes/WLAPI/API.src/M000008.html +0 -19
- data/doc/classes/WLAPI/API.src/M000009.html +0 -19
- data/doc/classes/WLAPI/API.src/M000010.html +0 -19
- data/doc/classes/WLAPI/API.src/M000011.html +0 -18
- data/doc/classes/WLAPI/API.src/M000012.html +0 -18
- data/doc/classes/WLAPI/API.src/M000013.html +0 -18
- data/doc/classes/WLAPI/API.src/M000014.html +0 -18
- data/doc/classes/WLAPI/API.src/M000015.html +0 -18
- data/doc/classes/WLAPI/API.src/M000016.html +0 -18
- data/doc/classes/WLAPI/API.src/M000017.html +0 -18
- data/doc/files/example/example_rb.html +0 -119
- data/doc/files/lib/wlapi/wlapi_rb.html +0 -122
- data/doc/fr_class_index.html +0 -28
- data/doc/fr_file_index.html +0 -28
- data/doc/fr_method_index.html +0 -43
- data/doc/rdoc-style.css +0 -208
- data/example/example.rb~ +0 -2
data/README
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
|
1
|
+
= WLAPI
|
2
2
|
|
3
|
-
|
3
|
+
* http://rubygems.org/gems/wlapi
|
4
|
+
* http://www.uni-trier.de/index.php?id=24140
|
4
5
|
|
5
|
-
|
6
|
+
== DESCRIPTION
|
7
|
+
|
8
|
+
WLAPI is a simple API for Wortschatz Leipzig project.
|
9
|
+
|
10
|
+
$ require 'wlapi'
|
11
|
+
$ api = WLAPI::API.new
|
12
|
+
$ api.synonyms('Haus', 15) # returns an array with sting values (UTF8 encoded)
|
13
|
+
|
14
|
+
See RDOC documentation for details on particular methods.
|
15
|
+
|
16
|
+
You can find some invocation examples in example/example.rb
|
data/doc/INSTALL.html
CHANGED
data/doc/LICENSE.html
CHANGED
data/doc/README.html
CHANGED
@@ -66,6 +66,8 @@
|
|
66
66
|
|
67
67
|
<li><a href="./WLAPI.html">WLAPI</a></li>
|
68
68
|
|
69
|
+
<li><a href="./WLAPI/API.html">WLAPI::API</a></li>
|
70
|
+
|
69
71
|
</ul>
|
70
72
|
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
71
73
|
</div>
|
@@ -75,9 +77,34 @@
|
|
75
77
|
</div>
|
76
78
|
|
77
79
|
<div id="documentation">
|
78
|
-
<
|
80
|
+
<h1><a href="WLAPI.html">WLAPI</a></h1>
|
81
|
+
<ul>
|
82
|
+
<li><p>
|
83
|
+
<a href="http://rubygems.org/gems/wlapi">rubygems.org/gems/wlapi</a>
|
84
|
+
</p>
|
85
|
+
</li>
|
86
|
+
<li><p>
|
87
|
+
<a
|
88
|
+
href="http://www.uni-trier.de/index.php?id=24140">www.uni-trier.de/index.php?id=24140</a>
|
89
|
+
</p>
|
90
|
+
</li>
|
91
|
+
</ul>
|
92
|
+
<h2>DESCRIPTION</h2>
|
93
|
+
<p>
|
79
94
|
<a href="WLAPI.html">WLAPI</a> is a simple API for Wortschatz Leipzig
|
80
95
|
project.
|
96
|
+
</p>
|
97
|
+
<pre>
|
98
|
+
$ require 'wlapi'
|
99
|
+
$ api = WLAPI::API.new
|
100
|
+
$ api.synonyms('Haus', 15) # returns an array with sting values (UTF8 encoded)
|
101
|
+
</pre>
|
102
|
+
<p>
|
103
|
+
See RDOC documentation for details on particular methods.
|
104
|
+
</p>
|
105
|
+
<p>
|
106
|
+
You can find some invocation examples in <a
|
107
|
+
href="example/example_rb.html">example/example.rb</a>
|
81
108
|
</p>
|
82
109
|
|
83
110
|
</div>
|
data/doc/WLAPI.html
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<head>
|
6
6
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
7
|
|
8
|
-
<title>
|
8
|
+
<title>Module: WLAPI</title>
|
9
9
|
|
10
10
|
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
11
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
charset="utf-8"></script>
|
20
20
|
|
21
21
|
</head>
|
22
|
-
<body class="
|
22
|
+
<body class="module">
|
23
23
|
|
24
24
|
<div id="metadata">
|
25
25
|
<div id="home-metadata">
|
@@ -52,65 +52,22 @@
|
|
52
52
|
|
53
53
|
<!-- Parent Class -->
|
54
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
55
|
|
63
56
|
<!-- Namespace Contents -->
|
64
57
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
<div id="method-list-section" class="section">
|
69
|
-
<h3 class="section-header">Methods</h3>
|
58
|
+
<div id="namespace-list-section" class="section">
|
59
|
+
<h3 class="section-header">Namespace</h3>
|
70
60
|
<ul class="link-list">
|
71
61
|
|
72
|
-
<li><a href="
|
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>
|
62
|
+
<li><span class="type">CLASS</span> <a href="WLAPI/API.html">WLAPI::API</a></li>
|
109
63
|
|
110
64
|
</ul>
|
111
65
|
</div>
|
112
66
|
|
113
67
|
|
68
|
+
<!-- Method Quickref -->
|
69
|
+
|
70
|
+
|
114
71
|
<!-- Included Modules -->
|
115
72
|
|
116
73
|
</div>
|
@@ -149,6 +106,8 @@
|
|
149
106
|
|
150
107
|
<li><a href="./WLAPI.html">WLAPI</a></li>
|
151
108
|
|
109
|
+
<li><a href="./WLAPI/API.html">WLAPI::API</a></li>
|
110
|
+
|
152
111
|
</ul>
|
153
112
|
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
154
113
|
</div>
|
@@ -158,15 +117,11 @@
|
|
158
117
|
</div>
|
159
118
|
|
160
119
|
<div id="documentation">
|
161
|
-
<h1 class="
|
120
|
+
<h1 class="module">WLAPI</h1>
|
162
121
|
|
163
122
|
<div id="description">
|
164
123
|
<p>
|
165
|
-
|
166
|
-
by the University of Leipzig.
|
167
|
-
</p>
|
168
|
-
<p>
|
169
|
-
See the project ‘Wortschatz Leipzig’ for more details.
|
124
|
+
Top level namespace wrapper for <a href="WLAPI.html">WLAPI</a>
|
170
125
|
</p>
|
171
126
|
|
172
127
|
</div>
|
@@ -179,812 +134,6 @@ See the project ‘Wortschatz Leipzig’ for more details.
|
|
179
134
|
|
180
135
|
<!-- Methods -->
|
181
136
|
|
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
|
-
‘anonymous’).
|
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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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">></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 => 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">"#{cl_name} = Savon::Client.new(val)"</span>)
|
241
|
-
50: <span class="ruby-identifier">eval</span>(<span class="ruby-node">"#{cl_name}.request.basic_auth(login, pass)"</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
|
-
— don’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). — 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). —
|
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. — 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
|
-
— malformed soap, investigate!!! doesn’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">"//result/*/*#{mod}"</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">"//result/*/*#{mod}"</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"><<</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"><urn:objRequestParameters> <urn:corpus>de</urn:corpus> <urn:parameters> <urn:dataVectors> <dat:dataRow>Wort</dat:dataRow> <dat:dataRow>#{word}</dat:dataRow> </urn:dataVectors> <urn:dataVectors> <dat:dataRow>Limit</dat:dataRow> <dat:dataRow>#{limit}</dat:dataRow> </urn:dataVectors> </urn:parameters></urn:objRequestParameters></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">"http://schemas.xmlsoap.org/soap/envelope/"</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">"urn:#{namespace.sub(/.+ces\//, '')}"</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">"http://datatypes.webservice.wortschatz.uni_leipzig.de"</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
137
|
|
989
138
|
</div>
|
990
139
|
|