biodiversity 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG +4 -0
- data/lib/biodiversity/parser/scientific_name_canonical.rb +515 -0
- data/lib/biodiversity/parser/scientific_name_clean.rb +7798 -0
- data/lib/biodiversity/parser/scientific_name_dirty.rb +1269 -0
- data/lib/biodiversity/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2385c9d3c1a1f0ce05f8be5430a8b4d72f4dc0a0
|
4
|
+
data.tar.gz: 2e8c99a2de77d1f4d626e978da7d5f788e6b2854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a539417e4ee3e48cec03be287f0a42cd517eb6368f59c889ec27cd8b9f5d65e9e2ccd64319dd595048b7879aafd29281265bca9cd1cee6ea8830eebbcca07ee
|
7
|
+
data.tar.gz: 35d75a2a796c48a5f7c589a304ccf553389c978c09f12705e975c2538b358549e7470f063f8e20766c760b503269efc85812149e40cb622aebf5fa1822302580
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -0,0 +1,515 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
3
|
+
|
4
|
+
|
5
|
+
module ScientificNameCanonical
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :root
|
10
|
+
end
|
11
|
+
|
12
|
+
include ScientificNameDirty
|
13
|
+
|
14
|
+
module Root0
|
15
|
+
def hybrid
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def details
|
20
|
+
[super]
|
21
|
+
end
|
22
|
+
|
23
|
+
def parser_run
|
24
|
+
3
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Root1
|
29
|
+
def hybrid
|
30
|
+
false
|
31
|
+
end
|
32
|
+
|
33
|
+
def details
|
34
|
+
[super]
|
35
|
+
end
|
36
|
+
|
37
|
+
def parser_run
|
38
|
+
3
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def _nt_root
|
43
|
+
start_index = index
|
44
|
+
if node_cache[:root].has_key?(index)
|
45
|
+
cached = node_cache[:root][index]
|
46
|
+
if cached
|
47
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
48
|
+
@index = cached.interval.end
|
49
|
+
end
|
50
|
+
return cached
|
51
|
+
end
|
52
|
+
|
53
|
+
i0 = index
|
54
|
+
r1 = _nt_multinomial_with_garbage
|
55
|
+
r1.extend(Root0)
|
56
|
+
if r1
|
57
|
+
r0 = r1
|
58
|
+
else
|
59
|
+
r2 = _nt_uninomial_with_garbage
|
60
|
+
r2.extend(Root1)
|
61
|
+
if r2
|
62
|
+
r0 = r2
|
63
|
+
else
|
64
|
+
@index = i0
|
65
|
+
r0 = nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
node_cache[:root][start_index] = r0
|
70
|
+
|
71
|
+
r0
|
72
|
+
end
|
73
|
+
|
74
|
+
module MultinomialWithGarbage0
|
75
|
+
def a
|
76
|
+
elements[0]
|
77
|
+
end
|
78
|
+
|
79
|
+
def space1
|
80
|
+
elements[1]
|
81
|
+
end
|
82
|
+
|
83
|
+
def b
|
84
|
+
elements[2]
|
85
|
+
end
|
86
|
+
|
87
|
+
def space2
|
88
|
+
elements[3]
|
89
|
+
end
|
90
|
+
|
91
|
+
def c
|
92
|
+
elements[4]
|
93
|
+
end
|
94
|
+
|
95
|
+
def garbage
|
96
|
+
elements[5]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
module MultinomialWithGarbage1
|
101
|
+
def value
|
102
|
+
a.value + " " + b.value + " " + c.value
|
103
|
+
end
|
104
|
+
|
105
|
+
def canonical
|
106
|
+
a.canonical + " " + c.canonical
|
107
|
+
end
|
108
|
+
|
109
|
+
def pos
|
110
|
+
a.pos.merge(b.pos).merge(c.pos)
|
111
|
+
end
|
112
|
+
|
113
|
+
def details
|
114
|
+
a.details.merge(b.details).merge(c.details)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
module MultinomialWithGarbage2
|
119
|
+
def a
|
120
|
+
elements[0]
|
121
|
+
end
|
122
|
+
|
123
|
+
def space
|
124
|
+
elements[1]
|
125
|
+
end
|
126
|
+
|
127
|
+
def b
|
128
|
+
elements[2]
|
129
|
+
end
|
130
|
+
|
131
|
+
def garbage
|
132
|
+
elements[3]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
module MultinomialWithGarbage3
|
137
|
+
def value
|
138
|
+
a.value + " " + b.value
|
139
|
+
end
|
140
|
+
|
141
|
+
def canonical
|
142
|
+
a.canonical
|
143
|
+
end
|
144
|
+
|
145
|
+
def pos
|
146
|
+
a.pos.merge(b.pos)
|
147
|
+
end
|
148
|
+
|
149
|
+
def details
|
150
|
+
a.details.merge(b.details)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
module MultinomialWithGarbage4
|
155
|
+
def a
|
156
|
+
elements[0]
|
157
|
+
end
|
158
|
+
|
159
|
+
def space
|
160
|
+
elements[1]
|
161
|
+
end
|
162
|
+
|
163
|
+
def b
|
164
|
+
elements[2]
|
165
|
+
end
|
166
|
+
|
167
|
+
def garbage
|
168
|
+
elements[3]
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
module MultinomialWithGarbage5
|
173
|
+
def value
|
174
|
+
a.value + " " + b.value
|
175
|
+
end
|
176
|
+
|
177
|
+
def canonical
|
178
|
+
a.canonical + " " + b.canonical
|
179
|
+
end
|
180
|
+
|
181
|
+
def pos
|
182
|
+
a.pos.merge(b.pos)
|
183
|
+
end
|
184
|
+
|
185
|
+
def details
|
186
|
+
a.details.merge(b.details)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def _nt_multinomial_with_garbage
|
191
|
+
start_index = index
|
192
|
+
if node_cache[:multinomial_with_garbage].has_key?(index)
|
193
|
+
cached = node_cache[:multinomial_with_garbage][index]
|
194
|
+
if cached
|
195
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
196
|
+
@index = cached.interval.end
|
197
|
+
end
|
198
|
+
return cached
|
199
|
+
end
|
200
|
+
|
201
|
+
i0 = index
|
202
|
+
i1, s1 = index, []
|
203
|
+
r2 = _nt_genus
|
204
|
+
s1 << r2
|
205
|
+
if r2
|
206
|
+
r3 = _nt_space
|
207
|
+
s1 << r3
|
208
|
+
if r3
|
209
|
+
r4 = _nt_infragenus
|
210
|
+
s1 << r4
|
211
|
+
if r4
|
212
|
+
r5 = _nt_space
|
213
|
+
s1 << r5
|
214
|
+
if r5
|
215
|
+
r6 = _nt_species
|
216
|
+
s1 << r6
|
217
|
+
if r6
|
218
|
+
r7 = _nt_garbage
|
219
|
+
s1 << r7
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
if s1.last
|
226
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
227
|
+
r1.extend(MultinomialWithGarbage0)
|
228
|
+
r1.extend(MultinomialWithGarbage1)
|
229
|
+
else
|
230
|
+
@index = i1
|
231
|
+
r1 = nil
|
232
|
+
end
|
233
|
+
if r1
|
234
|
+
r0 = r1
|
235
|
+
else
|
236
|
+
i8, s8 = index, []
|
237
|
+
r9 = _nt_genus
|
238
|
+
s8 << r9
|
239
|
+
if r9
|
240
|
+
r10 = _nt_space
|
241
|
+
s8 << r10
|
242
|
+
if r10
|
243
|
+
r11 = _nt_infragenus
|
244
|
+
s8 << r11
|
245
|
+
if r11
|
246
|
+
r12 = _nt_garbage
|
247
|
+
s8 << r12
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
if s8.last
|
252
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
253
|
+
r8.extend(MultinomialWithGarbage2)
|
254
|
+
r8.extend(MultinomialWithGarbage3)
|
255
|
+
else
|
256
|
+
@index = i8
|
257
|
+
r8 = nil
|
258
|
+
end
|
259
|
+
if r8
|
260
|
+
r0 = r8
|
261
|
+
else
|
262
|
+
i13, s13 = index, []
|
263
|
+
r14 = _nt_genus
|
264
|
+
s13 << r14
|
265
|
+
if r14
|
266
|
+
r15 = _nt_space
|
267
|
+
s13 << r15
|
268
|
+
if r15
|
269
|
+
r16 = _nt_species
|
270
|
+
s13 << r16
|
271
|
+
if r16
|
272
|
+
r17 = _nt_garbage
|
273
|
+
s13 << r17
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
if s13.last
|
278
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
279
|
+
r13.extend(MultinomialWithGarbage4)
|
280
|
+
r13.extend(MultinomialWithGarbage5)
|
281
|
+
else
|
282
|
+
@index = i13
|
283
|
+
r13 = nil
|
284
|
+
end
|
285
|
+
if r13
|
286
|
+
r0 = r13
|
287
|
+
else
|
288
|
+
@index = i0
|
289
|
+
r0 = nil
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
node_cache[:multinomial_with_garbage][start_index] = r0
|
295
|
+
|
296
|
+
r0
|
297
|
+
end
|
298
|
+
|
299
|
+
module UninomialWithGarbage0
|
300
|
+
def a
|
301
|
+
elements[0]
|
302
|
+
end
|
303
|
+
|
304
|
+
def b
|
305
|
+
elements[1]
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
module UninomialWithGarbage1
|
310
|
+
def value
|
311
|
+
a.value
|
312
|
+
end
|
313
|
+
|
314
|
+
def canonical
|
315
|
+
a.canonical
|
316
|
+
end
|
317
|
+
|
318
|
+
def pos
|
319
|
+
a.pos
|
320
|
+
end
|
321
|
+
|
322
|
+
def details
|
323
|
+
{:uninomial => a.details[:uninomial]}
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
def _nt_uninomial_with_garbage
|
328
|
+
start_index = index
|
329
|
+
if node_cache[:uninomial_with_garbage].has_key?(index)
|
330
|
+
cached = node_cache[:uninomial_with_garbage][index]
|
331
|
+
if cached
|
332
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
333
|
+
@index = cached.interval.end
|
334
|
+
end
|
335
|
+
return cached
|
336
|
+
end
|
337
|
+
|
338
|
+
i0, s0 = index, []
|
339
|
+
r1 = _nt_uninomial_string
|
340
|
+
s0 << r1
|
341
|
+
if r1
|
342
|
+
r2 = _nt_garbage
|
343
|
+
s0 << r2
|
344
|
+
end
|
345
|
+
if s0.last
|
346
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
347
|
+
r0.extend(UninomialWithGarbage0)
|
348
|
+
r0.extend(UninomialWithGarbage1)
|
349
|
+
else
|
350
|
+
@index = i0
|
351
|
+
r0 = nil
|
352
|
+
end
|
353
|
+
|
354
|
+
node_cache[:uninomial_with_garbage][start_index] = r0
|
355
|
+
|
356
|
+
r0
|
357
|
+
end
|
358
|
+
|
359
|
+
module Garbage0
|
360
|
+
def space
|
361
|
+
elements[0]
|
362
|
+
end
|
363
|
+
|
364
|
+
end
|
365
|
+
|
366
|
+
module Garbage1
|
367
|
+
def space1
|
368
|
+
elements[0]
|
369
|
+
end
|
370
|
+
|
371
|
+
def space2
|
372
|
+
elements[2]
|
373
|
+
end
|
374
|
+
|
375
|
+
end
|
376
|
+
|
377
|
+
module Garbage2
|
378
|
+
def space_hard
|
379
|
+
elements[0]
|
380
|
+
end
|
381
|
+
|
382
|
+
end
|
383
|
+
|
384
|
+
def _nt_garbage
|
385
|
+
start_index = index
|
386
|
+
if node_cache[:garbage].has_key?(index)
|
387
|
+
cached = node_cache[:garbage][index]
|
388
|
+
if cached
|
389
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
390
|
+
@index = cached.interval.end
|
391
|
+
end
|
392
|
+
return cached
|
393
|
+
end
|
394
|
+
|
395
|
+
i0 = index
|
396
|
+
i1, s1 = index, []
|
397
|
+
r2 = _nt_space
|
398
|
+
s1 << r2
|
399
|
+
if r2
|
400
|
+
if has_terminal?("$$g@rbg3$$", false, index)
|
401
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 10))
|
402
|
+
@index += 10
|
403
|
+
else
|
404
|
+
terminal_parse_failure("$$g@rbg3$$")
|
405
|
+
r3 = nil
|
406
|
+
end
|
407
|
+
s1 << r3
|
408
|
+
end
|
409
|
+
if s1.last
|
410
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
411
|
+
r1.extend(Garbage0)
|
412
|
+
else
|
413
|
+
@index = i1
|
414
|
+
r1 = nil
|
415
|
+
end
|
416
|
+
if r1
|
417
|
+
r0 = r1
|
418
|
+
else
|
419
|
+
i4, s4 = index, []
|
420
|
+
r5 = _nt_space
|
421
|
+
s4 << r5
|
422
|
+
if r5
|
423
|
+
if has_terminal?('\G["\',.]', true, index)
|
424
|
+
r6 = true
|
425
|
+
@index += 1
|
426
|
+
else
|
427
|
+
r6 = nil
|
428
|
+
end
|
429
|
+
s4 << r6
|
430
|
+
if r6
|
431
|
+
r7 = _nt_space
|
432
|
+
s4 << r7
|
433
|
+
if r7
|
434
|
+
s8, i8 = [], index
|
435
|
+
loop do
|
436
|
+
if has_terminal?('\G[^щ]', true, index)
|
437
|
+
r9 = true
|
438
|
+
@index += 1
|
439
|
+
else
|
440
|
+
r9 = nil
|
441
|
+
end
|
442
|
+
if r9
|
443
|
+
s8 << r9
|
444
|
+
else
|
445
|
+
break
|
446
|
+
end
|
447
|
+
end
|
448
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
449
|
+
s4 << r8
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
if s4.last
|
454
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
455
|
+
r4.extend(Garbage1)
|
456
|
+
else
|
457
|
+
@index = i4
|
458
|
+
r4 = nil
|
459
|
+
end
|
460
|
+
if r4
|
461
|
+
r0 = r4
|
462
|
+
else
|
463
|
+
i10, s10 = index, []
|
464
|
+
r11 = _nt_space_hard
|
465
|
+
s10 << r11
|
466
|
+
if r11
|
467
|
+
s12, i12 = [], index
|
468
|
+
loop do
|
469
|
+
if has_terminal?('\G[^ш]', true, index)
|
470
|
+
r13 = true
|
471
|
+
@index += 1
|
472
|
+
else
|
473
|
+
r13 = nil
|
474
|
+
end
|
475
|
+
if r13
|
476
|
+
s12 << r13
|
477
|
+
else
|
478
|
+
break
|
479
|
+
end
|
480
|
+
end
|
481
|
+
if s12.empty?
|
482
|
+
@index = i12
|
483
|
+
r12 = nil
|
484
|
+
else
|
485
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
486
|
+
end
|
487
|
+
s10 << r12
|
488
|
+
end
|
489
|
+
if s10.last
|
490
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
491
|
+
r10.extend(Garbage2)
|
492
|
+
else
|
493
|
+
@index = i10
|
494
|
+
r10 = nil
|
495
|
+
end
|
496
|
+
if r10
|
497
|
+
r0 = r10
|
498
|
+
else
|
499
|
+
@index = i0
|
500
|
+
r0 = nil
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
node_cache[:garbage][start_index] = r0
|
506
|
+
|
507
|
+
r0
|
508
|
+
end
|
509
|
+
|
510
|
+
end
|
511
|
+
|
512
|
+
class ScientificNameCanonicalParser < Treetop::Runtime::CompiledParser
|
513
|
+
include ScientificNameCanonical
|
514
|
+
end
|
515
|
+
|