rbbt 1.1.1 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rbbt/ner/regexpNER.rb +6 -5
- data/lib/rbbt/sources/biomart.rb +4 -4
- data/lib/rbbt/util/rake.rb +18 -0
- metadata +3 -2
data/lib/rbbt/ner/regexpNER.rb
CHANGED
@@ -31,18 +31,19 @@ class RegExpNER
|
|
31
31
|
|
32
32
|
|
33
33
|
def initialize(lexicon, options = {})
|
34
|
-
options
|
35
|
-
|
36
|
-
options[:stopwords]
|
34
|
+
options = {:flatten => true, :ignorecase => true, :stopwords => nil}.merge options
|
35
|
+
|
36
|
+
options[:stopwords] = $stopwords if $stopwords && (options[:stopwords].nil? || options[:stopwords] == true)
|
37
|
+
options[:stopwords] ||= []
|
37
38
|
|
38
39
|
data = Open.to_hash(lexicon, options)
|
39
40
|
|
40
41
|
@index = {}
|
41
42
|
data.collect{|code, names|
|
42
43
|
next if code.nil? || code == ""
|
43
|
-
if options[:stopwords]
|
44
|
+
if options[:stopwords].any?
|
44
45
|
names = names.select{|n|
|
45
|
-
!
|
46
|
+
! options[:stopwords].include?(options[:ignorecase] ? n.downcase : n)
|
46
47
|
}
|
47
48
|
end
|
48
49
|
@index[code] = RegExpNER.build_re(names, options[:ignorecase])
|
data/lib/rbbt/sources/biomart.rb
CHANGED
@@ -37,12 +37,12 @@ module BioMart
|
|
37
37
|
query.sub!(/<!--MAIN-->/,"<Attribute name = \"#{main}\" />")
|
38
38
|
query.sub!(/<!--ATTRIBUTES-->/, attrs.collect{|name| "<Attribute name = \"#{ name }\"/>"}.join("\n") )
|
39
39
|
|
40
|
-
|
41
|
-
if
|
42
|
-
raise BioMart::QueryError,
|
40
|
+
response = Open.read('http://www.biomart.org/biomart/martservice?query=' + query.gsub(/\n/,' '))
|
41
|
+
if response =~ /Query ERROR:/
|
42
|
+
raise BioMart::QueryError, response
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
response.each_line{|l|
|
46
46
|
parts = l.chomp.split(/\t/)
|
47
47
|
main = parts.shift
|
48
48
|
next if main.nil? || main.empty?
|
@@ -0,0 +1,18 @@
|
|
1
|
+
def step(name, previous = nil, &block)
|
2
|
+
re = Regexp.new(/(?:^|\/)#{name}\/.*$/)
|
3
|
+
|
4
|
+
$step_descriptions ||= {}
|
5
|
+
if Rake.application.last_description
|
6
|
+
$step_descriptions[re] = {:step => name, :message => Rake.application.last_description}
|
7
|
+
Rake.application.last_description = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
if previous.nil?
|
11
|
+
deps = []
|
12
|
+
else
|
13
|
+
deps = lambda{|filename| filename.sub(name.to_s, previous.to_s)}
|
14
|
+
end
|
15
|
+
|
16
|
+
Rake.application.create_rule(re => deps, &block)
|
17
|
+
end
|
18
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-08 00:00:00 +01:00
|
13
13
|
default_executable: rbbt_config
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/rbbt/util/index.rb
|
126
126
|
- lib/rbbt/util/misc.rb
|
127
127
|
- lib/rbbt/util/open.rb
|
128
|
+
- lib/rbbt/util/rake.rb
|
128
129
|
- lib/rbbt/util/simpleDSL.rb
|
129
130
|
- lib/rbbt/util/tmpfile.rb
|
130
131
|
- tasks/install.rake
|