rbbt-text 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/ner/rnorm.rb +15 -2
  3. metadata +16 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 571b05a78ab3a1bb51d37604cab69773555fd331
4
- data.tar.gz: 61983fbd5d98c8412bb2fd36d0639eb7086f9287
3
+ metadata.gz: 357d34614c78eef41ce0bf2a143feafa73960e71
4
+ data.tar.gz: 4a08f43322486115cbf54d40dabe5d5559652465
5
5
  SHA512:
6
- metadata.gz: 25f718d2733cbd5bb2bb521bdc4d50e7386ac39a573c2424897bad98b1f8674beeec56c7162bec91c5afb555163eea995bbd740f9d855d13fc084d6248eff4cd
7
- data.tar.gz: 184f47a53ffcb220ba68faf03343f869eb65b0f12022561355c9cf417245781ebfc46efa81a49c1a9d9d746b9e42434bbe4e9dc49cc6d70eb216ecc6f0517b48
6
+ metadata.gz: 29c0950181322582432792dfc56a58480c35486c66ccf76e8096fd7c89ef10a2eadcfe236c91f4bbb6502944acde47338fa39c5337b9e80bc2ec22a3150747a9
7
+ data.tar.gz: 767440205f67636ca59d1897acff712e05d1b59063cf77bdfbb8a7b5893444794d89b39bf6a72724305061fc38e31ea7ec00d5d223991edc8bf67d4ad803c94b
@@ -100,10 +100,22 @@ class Normalizer
100
100
 
101
101
 
102
102
  def initialize(lexicon, options = {})
103
- @synonyms = TSV === lexicon ? lexicon : TSV.open(lexicon, :type => :flat, :unnamed => true)
103
+ @synonyms = case lexicon
104
+ when TSV
105
+ lexicon.unnamed = true
106
+ lexicon
107
+ when Array
108
+ tsv = TSV.setup(lexicon, :fields => [], :type => :flat, :unnamed => true, :defaul_value => [])
109
+ tsv.add_field "Term" do |k,v|
110
+ k
111
+ end
112
+ tsv
113
+ else
114
+ TSV.open(lexicon, :type => :flat, :unnamed => true)
115
+ end
104
116
 
105
117
  @index = CueIndex.new
106
- @index.load(lexicon, options[:max_candidates])
118
+ @index.load(@synonyms, options[:max_candidates])
107
119
 
108
120
  @to_entrez = options[:to_entrez]
109
121
  @tokens = Tokenizer.new(options[:file])
@@ -157,6 +169,7 @@ class Normalizer
157
169
  end
158
170
 
159
171
  def resolve(mention, text = nil, options = {})
172
+ text, options = nil, text if options.empty? and Hash === text
160
173
  candidates = match(mention)
161
174
  select(candidates, mention, text, options)
162
175
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util
@@ -178,31 +178,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  version: '0'
179
179
  requirements: []
180
180
  rubyforge_project:
181
- rubygems_version: 2.4.6
181
+ rubygems_version: 2.6.6
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: Text mining tools for the Ruby Bioinformatics Toolkit (rbbt)
185
185
  test_files:
186
- - test/rbbt/nlp/open_nlp/test_sentence_splitter.rb
187
- - test/rbbt/nlp/test_nlp.rb
186
+ - test/test_helper.rb
187
+ - test/rbbt/ner/test_abner.rb
188
+ - test/rbbt/ner/test_rnorm.rb
189
+ - test/rbbt/ner/test_patterns.rb
188
190
  - test/rbbt/ner/test_regexpNER.rb
189
- - test/rbbt/ner/test_banner.rb
190
- - test/rbbt/ner/segment/test_transformed.rb
191
+ - test/rbbt/ner/test_chemical_tagger.rb
191
192
  - test/rbbt/ner/segment/test_segmented.rb
192
193
  - test/rbbt/ner/segment/test_named_entity.rb
193
- - test/rbbt/ner/test_abner.rb
194
+ - test/rbbt/ner/segment/test_transformed.rb
195
+ - test/rbbt/ner/test_linnaeus.rb
196
+ - test/rbbt/ner/test_segment.rb
194
197
  - test/rbbt/ner/test_oscar4.rb
195
198
  - test/rbbt/ner/test_finder.rb
196
- - test/rbbt/ner/test_patterns.rb
197
- - test/rbbt/ner/test_rnorm.rb
198
- - test/rbbt/ner/test_segment.rb
199
- - test/rbbt/ner/test_ngram_prefix_dictionary.rb
200
199
  - test/rbbt/ner/test_token_trieNER.rb
200
+ - test/rbbt/ner/test_banner.rb
201
201
  - test/rbbt/ner/test_NER.rb
202
- - test/rbbt/ner/test_linnaeus.rb
203
- - test/rbbt/ner/test_chemical_tagger.rb
202
+ - test/rbbt/ner/test_ngram_prefix_dictionary.rb
204
203
  - test/rbbt/entity/test_document.rb
205
- - test/rbbt/bow/test_bow.rb
206
204
  - test/rbbt/bow/test_dictionary.rb
205
+ - test/rbbt/bow/test_bow.rb
207
206
  - test/rbbt/bow/test_misc.rb
208
- - test/test_helper.rb
207
+ - test/rbbt/nlp/test_nlp.rb
208
+ - test/rbbt/nlp/open_nlp/test_sentence_splitter.rb