wlapi 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +42 -0
- data/LICENSE.rdoc +1 -1
- data/README.rdoc +1 -1
- data/lib/wlapi/api.rb +97 -111
- data/lib/wlapi/version.rb +1 -1
- data/test/local_test_interface.rb +2 -2
- data/test/remote_test_functional.rb +8 -0
- data/test/test_helper.rb +1 -0
- metadata +32 -75
- data/CHANGELOG.rdoc +0 -41
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
metadata.gz: e2f0476621333078c51f8e5d667abc569c2758722275ac71e270cbfe907bd71b6acb6b286f2a34f3a5a68adcf5550a274049f15a3b6ed1db763d97a4e0eb41a7
|
4
|
+
data.tar.gz: a5e7e2ee5ab134d66e4bf6c1eccb2f82d15dca88eecd41d6a4ba72c206944a2428f1c70323c90a9a3659fb32a97f4822fea80351f1f977a39d34b7bd74813ce0
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 86a7c749c0a11a43db762d4a0c12e7e27c17e4c4
|
7
|
+
data.tar.gz: a21efd91f6f886e704361bb2a6b8fce968081213
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
## COMPLETED
|
2
|
+
### 0.8.6
|
3
|
+
Implemented <tt>ngrams</tt> and <tt>ngram_references</tt>.
|
4
|
+
### 0.8.5
|
5
|
+
Finished the port to <tt>Savon 2</tt>.
|
6
|
+
### 0.8.4
|
7
|
+
Imlemented the <tt>API#crossword</tt> method for the prefix/suffix search.
|
8
|
+
### 0.8.3
|
9
|
+
Implemented a simple error handling strategy, it is possible to intercept
|
10
|
+
the <tt>WLAPI::Error</tt> which covers all error types.
|
11
|
+
|
12
|
+
Added error for inconvinient user argumets.
|
13
|
+
|
14
|
+
Added new tests and refactored old tests.
|
15
|
+
### 0.8.1
|
16
|
+
Moved to dependency management via Bundler.
|
17
|
+
### 0.8.0
|
18
|
+
WLAPI depends on Savon <tt>>=0.8.0</tt>
|
19
|
+
with all interface changes have been implemented.
|
20
|
+
|
21
|
+
### 0.7.4
|
22
|
+
Small fixes in the project infrastructure and test refactoring.
|
23
|
+
### 0.7.3
|
24
|
+
Fixed the bug with a wrong dependency on the latest version of savon.
|
25
|
+
Due to interface changes it depends now on <tt>0.7.9</tt>.
|
26
|
+
### 0.0.3
|
27
|
+
Initial release of the lib.
|
28
|
+
|
29
|
+
|
30
|
+
## PLANNED
|
31
|
+
### 0.8.7
|
32
|
+
- Rewrite tests using <tt>Minitest</tt>.
|
33
|
+
- Test the lib against mri, rbx, jruby, win rubies.
|
34
|
+
- Introduce <tt>nokogiri</tt> for parsing responses.
|
35
|
+
- Refine semantic checks for two parameter methods.
|
36
|
+
### 0.8.8
|
37
|
+
### 0.8.9
|
38
|
+
|
39
|
+
### 0.9.0
|
40
|
+
Add a command line tool to work with Wortschatz Lepzip. Package the lib, the cmd tool, and all the dependencies. Nokogiri is packaged by Lucas Nussbaumer.
|
41
|
+
### 1.0.0
|
42
|
+
|
data/LICENSE.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -110,6 +110,6 @@ you might face some not implemented features.
|
|
110
110
|
Please contact me with your suggestions, bug reports and feature requests.
|
111
111
|
== LICENSE
|
112
112
|
|
113
|
-
WLAPI is a copyrighted software by Andrei Beliankou, 2010-
|
113
|
+
WLAPI is a copyrighted software by Andrei Beliankou, 2010-2014
|
114
114
|
|
115
115
|
You may use, redistribute and change it under the terms provided in the LICENSE file.
|
data/lib/wlapi/api.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# 2010-
|
2
|
+
# 2010-2014, Andrei Beliankou
|
3
3
|
|
4
4
|
# :title: Ruby based API for Wortschatz Leipzig web services
|
5
5
|
# :main: README.rdoc
|
@@ -8,6 +8,8 @@ require 'savon'
|
|
8
8
|
require 'wlapi/error'
|
9
9
|
|
10
10
|
# REXML is fast enough for our task.
|
11
|
+
# But we consider using Nokogiri since Savon depends on it
|
12
|
+
# and we won't introduce additional dependencies.
|
11
13
|
require 'rexml/document'
|
12
14
|
include REXML
|
13
15
|
|
@@ -19,7 +21,7 @@ module WLAPI
|
|
19
21
|
#
|
20
22
|
# See the project 'Wortschatz Leipzig' for more details.
|
21
23
|
class API
|
22
|
-
|
24
|
+
|
23
25
|
# SOAP Services Endpoint.
|
24
26
|
ENDPOINT = 'http://wortschatz.uni-leipzig.de/axis/services'
|
25
27
|
|
@@ -41,30 +43,6 @@ module WLAPI
|
|
41
43
|
|
42
44
|
SERVICES.each { |service| @services[service] = "#{ENDPOINT}/#{service}"}
|
43
45
|
|
44
|
-
=begin
|
45
|
-
@services = {
|
46
|
-
:Thesaurus => "#{endpoint}/Thesaurus",
|
47
|
-
:Baseform => "#{endpoint}/Baseform",
|
48
|
-
:Similarity => "#{endpoint}/Similarity",
|
49
|
-
:Synonyms => "#{endpoint}/Synonyms",
|
50
|
-
:Sachgebiet => "#{endpoint}/Sachgebiet",
|
51
|
-
:Frequencies => "#{endpoint}/Frequencies",
|
52
|
-
:Kookurrenzschnitt => "#{endpoint}/Kookkurrenzschnitt",
|
53
|
-
:ExperimentalSynonyms => "#{endpoint}/ExperimentalSynonyms",
|
54
|
-
:RightCollocationFinder => "#{endpoint}/RightCollocationFinder",
|
55
|
-
:LeftCollocationFinder => "#{endpoint}/LeftCollocationFinder",
|
56
|
-
:Wordforms => "#{endpoint}/Wordforms",
|
57
|
-
:CooccurrencesAll => "#{endpoint}/CooccurrencesAll",
|
58
|
-
:LeftNeighbours => "#{endpoint}/LeftNeighbours",
|
59
|
-
:RightNeighbours => "#{endpoint}/RightNeighbours",
|
60
|
-
:Sentences => "#{endpoint}/Sentences",
|
61
|
-
:Cooccurrences => "#{endpoint}/Cooccurrences",
|
62
|
-
:Kreuzwortraetsel => "#{endpoint}/Kreuzwortraetsel",
|
63
|
-
:NGrams => "#{endpoint}/NGrams",
|
64
|
-
:NGramReferences => "#{endpoint}/NGramReferences"
|
65
|
-
# no MARSService
|
66
|
-
}
|
67
|
-
=end
|
68
46
|
# cl short for client.
|
69
47
|
# Dynamically create all the clients and set access credentials.
|
70
48
|
# It can be a very bad idea to instantiate all the clients at once,
|
@@ -74,22 +52,22 @@ module WLAPI
|
|
74
52
|
cl_name = '@cl_' + key.to_s
|
75
53
|
|
76
54
|
options = {:wsdl => val + "?wsdl",
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
55
|
+
:namespaces => {'xmlns:dat' => 'http://datatypes.webservice.wortschatz.uni_leipzig.de',
|
56
|
+
'xmlns:urn' => val},
|
57
|
+
:basic_auth => ['anonymous', 'anonymous'],
|
58
|
+
:log => $DEBUG
|
59
|
+
}
|
82
60
|
client = Savon.client(options)
|
83
61
|
eval("#{cl_name} = client")
|
84
62
|
end
|
85
|
-
|
63
|
+
|
86
64
|
# Savon creates very verbose logs, switching off.
|
87
|
-
# Savon.configure do |config|
|
88
|
-
# config.log = false unless $DEBUG
|
89
|
-
# end
|
65
|
+
# Savon.configure do |config|
|
66
|
+
# config.log = false unless $DEBUG
|
67
|
+
# end
|
90
68
|
HTTPI.log = false unless $DEBUG
|
91
69
|
end
|
92
|
-
|
70
|
+
|
93
71
|
# Main methods to access different services.
|
94
72
|
#
|
95
73
|
# You can define the limit for the result set, it defaults to 10.
|
@@ -97,36 +75,36 @@ module WLAPI
|
|
97
75
|
# which would be greater than the result set since we cannot
|
98
76
|
# predict how many answers the server will give us.
|
99
77
|
#############################################################################
|
100
|
-
|
78
|
+
|
101
79
|
## One parameter methods.
|
102
80
|
#############################################################################
|
103
|
-
|
81
|
+
|
104
82
|
# Returns the frequency and frequency class of the input word.
|
105
83
|
# Frequency class is computed in relation to the most frequent word
|
106
84
|
# in the corpus. The higher the class, the rarer the word:
|
107
85
|
# api.frequencies("Autos") => ["40614", "9"]
|
108
86
|
def frequencies(word)
|
109
87
|
check_params(word)
|
110
|
-
|
88
|
+
|
111
89
|
arg1 = ['Wort', word]
|
112
90
|
answer = query(@cl_Frequencies, arg1)
|
113
91
|
|
114
92
|
get_answer(answer)
|
115
93
|
end
|
116
|
-
|
94
|
+
|
117
95
|
# Gets the baseform (whatever it is :), not lemma).
|
118
96
|
# Returns the lemmatized (base) form of the input word
|
119
97
|
# and the POS tag in an array:
|
120
98
|
# api.baseform("Auto") => ["Auto", "N"]
|
121
99
|
def baseform(word)
|
122
100
|
check_params(word)
|
123
|
-
|
101
|
+
|
124
102
|
arg1 = ['Wort', word]
|
125
103
|
answer = query(@cl_Baseform, arg1)
|
126
104
|
|
127
105
|
get_answer(answer)
|
128
106
|
end
|
129
|
-
|
107
|
+
|
130
108
|
# Returns categories for a given input word as an array:
|
131
109
|
# api.domain("Michael") => ["Vorname", "Nachname", "Männername"]
|
132
110
|
#--
|
@@ -134,57 +112,57 @@ module WLAPI
|
|
134
112
|
# let's call it domain, not sachgebiet
|
135
113
|
def domain(word)
|
136
114
|
check_params(word)
|
137
|
-
|
115
|
+
|
138
116
|
arg1 = ['Wort', word]
|
139
117
|
answer = query(@cl_Sachgebiet, arg1)
|
140
|
-
|
118
|
+
|
141
119
|
get_answer(answer)
|
142
120
|
end
|
143
121
|
|
144
122
|
## Two parameter methods.
|
145
123
|
#############################################################################
|
146
|
-
|
124
|
+
|
147
125
|
# Returns all other word forms of the same lemma for a given word form.
|
148
126
|
# api.wordforms("Auto") => ["Auto", "Autos"]
|
149
127
|
def wordforms(word, limit = 10)
|
150
128
|
check_params(word, limit)
|
151
|
-
|
129
|
+
|
152
130
|
# note, it is the only service which requires 'Word', not 'Wort'
|
153
131
|
arg1 = ['Word', word]
|
154
132
|
arg2 = ['Limit', limit]
|
155
133
|
answer = query(@cl_Wordforms, arg1, arg2)
|
156
|
-
|
134
|
+
|
157
135
|
get_answer(answer)
|
158
136
|
end
|
159
|
-
|
137
|
+
|
160
138
|
# As the Synonyms service returns synonyms of the given input word.
|
161
139
|
# However, this first builds a lemma of the input word
|
162
140
|
# and thus returns more synonyms:
|
163
141
|
# api.thesaurus("Auto") => ["Auto", "Bahn", "Wagen", "Zug", "Schiff", ...]
|
164
142
|
def thesaurus(word, limit = 10)
|
165
143
|
check_params(word, limit)
|
166
|
-
|
144
|
+
|
167
145
|
arg1 = ['Wort', word]
|
168
146
|
arg2 = ['Limit', limit]
|
169
147
|
answer = query(@cl_Thesaurus, arg1, arg2)
|
170
|
-
|
148
|
+
|
171
149
|
get_answer(answer)
|
172
150
|
end
|
173
|
-
|
151
|
+
|
174
152
|
# This method searches for synonyms.
|
175
153
|
# Returns synonyms of the input word. In other words, this is a thesaurus.
|
176
154
|
# api.synonyms("Auto") => ["Kraftwagen", "Automobil", "Benzinkutsche", ...]
|
177
155
|
def synonyms(word, limit = 10)
|
178
156
|
check_params(word, limit)
|
179
|
-
|
157
|
+
|
180
158
|
arg1 = ['Wort', word]
|
181
159
|
arg2 = ['Limit', limit]
|
182
160
|
answer = query(@cl_Synonyms, arg1, arg2)
|
183
161
|
|
184
|
-
# Synonym service provides multiple values, so we take only odd.
|
162
|
+
# Synonym service provides multiple values, so we take only odd.
|
185
163
|
get_answer(answer, '[position() mod 2 = 1 ]')
|
186
164
|
end
|
187
|
-
|
165
|
+
|
188
166
|
# Returns sample sentences containing the input word.
|
189
167
|
# The return value is an array:
|
190
168
|
# api.sentences("Auto") => ["40808144", "Zweitens der freche,
|
@@ -195,14 +173,14 @@ module WLAPI
|
|
195
173
|
# ok, but results should be filtered
|
196
174
|
def sentences(word, limit = 10)
|
197
175
|
check_params(word, limit)
|
198
|
-
|
176
|
+
|
199
177
|
arg1 = ['Wort', word]
|
200
178
|
arg2 = ['Limit', limit]
|
201
179
|
answer = query(@cl_Sentences, arg1, arg2)
|
202
|
-
|
180
|
+
|
203
181
|
get_answer(answer)
|
204
182
|
end
|
205
|
-
|
183
|
+
|
206
184
|
# For a given input word, returns statistically significant left neighbours
|
207
185
|
# (words co-occurring immediately to the left of the input word).
|
208
186
|
# api.left_neighbours("Auto") => ["geparktes", "Auto", "561", ...]
|
@@ -210,14 +188,14 @@ module WLAPI
|
|
210
188
|
# ok, but results should be filtered
|
211
189
|
def left_neighbours(word, limit = 10)
|
212
190
|
check_params(word, limit)
|
213
|
-
|
191
|
+
|
214
192
|
arg1 = ['Wort', word]
|
215
193
|
arg2 = ['Limit', limit]
|
216
194
|
answer = query(@cl_LeftNeighbours, arg1, arg2)
|
217
|
-
|
195
|
+
|
218
196
|
get_answer(answer)
|
219
197
|
end
|
220
|
-
|
198
|
+
|
221
199
|
# For a given input word, returns statistically significant right neighbours
|
222
200
|
# (words co-occurring immediately to the right of the input word).
|
223
201
|
# api.right_neighbours("Auto") => ["Auto", "erfaßt", "575", ...]
|
@@ -225,15 +203,15 @@ module WLAPI
|
|
225
203
|
# ok, but results should be filtered
|
226
204
|
def right_neighbours(word, limit = 10)
|
227
205
|
check_params(word, limit)
|
228
|
-
|
206
|
+
|
229
207
|
arg1 = ['Wort', word]
|
230
208
|
arg2 = ['Limit', limit]
|
231
209
|
answer = query(@cl_RightNeighbours, arg1, arg2)
|
232
|
-
|
210
|
+
|
233
211
|
get_answer(answer)
|
234
212
|
end
|
235
|
-
|
236
|
-
|
213
|
+
|
214
|
+
|
237
215
|
# Returns automatically computed contextually similar words
|
238
216
|
# of the input word.
|
239
217
|
# Such similar words may be antonyms, hyperonyms, synonyms,
|
@@ -243,39 +221,47 @@ module WLAPI
|
|
243
221
|
# api.similarity("Auto") => ["Auto", "Wagen", "26", ...]
|
244
222
|
def similarity(word, limit = 10)
|
245
223
|
check_params(word, limit)
|
246
|
-
|
224
|
+
|
247
225
|
arg1 = ['Wort', word]
|
248
226
|
arg2 = ['Limit', limit]
|
249
227
|
answer = query(@cl_Similarity, arg1, arg2)
|
250
|
-
|
228
|
+
|
251
229
|
get_answer(answer)
|
252
230
|
end
|
253
|
-
|
231
|
+
|
254
232
|
# This service delivers an experimental synonyms request for internal tests.
|
255
233
|
#--
|
256
234
|
# don't know, if we have to include this service...
|
257
235
|
def experimental_synonyms(word, limit = 10)
|
258
236
|
check_params(word, limit)
|
259
|
-
|
237
|
+
|
260
238
|
arg1 = ['Wort', word]
|
261
239
|
arg2 = ['Limit', limit]
|
262
240
|
answer = query(@cl_ExperimentalSynonyms, arg1, arg2)
|
263
|
-
|
241
|
+
|
264
242
|
get_answer(answer)
|
265
243
|
end
|
266
244
|
|
267
|
-
#
|
245
|
+
# @todo
|
268
246
|
def ngrams(pattern, limit = 10)
|
269
|
-
|
247
|
+
|
248
|
+
arg1 = ['Pattern', pattern]
|
249
|
+
arg2 = ['Limit', limit]
|
250
|
+
answer = query(@cl_NGrams, arg1, arg2)
|
251
|
+
#raise(NotImplementedError, 'This method will be implemented in the next release.')
|
270
252
|
end
|
253
|
+
|
271
254
|
#
|
272
255
|
def ngram_references(pattern, limit = 10)
|
273
|
-
|
256
|
+
arg1 = ['Pattern', pattern]
|
257
|
+
arg2 = ['Limit', limit]
|
258
|
+
answer = query(@cl_NGramReferences, arg1, arg2)
|
259
|
+
#raise(NotImplementedError, 'This method will be implemented in the next release.')
|
274
260
|
end
|
275
|
-
|
261
|
+
|
276
262
|
## Three parameter methods.
|
277
263
|
#############################################################################
|
278
|
-
|
264
|
+
|
279
265
|
# Attempts to find linguistic collocations that occur to the right
|
280
266
|
# of the given input word.
|
281
267
|
# The parameter 'Wortart' accepts four values 'A, V, N, S'
|
@@ -286,15 +272,15 @@ module WLAPI
|
|
286
272
|
# ["Auto", "abfackeln", "V", ...]
|
287
273
|
def right_collocation_finder(word, pos, limit = 10)
|
288
274
|
check_params(word, pos, limit)
|
289
|
-
|
275
|
+
|
290
276
|
arg1 = ['Wort', word]
|
291
277
|
arg2 = ['Wortart', pos]
|
292
278
|
arg3 = ['Limit', limit]
|
293
279
|
answer = query(@cl_RightCollocationFinder, arg1, arg2, arg3)
|
294
|
-
|
280
|
+
|
295
281
|
get_answer(answer)
|
296
282
|
end
|
297
|
-
|
283
|
+
|
298
284
|
# Attempts to find linguistic collocations that occur to the left
|
299
285
|
# of the given input word.
|
300
286
|
# The parameter 'Wortart' accepts four values 'A, V, N, S'
|
@@ -305,39 +291,39 @@ module WLAPI
|
|
305
291
|
# ["apostolisch", "A", "Stuhl", ...]
|
306
292
|
def left_collocation_finder(word, pos, limit = 10)
|
307
293
|
check_params(word, pos, limit)
|
308
|
-
|
294
|
+
|
309
295
|
arg1 = ['Wort', word]
|
310
296
|
arg2 = ['Wortart', pos]
|
311
297
|
arg3 = ['Limit', limit]
|
312
298
|
answer = query(@cl_LeftCollocationFinder, arg1, arg2, arg3)
|
313
|
-
|
299
|
+
|
314
300
|
get_answer(answer)
|
315
301
|
end
|
316
|
-
|
302
|
+
|
317
303
|
# Returns statistically significant co-occurrences of the input word.
|
318
304
|
def cooccurrences(word, sign, limit = 10)
|
319
305
|
check_params(word, sign, limit)
|
320
|
-
|
306
|
+
|
321
307
|
arg1 = ['Wort', word]
|
322
308
|
arg2 = ['Mindestsignifikanz', sign]
|
323
309
|
arg3 = ['Limit', limit]
|
324
310
|
answer = query(@cl_Cooccurrences, arg1, arg2, arg3)
|
325
|
-
|
311
|
+
|
326
312
|
get_answer(answer)
|
327
313
|
end
|
328
|
-
|
314
|
+
|
329
315
|
# Returns statistically significant co-occurrences of the input word.
|
330
316
|
# However, it searches in the unrestricted version of the co-occurrences
|
331
317
|
# table as in the Cooccurrences services,
|
332
318
|
# which means significantly longer wait times.
|
333
319
|
def cooccurrences_all(word, sign, limit = 10)
|
334
320
|
check_params(word, sign, limit)
|
335
|
-
|
321
|
+
|
336
322
|
arg1 = ['Wort', word]
|
337
323
|
arg2 = ['Mindestsignifikanz', sign]
|
338
324
|
arg3 = ['Limit', limit]
|
339
325
|
answer = query(@cl_CooccurrencesAll, arg1, arg2, arg3)
|
340
|
-
|
326
|
+
|
341
327
|
get_answer(answer)
|
342
328
|
end
|
343
329
|
|
@@ -350,21 +336,21 @@ module WLAPI
|
|
350
336
|
# is being used INTERN, we need additional credentials
|
351
337
|
def intersection(word1, word2, limit = 10)
|
352
338
|
check_params(word1, word2, limit)
|
353
|
-
|
339
|
+
|
354
340
|
arg1 = ['Wort 1', word1]
|
355
341
|
arg2 = ['Wort 2', word2]
|
356
342
|
arg3 = ['Limit', limit]
|
357
343
|
answer = query(@cl_Kookurrenzschnitt, arg1, arg2, arg3)
|
358
|
-
|
344
|
+
|
359
345
|
get_answer(answer)
|
360
|
-
end
|
346
|
+
end
|
361
347
|
|
362
|
-
# Attempts to find suitable words given a pattern as word parameter,
|
348
|
+
# Attempts to find suitable words given a pattern as word parameter,
|
363
349
|
# a word length and the number of words to find at max (limit),
|
364
350
|
# e.g. <tt>API#crossword('%uto', 4)</tt> would return find 24 results and
|
365
351
|
# return them as an array: <tt>[Auto, Auto, ...]</tt>:
|
366
352
|
# api.crossword('%uto') => ["Auto", "Auto", ...]
|
367
|
-
# SQL like syntax is used for pattern (<tt>%</tt> for an arbitrary string,
|
353
|
+
# SQL like syntax is used for pattern (<tt>%</tt> for an arbitrary string,
|
368
354
|
# <tt>_</tt> for a single character).
|
369
355
|
#
|
370
356
|
# Note: Umlaute will count as one character
|
@@ -379,20 +365,20 @@ module WLAPI
|
|
379
365
|
arg2 = ['Wortlaenge', word_length]
|
380
366
|
arg3 = ['Limit', limit]
|
381
367
|
answer = query(@cl_Kreuzwortraetsel, arg1, arg2, arg3)
|
382
|
-
|
368
|
+
|
383
369
|
get_answer(answer)
|
384
370
|
end
|
385
|
-
|
371
|
+
|
386
372
|
private
|
387
|
-
|
373
|
+
|
388
374
|
# Main query method, it invokes the soap engine.
|
389
375
|
# It combines all the data to one SOAP request and gets the answer.
|
390
376
|
# <args> contains an array [[key1, value1], [key2, value2], [key3, value3]]
|
391
377
|
# with keys and values for the soap query.
|
392
378
|
def query(cl, *args)
|
393
379
|
# WSDL is disabled since calling the server for wsdl can last too long.
|
394
|
-
|
395
|
-
|
380
|
+
|
381
|
+
|
396
382
|
v = []
|
397
383
|
body = {
|
398
384
|
'urn:objRequestParameters' => {
|
@@ -402,38 +388,38 @@ module WLAPI
|
|
402
388
|
}
|
403
389
|
}
|
404
390
|
}
|
405
|
-
|
391
|
+
|
406
392
|
# Setting the first argument (usually 'Wort').
|
407
393
|
v << {'dat:dataRow'=>[
|
408
|
-
|
409
|
-
|
410
|
-
|
394
|
+
args[0][0],
|
395
|
+
args[0][1]
|
396
|
+
]
|
411
397
|
} if args[0]
|
412
398
|
# Setting the second argument (usually 'Limit').
|
413
399
|
v << {'dat:dataRow'=>[
|
414
|
-
|
415
|
-
|
416
|
-
|
400
|
+
args[1][0],
|
401
|
+
args[1][1]
|
402
|
+
]
|
417
403
|
} if args[1]
|
418
404
|
# Setting the third argument (no common value)
|
419
405
|
v << {'dat:dataRow'=>[
|
420
|
-
|
421
|
-
|
422
|
-
|
406
|
+
args[2][0],
|
407
|
+
args[2][1]
|
408
|
+
]
|
423
409
|
} if args[2]
|
424
|
-
|
410
|
+
|
425
411
|
begin
|
426
412
|
resp = cl.call(:execute, {:message => body})
|
427
413
|
rescue => e
|
428
414
|
fail(WLAPI::ExternalError, e)
|
429
415
|
end
|
430
|
-
|
416
|
+
|
431
417
|
doc = Document.new(resp.to_xml)
|
432
418
|
warn(doc) if $DEBUG
|
433
|
-
|
434
|
-
doc
|
419
|
+
|
420
|
+
doc
|
435
421
|
end
|
436
|
-
|
422
|
+
|
437
423
|
# This method extracts valuable data from the XML structure
|
438
424
|
# of the soap response. It returns an array with extracted xml text nodes
|
439
425
|
# or nil, if the service provided no answer.
|
@@ -477,7 +463,7 @@ module WLAPI
|
|
477
463
|
|
478
464
|
def msg(arg, meth, cls)
|
479
465
|
"Argument <#{arg}> for the method <#{meth}> should be a <#{cls}>, " +
|
480
|
-
|
466
|
+
"not <#{arg.class}>!"
|
481
467
|
end
|
482
468
|
end # class
|
483
469
|
end # module
|
data/lib/wlapi/version.rb
CHANGED
@@ -84,11 +84,11 @@ class TestInterface < Test::Unit::TestCase
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_missing_methods
|
87
|
-
assert_raise(
|
87
|
+
assert_raise(WLAPI::ExternalError) do
|
88
88
|
@api.ngrams('Haus')
|
89
89
|
end
|
90
90
|
|
91
|
-
assert_raise(
|
91
|
+
assert_raise(WLAPI::ExternalError) do
|
92
92
|
@api.ngram_references('Haus')
|
93
93
|
end
|
94
94
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wlapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 8
|
9
|
-
- 5
|
10
|
-
version: 0.8.5
|
4
|
+
version: 0.8.6
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- Andrei Beliankou
|
@@ -15,82 +9,55 @@ autorequire:
|
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
11
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
12
|
+
date: 2014-07-12 00:00:00 Z
|
20
13
|
dependencies:
|
21
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
name: savon
|
16
|
+
prerelease: false
|
22
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
18
|
requirements:
|
25
19
|
- - ~>
|
26
20
|
- !ruby/object:Gem::Version
|
27
|
-
hash: 1
|
28
|
-
segments:
|
29
|
-
- 2
|
30
|
-
- 1
|
31
21
|
version: "2.1"
|
32
|
-
name: savon
|
33
|
-
version_requirements: *id001
|
34
|
-
prerelease: false
|
35
22
|
type: :runtime
|
23
|
+
version_requirements: *id001
|
36
24
|
- !ruby/object:Gem::Dependency
|
25
|
+
name: rdoc
|
26
|
+
prerelease: false
|
37
27
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
28
|
requirements:
|
40
29
|
- - ">="
|
41
30
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 33
|
43
|
-
segments:
|
44
|
-
- 3
|
45
|
-
- 9
|
46
|
-
- 1
|
47
31
|
version: 3.9.1
|
48
|
-
name: rdoc
|
49
|
-
version_requirements: *id002
|
50
|
-
prerelease: false
|
51
32
|
type: :development
|
33
|
+
version_requirements: *id002
|
52
34
|
- !ruby/object:Gem::Dependency
|
35
|
+
name: bundler
|
36
|
+
prerelease: false
|
53
37
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
38
|
requirements:
|
56
|
-
-
|
39
|
+
- &id004
|
40
|
+
- ">="
|
57
41
|
- !ruby/object:Gem::Version
|
58
|
-
hash: 3
|
59
|
-
segments:
|
60
|
-
- 0
|
61
42
|
version: "0"
|
62
|
-
name: bundler
|
63
|
-
version_requirements: *id003
|
64
|
-
prerelease: false
|
65
43
|
type: :development
|
44
|
+
version_requirements: *id003
|
66
45
|
- !ruby/object:Gem::Dependency
|
67
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
46
|
name: yard
|
77
|
-
version_requirements: *id004
|
78
47
|
prerelease: false
|
79
|
-
type: :development
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
48
|
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
49
|
requirements:
|
84
|
-
-
|
85
|
-
|
86
|
-
hash: 3
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
90
|
-
name: rake
|
50
|
+
- *id004
|
51
|
+
type: :development
|
91
52
|
version_requirements: *id005
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
92
55
|
prerelease: false
|
56
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- *id004
|
93
59
|
type: :development
|
60
|
+
version_requirements: *id006
|
94
61
|
description: WLAPI is a programmatic API for web services provided by the project Wortschatz, University of Leipzig. These services are a great source of linguistic knowledge for morphological, syntactic and semantic analysis of German both for traditional and Computational Linguistics (CL). Use this API to gain data on word frequencies, left and right neighbours, collocations and semantic similarity. Check it out if you are interested in Natural Language Processing (NLP) and Human Language Technology (HLT).
|
95
62
|
email: arbox@bu.chsta.be
|
96
63
|
executables: []
|
@@ -100,24 +67,25 @@ extensions: []
|
|
100
67
|
extra_rdoc_files:
|
101
68
|
- README.rdoc
|
102
69
|
- LICENSE.rdoc
|
103
|
-
- CHANGELOG.
|
70
|
+
- CHANGELOG.md
|
104
71
|
files:
|
72
|
+
- .yardopts
|
73
|
+
- CHANGELOG.md
|
74
|
+
- LICENSE.rdoc
|
75
|
+
- README.rdoc
|
105
76
|
- lib/wlapi.rb
|
106
77
|
- lib/wlapi/api.rb
|
107
78
|
- lib/wlapi/error.rb
|
108
79
|
- lib/wlapi/version.rb
|
109
|
-
- README.rdoc
|
110
|
-
- LICENSE.rdoc
|
111
|
-
- CHANGELOG.rdoc
|
112
|
-
- .yardopts
|
113
80
|
- test/data/soap_request.txt
|
114
81
|
- test/local_test_interface.rb
|
115
82
|
- test/remote_test_functional.rb
|
116
83
|
- test/test_helper.rb
|
117
|
-
has_rdoc: true
|
118
84
|
homepage: http://bu.chsta.be/projects/wlapi/
|
119
85
|
licenses: []
|
120
86
|
|
87
|
+
metadata: {}
|
88
|
+
|
121
89
|
post_install_message:
|
122
90
|
rdoc_options:
|
123
91
|
- -m
|
@@ -125,34 +93,23 @@ rdoc_options:
|
|
125
93
|
require_paths:
|
126
94
|
- lib
|
127
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
96
|
requirements:
|
130
97
|
- - ">="
|
131
98
|
- !ruby/object:Gem::Version
|
132
|
-
hash: 61
|
133
|
-
segments:
|
134
|
-
- 1
|
135
|
-
- 8
|
136
|
-
- 5
|
137
99
|
version: 1.8.5
|
138
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
101
|
requirements:
|
141
|
-
-
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
hash: 3
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
version: "0"
|
102
|
+
- *id004
|
147
103
|
requirements: []
|
148
104
|
|
149
105
|
rubyforge_project:
|
150
|
-
rubygems_version:
|
106
|
+
rubygems_version: 2.3.0
|
151
107
|
signing_key:
|
152
|
-
specification_version:
|
108
|
+
specification_version: 4
|
153
109
|
summary: WLAPI is a programmatic API for web services provided by the project Wortschatz, University of Leipzig. Use different linguistic services such as synonym and collocation search.
|
154
110
|
test_files:
|
155
111
|
- test/data/soap_request.txt
|
156
112
|
- test/local_test_interface.rb
|
157
113
|
- test/remote_test_functional.rb
|
158
114
|
- test/test_helper.rb
|
115
|
+
has_rdoc:
|
data/CHANGELOG.rdoc
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
== COMPLETED
|
2
|
-
=== 0.8.4
|
3
|
-
Imlemented the <tt>API#crossword</tt> method for the prefix/suffix search.
|
4
|
-
=== 0.8.3
|
5
|
-
Implemented a simple error handling strategy, it is possible to intercept
|
6
|
-
the <tt>WLAPI::Error</tt> which covers all error types.
|
7
|
-
|
8
|
-
Added error for inconvinient user argumets.
|
9
|
-
|
10
|
-
Added new tests and refactored old tests.
|
11
|
-
=== 0.8.1
|
12
|
-
Moved to dependency management via Bundler.
|
13
|
-
=== 0.8.0
|
14
|
-
WLAPI depends on Savon <tt>>=0.8.0</tt>
|
15
|
-
with all interface changes have been implemented.
|
16
|
-
|
17
|
-
=== 0.7.4
|
18
|
-
Small fixes in the project infrastructure and test refactoring.
|
19
|
-
=== 0.7.3
|
20
|
-
Fixed the bug with a wrong dependency on the latest version of savon.
|
21
|
-
Due to interface changes it depends now on +0.7.9+.
|
22
|
-
=== 0.0.3
|
23
|
-
Initial release of the lib.
|
24
|
-
|
25
|
-
|
26
|
-
== PLANNED
|
27
|
-
|
28
|
-
|
29
|
-
=== 0.8.5
|
30
|
-
Test the lib against mri, rbx, jruby, win rubies.
|
31
|
-
Introduce +nokogiri+ for parsing responses.
|
32
|
-
=== 0.8.6
|
33
|
-
Implement <ngrams> and <ngram_references>.
|
34
|
-
|
35
|
-
Refine semantic checks for two parameter methods.
|
36
|
-
=== 0.8.7
|
37
|
-
=== 0.8.8
|
38
|
-
=== 0.8.9
|
39
|
-
=== 0.9.0
|
40
|
-
=== 1.0.0
|
41
|
-
|