biodiversity 5.0.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46c26c9c1ada65f95edf5e00365203f4e68d596e0b14f44b6995b46e127afab9
4
- data.tar.gz: ce2cced66dbebc464ef47eee7f401a8a6b946d69d6664b7fcf1c8d5c413f7251
3
+ metadata.gz: edae363431b2855927ee3ff977da0987e3a8989cabf89c05b75f25b6daa82197
4
+ data.tar.gz: 84cb944df5d6b9779c5103de481dba7fe60f4aedf30515cce752bf79cd3486d4
5
5
  SHA512:
6
- metadata.gz: ea6b814f8fe7bf451a360c87674c53d63bf49a2351e23aa724b7974cf269986ab7206fd1987dc945224fe9bc9cf36605994f34d6d6fd61ad72c03783cb41629d
7
- data.tar.gz: b456ef00e072b37d12f0312b347af29aea126a40f4f86ab0b735b42b185977e692ef6fc94c18072b42e75ee6b69d254ba5bb90fe0a4d7a7f0b057366af403a8e
6
+ metadata.gz: af5f2f8c954cb3570f7a57b657038936fe544379d196a5c76b73dc783476150b1724c667d0dd2e45e486c1718c2a828089965afde5e90a69d5ce3203761d8ef2
7
+ data.tar.gz: f40a48c418e83049845fbdbd56d8b29b56f8aed521449ae103c378d510f8b7178958a83632d4a14d00dfb7656929224c3fc1673786e62a3cfa3cd18ce29ae6f7
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 5.1.2 -- upgrade to gnparser v1.0.2
2
+
3
+ 5.1.1 -- simplified signature of methods
4
+
5
+ 5.1.0 -- changed sinature of methods
6
+
1
7
  5.0.0 -- changed GNparser to v 1.0.0
2
8
 
3
9
  4.0.3 -- fix memory leak in parse_ary method
@@ -19,7 +19,7 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
19
19
  /* Start of preamble from import "C" comments. */
20
20
 
21
21
 
22
- #line 3 "main.go"
22
+ #line 5 "main.go"
23
23
 
24
24
  #include "stdlib.h"
25
25
 
Binary file
@@ -19,7 +19,7 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
19
19
  /* Start of preamble from import "C" comments. */
20
20
 
21
21
 
22
- #line 3 "main.go"
22
+ #line 5 "main.go"
23
23
 
24
24
  #include "stdlib.h"
25
25
 
@@ -80,20 +80,17 @@ extern "C" {
80
80
  // 'csv', 'compact', 'pretty'. If withDetails argument is 0, additional
81
81
  // parsed details are ommited, if it is 1 -- they are included.
82
82
  // true.
83
-
84
- extern char* ParseToString(char* p0, char* p1, int p2);
83
+ extern char* ParseToString(char* name, char* f, int details);
85
84
 
86
85
  // FreeMemory takes a string pointer and frees its memory.
87
-
88
- extern void FreeMemory(char* p0);
86
+ extern void FreeMemory(char* p);
89
87
 
90
88
  // ParseAryToString function takes an array of names, parsing format, and a
91
89
  // withDetails flag as 0|1 integer. Parsed outputs are sent as a string in
92
90
  // either CSV or JSON format. Format argument can take values of 'csv',
93
91
  // 'compact', or 'pretty'. For withDetails argument 0 means false, 1 means
94
92
  // true.
95
-
96
- extern char* ParseAryToString(char** p0, int p1, char* p2, int p3);
93
+ extern char* ParseAryToString(char** in, int length, char* f, int details);
97
94
 
98
95
  #ifdef __cplusplus
99
96
  }
Binary file
@@ -19,7 +19,7 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
19
19
  /* Start of preamble from import "C" comments. */
20
20
 
21
21
 
22
- #line 3 "main.go"
22
+ #line 5 "main.go"
23
23
 
24
24
  #include "stdlib.h"
25
25
 
@@ -80,17 +80,17 @@ extern "C" {
80
80
  // 'csv', 'compact', 'pretty'. If withDetails argument is 0, additional
81
81
  // parsed details are ommited, if it is 1 -- they are included.
82
82
  // true.
83
- extern char* ParseToString(char* name, char* f, int details);
83
+ extern __declspec(dllexport) char* ParseToString(char* name, char* f, int details);
84
84
 
85
85
  // FreeMemory takes a string pointer and frees its memory.
86
- extern void FreeMemory(char* p);
86
+ extern __declspec(dllexport) void FreeMemory(char* p);
87
87
 
88
88
  // ParseAryToString function takes an array of names, parsing format, and a
89
89
  // withDetails flag as 0|1 integer. Parsed outputs are sent as a string in
90
90
  // either CSV or JSON format. Format argument can take values of 'csv',
91
91
  // 'compact', or 'pretty'. For withDetails argument 0 means false, 1 means
92
92
  // true.
93
- extern char* ParseAryToString(char** in, int length, char* f, int details);
93
+ extern __declspec(dllexport) char* ParseAryToString(char** in, int length, char* f, int details);
94
94
 
95
95
  #ifdef __cplusplus
96
96
  }
Binary file
@@ -35,21 +35,23 @@ module Biodiversity
35
35
 
36
36
  def self.parse(name, simple: false)
37
37
  format = simple ? 'csv' : 'compact'
38
+ with_details = simple ? 0 : 1
38
39
 
39
- parsed, ptr = parse_go(name, format, 0)
40
+ parsed, ptr = parse_go(name, format, with_details)
40
41
  free_mem(ptr)
41
42
  output(parsed, simple)
42
43
  end
43
44
 
44
45
  def self.parse_ary(ary, simple: false)
45
46
  format = simple ? 'csv' : 'compact'
46
- in_ptr = FFI::MemoryPointer.new(:pointer, ary.length)
47
+ with_details = simple ? 0 : 1
47
48
 
49
+ in_ptr = FFI::MemoryPointer.new(:pointer, ary.length)
48
50
  in_ptr.write_array_of_pointer(
49
51
  ary.map { |s| FFI::MemoryPointer.from_string(s) }
50
52
  )
51
53
 
52
- parsed, ptr = parse_ary_go(in_ptr, ary.length, format, 0)
54
+ parsed, ptr = parse_ary_go(in_ptr, ary.length, format, with_details)
53
55
  free_mem(ptr)
54
56
  if simple
55
57
  CSV.new(parsed).map do |row|
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Biodiversity module provides a namespace for scientific name parser.
4
4
  module Biodiversity
5
- VERSION = '5.0.0'
5
+ VERSION = '5.2.0'
6
6
 
7
7
  def self.version
8
8
  VERSION
@@ -14,6 +14,7 @@ describe Biodiversity::Parser do
14
14
  parsed = subject.parse('Homo sapiens Linn.')
15
15
  expect(parsed[:canonical][:simple]).to eq 'Homo sapiens'
16
16
  expect(parsed[:normalized]).to eq 'Homo sapiens Linn.'
17
+ expect(parsed[:words].size).to eq 3
17
18
  end
18
19
 
19
20
  it 'gets quality and year correctly in simple form' do
@@ -32,8 +33,9 @@ describe Biodiversity::Parser do
32
33
  simple: true
33
34
  )
34
35
  expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
35
- expect(parsed[1][:canonical][:simple]).to eq 'Pardosa moesta'
36
36
  expect(parsed[0][:normalized]).to be_nil
37
+
38
+ expect(parsed[1][:canonical][:simple]).to eq 'Pardosa moesta'
37
39
  end
38
40
 
39
41
  it 'parsed name in full format' do
@@ -42,8 +44,10 @@ describe Biodiversity::Parser do
42
44
  )
43
45
  expect(parsed[0][:canonical][:simple]).to eq 'Homo sapiens'
44
46
  expect(parsed[0][:normalized]).to eq 'Homo sapiens Linn.'
47
+ expect(parsed[0][:words].size).to eq 3
45
48
  expect(parsed[1][:parsed]).to be false
46
49
  expect(parsed[1][:virus]).to be true
50
+ expect(parsed[1][:words]).to be_nil
47
51
  end
48
52
  end
49
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.2.3
145
+ rubygems_version: 3.2.6
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Parser of scientific names