mesh-medical-subject-headings 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/CHANGELOG.md +2 -0
- data/CONTRIBUTING.md +27 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +25 -0
- data/LICENCE.md +617 -0
- data/MESH.gemspec +26 -0
- data/README.md +4 -0
- data/Rakefile +18 -0
- data/data/mesh_data_2014/c2014.bin.gz +0 -0
- data/data/mesh_data_2014/d2014.bin.gz +0 -0
- data/data/mesh_data_2014/mtrees2014.bin.gz +0 -0
- data/data/mesh_data_2014/q2014.bin.gz +0 -0
- data/data/mesh_data_2014/useful_2014.tsv +25573 -0
- data/lib/MESH.rb +2 -0
- data/lib/MESH/mesh.rb +214 -0
- data/lib/MESH/translator.rb +126 -0
- data/lib/MESH/version.rb +3 -0
- data/test/mesh_test.rb +440 -0
- data/test/test_helper.rb +16 -0
- data/test/translator_test.rb +52 -0
- metadata +141 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
gem "minitest"
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "minitest/pride"
|
4
|
+
require "minitest/mock"
|
5
|
+
require "mocha/setup"
|
6
|
+
|
7
|
+
lib = File.expand_path('../../lib', __FILE__)
|
8
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
9
|
+
|
10
|
+
require "MESH"
|
11
|
+
|
12
|
+
start = Time.now
|
13
|
+
MESH::Mesh.configure(filename: File.expand_path('../../data/mesh_data_2014/d2014.bin.gz', __FILE__))
|
14
|
+
finish = Time.now
|
15
|
+
configuration_time = finish - start
|
16
|
+
raise 'MESH::Mesh should configure in less than 10 seconds.' unless configuration_time < 10
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'MESH/translator'
|
3
|
+
|
4
|
+
module MESH
|
5
|
+
describe 'Testing MESH:Translator core functions' do
|
6
|
+
|
7
|
+
it 'should translate a single word' do
|
8
|
+
tr = MESH::Translator.new
|
9
|
+
assert_equal 'oesophagus', tr.translate('esophagus')
|
10
|
+
assert_equal 'aluminium', tr.translate('aluminum')
|
11
|
+
assert_equal 'gynaecology', tr.translate('gynecology')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should translate within a body of text' do
|
15
|
+
tr = MESH::Translator.new
|
16
|
+
input = 'a condition with damage to the lining of the lower esophagus resulting from chronic acid reflux (esophagitis, reflux). through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the intestine or the salmon-pink mucosa of the stomach. barrett\'s columnar epithelium is a marker for severe reflux and precursor to adenocarcinoma of the esophagus.'
|
17
|
+
expected = 'a condition with damage to the lining of the lower oesophagus resulting from chronic acid reflux (oesophagitis, reflux). through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the intestine or the salmon-pink mucosa of the stomach. barrett\'s columnar epithelium is a marker for severe reflux and precursor to adenocarcinoma of the oesophagus.'
|
18
|
+
|
19
|
+
assert_equal expected, tr.translate(input)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should match uppercase' do
|
23
|
+
tr = MESH::Translator.new
|
24
|
+
input = 'A condition with damage to the lining of the lower ESOPHAGUS resulting from chronic acid reflux (ESOPHAGITIS, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the esophagus.'
|
25
|
+
expected = 'A condition with damage to the lining of the lower OESOPHAGUS resulting from chronic acid reflux (OESOPHAGITIS, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the oesophagus.'
|
26
|
+
assert_equal expected, tr.translate(input)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should match title case' do
|
30
|
+
tr = MESH::Translator.new
|
31
|
+
input = 'A condition with damage to the lining of the lower Esophagus resulting from chronic acid reflux (Esophagitis, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the esophagus.'
|
32
|
+
expected = 'A condition with damage to the lining of the lower Oesophagus resulting from chronic acid reflux (Oesophagitis, REFLUX). Through the process of metaplasia, the squamous cells are replaced by a columnar epithelium with cells resembling those of the INTESTINE or the salmon-pink mucosa of the STOMACH. Barrett\'s columnar epithelium is a marker for severe reflux and precursor to ADENOCARCINOMA of the oesophagus.'
|
33
|
+
assert_equal expected, tr.translate(input)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should not change the input string' do
|
37
|
+
tr = MESH::Translator.new
|
38
|
+
input = 'esophagus'
|
39
|
+
assert_equal 'oesophagus', tr.translate(input)
|
40
|
+
assert_equal 'esophagus', input
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should maintain punctuation' do
|
44
|
+
tr = MESH::Translator.new
|
45
|
+
input = 'Esophagus, Barrett'
|
46
|
+
assert_equal 'Oesophagus, Barrett', tr.translate(input)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mesh-medical-subject-headings
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mmmmmrob
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.0.8
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.0.8
|
83
|
+
description: A ruby gem containing MeSH subject headings (https://www.nlm.nih.gov/mesh/)
|
84
|
+
for use in classifying and entity recognition.
|
85
|
+
email:
|
86
|
+
- rob@dynamicorange.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- CHANGELOG.md
|
93
|
+
- CONTRIBUTING.md
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENCE.md
|
97
|
+
- MESH.gemspec
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- data/mesh_data_2014/c2014.bin.gz
|
101
|
+
- data/mesh_data_2014/d2014.bin.gz
|
102
|
+
- data/mesh_data_2014/mtrees2014.bin.gz
|
103
|
+
- data/mesh_data_2014/q2014.bin.gz
|
104
|
+
- data/mesh_data_2014/useful_2014.tsv
|
105
|
+
- lib/MESH.rb
|
106
|
+
- lib/MESH/mesh.rb
|
107
|
+
- lib/MESH/translator.rb
|
108
|
+
- lib/MESH/version.rb
|
109
|
+
- test/mesh_test.rb
|
110
|
+
- test/test_helper.rb
|
111
|
+
- test/translator_test.rb
|
112
|
+
homepage: ''
|
113
|
+
licenses:
|
114
|
+
- AGPL3
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.2.0
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: A ruby gem containing MeSH subject headings (https://www.nlm.nih.gov/mesh/)
|
136
|
+
for use in classifying and entity recognition.
|
137
|
+
test_files:
|
138
|
+
- test/mesh_test.rb
|
139
|
+
- test/test_helper.rb
|
140
|
+
- test/translator_test.rb
|
141
|
+
has_rdoc:
|