mesh-medical-subject-headings 1.3.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/MESH/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mesh
2
- VERSION = "1.3.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/match.rb CHANGED
@@ -4,12 +4,12 @@ syllabus = [
4
4
  'Medicine', 'Anaesthetics', 'Analgesia', 'Anesthesia', 'Conscious Sedation', 'Deep Sedation', 'Neuromuscular Blockade', 'Breast', 'Breast Cyst', 'Breast Neoplasms', 'Fibrocystic Breast Disease', 'Lactation Disorders', 'Mastitis', 'Cardiology', 'Cardiovascular Diseases', 'Acute Coronary Syndrome', 'Myocardial Infarction', 'Unstable Angina', 'Cardiac Arrhythmias', 'Atrial Fibrillation', 'Atrial Flutter', 'Bradycardia', 'Heart Block', 'Long QT Syndrome', 'Tachycardia', 'Ventricular Fibrillation', 'Ventricular Flutter', 'Angina Pectoris', 'Heart Failure', 'Diastolic Heart Failure', 'Systolic Heart Failure', 'Hypertension', 'Heart Valve Diseases', 'Aortic Valve Insufficiency', 'Aortic Valve Stenosis', 'Mitral Valve Insufficiency', 'Mitral Valve Stenosis', 'Pulmonary Valve Insufficiency', 'Pulmonary Valve Stenosis', 'Tricuspid Valve Insufficiency', 'Tricuspid Valve Stenosis', 'Endocarditis', 'Pericardial Disease', 'Pericardial Effusion', 'Pericarditis', 'Cardiac Tamponade', 'Disease of Heart Muscle', 'Alcoholic Cardiomyopathy', 'Dilated Cardiomyopathy', 'Hypertrophic Cardiomyopathy', 'Restrictive Cardiomyopathy', 'Myocardial Reperfusion Injury', 'Myocarditis', 'Cardiovascular Investigations', 'Angiocardiography', 'Echocardiography', 'Electrocardiography', 'Heart Catheterization', 'Dermatology', 'Skin eruptions', 'Acne Vulgaris', 'Eczema', 'Erythroderma', 'Lichenoid Eruptions', 'Photosensitivity Disorders', 'Pityriasis', 'Psoriasis', 'Infectious Skin Diseases', 'Bacterial Skin Diseases', 'Fungal Skin Diseases', 'Bacillary Angiomatosis', 'Cellulitis', 'Cervicofacial Actinomycosis', 'Cutaneous Syphilis', 'Cutaneous Tuberculosis', 'Ecthyma', 'Erysipelas', 'Erythema Chronicum Migrans', 'Erythrasma', 'Granuloma Inguinale', 'Hidradenitis Suppurativa', 'Mycetoma', 'Necrotizing Fasciitis', 'Staphylococcal Skin Infections', 'Parasitic Skin Diseases', 'Ectoparasitic Infestations', 'Larva Migrans', 'Leishmaniasis', 'Lice Infestations', 'Onchocerciasis', 'Scabies', 'Viral Skin Diseases', 'Erythema Infectiosum', 'Exanthema Subitum', 'Herpes Simplex', 'Molluscum Contagiosum', 'Warts', 'Specific skin structure disease', 'Hair Diseases', 'Folliculitis', 'Hirsutism', 'Hypertrichosis', 'Hypotrichosis', 'Nail Diseases', 'Nail-Patella Syndrome', 'Ingrown Nails', 'Onycholysis', 'Onychomycosis', 'Pachyonychia Congenita', 'Paronychia', 'Yellow Nail Syndrome', 'Pigmentation Disorders', 'Cafe-au-Lait Spots', 'Hyperpigmentation', 'Hypopigmentation', 'Sweat Gland Diseases', 'Hidradenitis', 'Hyperhidrosis', 'Hypohidrosis', 'Prickly Heat', 'Vascular Skin Diseases', 'Livedo Reticularis', 'Purpura', 'Raynaud Disease', 'Skin Ulcer', 'Buruli Ulcer', 'Leg Ulcer', 'Pressure Ulcer', 'Pyoderma Gangrenosum', 'Telangiectasis', 'Vasculitis', 'Inherited skin disease', 'Darier Disease', 'Ehlers-Danlos Syndrome', 'Ichthyosis Vulgaris', 'Neurofibromatoses', 'Palmoplantar Keratoderma', 'Pseudoxanthoma Elasticum', 'Tuberous Sclerosis', 'Xeroderma Pigmentosum', 'Skin Neoplasms', 'Benign skin tumours', 'Keloid', 'Lipoma', 'Pyogenic Granuloma', 'Seborrheic Keratosis', 'Premalignant and malignant skin disease', 'Actinic Keratosis', 'Bowen\'s Disease', 'Nevi and Melanomas', 'Keratoacanthoma', 'Mycosis Fungoides', 'Emergency Medicine', 'Acute Abdomen', 'Bradycardia', 'Dyspnea', 'Burns', 'Chest pain', 'Coma', 'Diabetic Ketoacidosis', 'Gastrointestinal Hemorrhage', 'Hyperglycemic Hyperosmolar Nonketotic Coma', 'Hyperkalemia', 'Hypoglycemia', 'Hypotension', 'Acute Liver Failure', 'Poisoning', 'Meningitis', 'Acute Kidney Failure', 'Seizures', 'Shock', 'Stroke', 'Tachycardia', 'Resuscitation', 'Spinal Cord Compression', 'Pre-Eclampsia', 'Endocrinology', 'Thyroid Diseases', 'Euthyroid Sick Syndromes', 'Goiter', 'Hyperthyroidism', 'Hypothyroidism', 'Thyroid Dysgenesis', 'Thyroid Neoplasms', 'Thyroiditis', 'Thyrotoxicosis', 'Parathyroid Diseases', 'Hyperparathyroidism', 'Hypoparathyroidism', 'Parathyroid Neoplasms', 'Adrenal Gland Diseases', 'Adrenal Cortex Neoplasms', 'Congenital Adrenal Hyperplasia', 'Addison Disease', 'Adrenoleukodystrophy', 'Hypoaldosteronism', 'Cushing Syndrome', 'Hyperaldosteronism', 'Pituitary Diseases', 'Diabetes Insipidus', 'Hyperpituitarism', 'Hypopituitarism', 'Inappropriate ADH Syndrome', 'Pituitary Apoplexy', 'Pituitary Neoplasms', 'Diabetes Mellitus', 'Gastroenterology', 'Biliary Tract Diseases', 'Cholelithiasis', 'Cholecystitis', 'Sclerosing Cholangitis', 'Biliary Liver Cirrhosis', 'Liver Diseases', 'Liver Failure', 'Liver Cirrhosis', 'Viral, Human Hepatitis', 'Hemochromatosis', 'alpha 1-Antitrypsin Deficiency', 'Hepatolenticular Degeneration', 'Alcoholic Liver Diseases', 'Liver Neoplasms', 'Focal Nodular Hyperplasia', 'Liver Cell Adenoma', 'Hemangioma', 'Hepatocellular Carcinoma', 'Pancreatic Neoplasms', 'Gastroesophageal Reflux', 'Gastroenteritis', 'Gastrointestinal Hemorrhage', 'Gastrointestinal Neoplasms', 'Ulcerative Colitis', 'Crohn Disease', 'Peptic Ulcer', 'Pancreatitis', 'General Practice', 'Analgesia', 'Breast Neoplasms', 'Hypertension', 'Heart Failure', 'Atrial Fibrillation', 'Skin eruptions', 'Infectious Skin Diseases', 'Skin Neoplasms', 'Diabetes Mellitus', 'Gastroesophageal Reflux', 'Gastroenteritis', 'Anaemia', 'Headache', 'Dementia', 'Failure to Thrive', 'Asthma', 'Chronic Obstructive Pulmonary Disease', 'Depression', 'Anxiety Disorders', 'Arthritis', 'Haematology', 'Anaemia', 'Leukaemia', 'Myeloid, Acute Leukaemia', 'Myeloid Leukemia, Chronic', 'Acute Lymphoblastic Leukemia', 'Chronic Lymphoblastic Leukemia', 'Myeloproliferative Disorders', 'Erythroblastic, Acute Leukaemia', 'Polycythemia Vera', 'Primary Myelofibrosis', 'Thrombocythemia', 'Blood Coagulation Disorders', 'Hemophilia A', 'Hemophilia B', 'Thrombocytopenic Purpura', 'Von Willebrand Diseases', 'Lymphoma', 'Hodgkin Disease', 'Non-Hodgkin Lymphoma', 'Paraproteinemias', 'Multiple Myeloma', 'Cryoglobulinemia', 'Waldenstrom Macroglobulinemia', 'Infectious Diseases', 'Virus Diseases', 'Viral, Human Hepatitis', 'Cytomegalovirus Infections', 'Poxviruses', 'Viral Hemorrhagic Fevers', 'HIV Infections', 'Bacterial diseases', 'Mycobacterium tuberculosis', 'Mycobacterium leprae', 'Diphtheria', 'Tetanus', 'Typhoid Fever', 'Cholera', 'Shigella', 'Parasicitc and protazoa infections', 'Malaria', 'Amoebiasis', 'Giardiasis', 'Toxoplasmosis', 'Cryptosporidiosis', 'Leishmaniasis', 'Trypanosomiasis', 'Lyme Disease', 'Filariasis', 'Schistosomiasis', 'Neurology', 'Trigeminal Neuralgia', 'Headache', 'Dizziness', 'Vertigo', 'Stroke', 'Parkinsonian Disorders', 'Multiple Sclerosis', 'Motor Neuron Disease', 'Epilepsy', 'Cranial Nerve Diseases', 'Meningitis', 'Nervous System Neoplasms', 'Dementia', 'Oncology and palliative care', 'Lung Neoplasms', 'Breast Neoplasms', 'Prostatic Neoplasms', 'Colorectal Neoplasms', 'Liver Neoplasms', 'Pancreatic Neoplasms', 'Palliative Care', 'Analgesia', 'Ophthalmology', 'Conjunctivitis', 'Retinal Hemorrhage', 'Vitreous Hemorrhage', 'Viral Conjunctivitis', 'Herpetic Keratitis', 'Eye Injuries', 'Cataract', 'Glaucoma', 'Ocular Motility Disorders', 'Orbital Diseases', 'Refractive Errors', 'Retinal Diseases', 'Paediatrics', 'Neonatology', 'Paediatric Infections', 'Measles', 'Rubella', 'Mumps', 'Chickenpox', 'Paediatric Diseases', 'Cystic Fibrosis', 'Asthma', 'Endocarditis', 'Rheumatic Fever', 'Coeliac Disease', 'Chromosome Disorders', 'Diabetes Mellitus', 'Meningococcal Meningitis', 'Febrile Seizures', 'Mental Disorders Diagnosed in Childhood', 'Failure to Thrive', 'Psychiatry', 'Depression', 'Anxiety Disorders', 'Bipolar Disorder', 'Schizophrenia', 'Psychotic Disorders', 'Deliberate Self-Harm', 'Eating Disorders', 'Substance-Related Disorders', 'Personality Disorders', 'Radiology', 'Angiography', 'Mammography', 'Abdominal Radiography', 'Interventional Radiography', 'Thoracic Radiography', 'X-Ray Tomography', 'Respiratory Medicine', 'Pneumonia', 'Bronchiectasis', 'Cystic Fibrosis', 'Fungal Lung Diseases', 'Lung Neoplasms', 'Asthma', 'Chronic Obstructive Pulmonary Disease', 'Respiratory Insufficiency', 'Pneumothorax', 'Pleural Effusion', 'Sarcoidosis', 'Extrinsic Allergic Alveolitis', 'Mesothelioma', 'Idiopathic Pulmonary Fibrosis', 'Obstructive Sleep Apnea', 'Pulmonary oedema', 'Rheumatology', 'Rheumatoid Arthritis', 'Osteoarthritis', 'Fibromyalgia', 'Gout', 'Osteoarthritis', 'Polymyalgia Rheumatica', 'Rheumatic Fever', 'Spondylarthropathies', 'Connective Tissue Diseases', 'Vasculitis', 'Renal Medicine', 'Acute Kidney Failure', 'Chronic Renal Insufficiency', 'Kidney Neoplasms', 'Glomerulonephritis', 'Anti-Glomerular Basement Membrane Disease', 'IGA Glomerulonephritis', 'Membranoproliferative Glomerulonephritis', 'Membranous Glomerulonephritis', 'Focal Segmental Glomerulosclerosis', 'Nephrotic Syndrome', 'Minimal Change Disease', 'Urinary Tract Infections', 'Nephrolithiasis', 'Cystic Kidney Diseases', 'Renal Osteodystrophy', 'Water-Electrolyte Imbalance', 'Specialties, Surgical', 'Ophthalmology', 'Conjunctivitis', 'Retinal Hemorrhage', 'Vitreous Hemorrhage', 'Viral Conjunctivitis', 'Herpetic Keratitis', 'Eye Injuries', 'Cataract', 'Glaucoma', 'Ocular Motility Disorders', 'Orbital Diseases', 'Refractive Errors', 'Retinal Diseases', 'Breast', 'Breast Cyst', 'Breast Neoplasms', 'Fibrocystic Breast Disease', 'Lactation Disorders', 'Mastitis', 'Orthopaedics and Trauma', 'Hip Dislocation', 'Hip Fractures', 'Radius Fractures', 'Ulna Fractures', 'Shoulder Dislocation', 'Shoulder Fractures', 'Spinal Injuries', 'Carpal Tunnel Syndrome', 'Cauda Equina', 'Osteomyelitis', 'Obstetrics', 'Eclampsia', 'Spontaneous Abortion', 'Gestational Diabetes', 'Obstetric Labour Complications', 'Abruptio Placentae', 'Breech Presentation', 'Cephalopelvic Disproportion', 'Dystocia', 'Premature Rupture Fetal Membranes', 'Premature Obstetric Labour', 'Placenta Previa', 'Postpartum Hemorrhage', 'Uterine Inversion', 'Uterine Rupture', 'Vasa Previa', 'Ectopic Pregnancy', 'Gynaecology', 'Hysterectomy', 'Menorrhagia', 'Polycystic Ovary Syndrome', 'Induced Abortion', 'Ectopic Pregnancy', 'Contraception', 'Ovarian Diseases', 'Endometrial Neoplasms', 'Ovarian Neoplasms', 'Female Genital Neoplasms', 'Fallopian Tube Neoplasms', 'Ovarian Neoplasms', 'Uterine Neoplasms', 'Vaginal Neoplasms', 'Vulvar Neoplasms', 'Ear nose and throat (ENT)', 'Cholesteatoma', 'Otitis Media', 'Deafness', 'Epistaxis', 'Nasal Polyps', 'Tonsillar Neoplasms', 'Hoarseness', 'Lumps in the neck', 'Maxillofacial', 'Jaw Fractures', 'Mandibular Injuries', 'Orbital Fractures', 'Zygomatic Fractures', 'Plastic surgery', 'Surgical Flaps', 'Burns', 'Hand Injuries', 'Suture Techniques', 'Breast Reconstruction', 'Urology', 'Urolithiasis', 'Prostatic Hyperplasia', 'Urethral Obstruction', 'Penile Diseases', 'Prostatic Neoplasms', 'Urinary Bladder Neoplasms', 'Testicular Neoplasms', 'Urinary Retention', 'Cardiothoracic surgery', 'Pulmonary Surgical Procedures', 'Cardiac Surgical Procedures', 'Vascular surgery', 'Varicose Veins', 'Arterial Occlusive Diseases', 'Peripheral Vascular Diseases', 'Embolism and Thrombosis', 'Compartment Syndromes', 'Aortic Diseases', 'Aneurysm', 'Carotid Endarterectomy', 'Paediatric Surgery', 'Gastroschisis', 'Hernia', 'Pyloric Stenosis', 'Esophageal Atresia', 'Biliary Atresia', 'Hirschsprung Disease', 'Intussusception', 'Intestinal Volvulus', 'Umbilical Hernia', 'Spermatic Cord Torsion', 'Cryptorchidism', 'Appendicitis', 'General surgery', 'Appendicitis', 'Hernia', 'Hemorrhoids', 'Peritonitis', 'Crohn Disease', 'Ulcerative Colitis', 'Colorectal Neoplasms', 'Esophageal Neoplasms', 'Diverticular disease', 'Cholelithiasis', 'Basic Sciences', 'Anatomy', 'Musculoskeletal System', 'Cardiovascular System', 'Respiratory System', 'Digestive System', 'Peripheral Nervous System', 'Central Nervous System', 'Physiology', 'Cardiovascular Physiology', 'Respiratory Physiology', 'Musculoskeletal Physiology', 'Digestive Physiology', 'Nervous System Physiology', 'Biochemistry', 'Histology', 'Pharmacology', 'Epidemiology', 'Statistics', 'Embryology', 'Sociology', 'Pathology', 'Immunology and Microbiology', 'Ethics and Law', 'Clinical Skills', 'Examination skills', 'Musculoskeletal Examination', 'Cardiovascular Examination', 'Respiratory Examination', 'Abdominal Examination', 'Neurological Examination', 'Cranial nerve examination', 'Motor system examination', 'Sensory system examination', 'Breast Examination', 'Thyroid Examination', 'Otoscopic Examination', 'Gynaecological Examination', 'Antenatal Examination', 'Opthalmoscopy', 'Practical procedures', 'Venipuncture', 'Cannulation', 'Arterial Blood Gas', 'Urinary Catheterization', 'Subcutaneous Injections', 'Intramuscular Injections', 'Lumbar Puncture', 'Nasogastric Tubes', 'Pleural Tap', 'Paracentesis', 'Chest Drain Insertion', 'Central Line', 'Spirometry'
5
5
  ]
6
6
 
7
- MESH::Mesh.configure(filename: 'data/mesh_data_2014/d2014.bin.gz')
7
+ MESH::Heading.configure(filename: 'data/mesh_data_2014/d2014.bin.gz')
8
8
  syllabus.each do |si|
9
9
 
10
- if mh = MESH::Mesh.find_by_original_heading(si)
10
+ if mh = MESH::Heading.find_by_original_heading(si)
11
11
  puts "#{si}\t1\t#{mh.inspect}\t#{mh.shallowest_position unless mh.nil?}\t#{mh.deepest_position unless mh.nil?}"
12
- elsif matches = MESH::Mesh.match_in_text(si)
12
+ elsif matches = MESH::Heading.match_in_text(si)
13
13
  topical_matches = matches.map do |m|
14
14
  if m[:heading].descriptor_class == :topical_descriptor
15
15
  "#{m[:heading].inspect}, #{m[:heading].shallowest_position}, #{m[:heading].deepest_position}"
@@ -16,234 +16,223 @@ module MESH
16
16
  end
17
17
  end
18
18
 
19
- #def test_headers
20
- # @texts.each do |k, v|
21
- # matches = MESH::Mesh.match_in_text(v)
22
- # puts k
23
- # puts matches
24
- # end
25
- #end
26
- #classifications = classifier.classify([{matches: title_matches, weight: 5.0}, {matches: abstract_matches, weight: 2.0}, {matches: content_matches, weight: 1.0}])
27
-
28
19
  def test_it_should_classify_title
29
- c = MESH::Classifier.new()
30
-
31
20
  expected = {
32
21
  'H' => [1.0, {
33
- MESH::Mesh.find('D000715') => 1.0,
34
- MESH::Mesh.find('D001690') => 0.333,
35
- MESH::Mesh.find('D010811') => 0.111
22
+ @mesh_tree.find('D000715') => 1.0,
23
+ @mesh_tree.find('D001690') => 0.333,
24
+ @mesh_tree.find('D010811') => 0.111
36
25
  }],
37
26
  'A' => [1.0, {
38
- MESH::Mesh.find('D005542') => 1.0,
39
- MESH::Mesh.find('D034941') => 0.333,
40
- MESH::Mesh.find('D005121') => 0.111,
41
- MESH::Mesh.find('D001829') => 0.037
27
+ @mesh_tree.find('D005542') => 1.0,
28
+ @mesh_tree.find('D034941') => 0.333,
29
+ @mesh_tree.find('D005121') => 0.111,
30
+ @mesh_tree.find('D001829') => 0.037
42
31
  }]
43
32
  }
44
- assert_classification expected, c.classify([{matches: @headings[:forearm_anatomy_title], weight: 1.0}])
33
+ assert_classification expected, @classifier.classify([{matches: @headings[:forearm_anatomy_title], weight: 1.0}])
45
34
 
46
35
  expected = {
47
36
  'H' => [1.0, {
48
- MESH::Mesh.find('D002309') => 1.0,
49
- MESH::Mesh.find('D007388') => 0.333,
50
- MESH::Mesh.find('D008511') => 0.111,
51
- MESH::Mesh.find('D006281') => 0.037
37
+ @mesh_tree.find('D002309') => 1.0,
38
+ @mesh_tree.find('D007388') => 0.333,
39
+ @mesh_tree.find('D008511') => 0.111,
40
+ @mesh_tree.find('D006281') => 0.037
52
41
  }]
53
42
  }
54
- assert_classification expected, c.classify([{matches: @headings[:cardiology_title], weight: 1.0}])
43
+ assert_classification expected, @classifier.classify([{matches: @headings[:cardiology_title], weight: 1.0}])
55
44
  end
56
45
 
57
46
  def test_it_should_classify_poor_abstract
58
- c = MESH::Classifier.new()
47
+
59
48
  expected = {
60
49
  'I' => [1.0, {
61
- MESH::Mesh.find('D013337') => 1.0,
62
- MESH::Mesh.find('D013336') => 0.667,
63
- MESH::Mesh.find('D013334') => 0.444,
64
- MESH::Mesh.find('D004505') => 0.148,
65
- MESH::Mesh.find('D004493') => 0.198
50
+ @mesh_tree.find('D013337') => 1.0,
51
+ @mesh_tree.find('D013336') => 0.667,
52
+ @mesh_tree.find('D013334') => 0.444,
53
+ @mesh_tree.find('D004505') => 0.148,
54
+ @mesh_tree.find('D004493') => 0.198
66
55
  }],
67
56
  'M' => [1.0, {
68
- MESH::Mesh.find('D013337') => 1.0,
69
- MESH::Mesh.find('D013336') => 0.667,
70
- MESH::Mesh.find('D013334') => 0.444,
71
- MESH::Mesh.find('D009272') => 0.148
57
+ @mesh_tree.find('D013337') => 1.0,
58
+ @mesh_tree.find('D013336') => 0.667,
59
+ @mesh_tree.find('D013334') => 0.444,
60
+ @mesh_tree.find('D009272') => 0.148
72
61
  }]
73
62
  }
74
- assert_classification expected, c.classify([{matches: @headings[:poor_abstract], weight: 1.0}])
63
+ assert_classification expected, @classifier.classify([{matches: @headings[:poor_abstract], weight: 1.0}])
75
64
  end
76
65
 
77
66
  def test_it_should_classify_good_abstract
78
67
 
79
- c = MESH::Classifier.new()
68
+
80
69
  expected = {
81
70
  'A' => [1.0, {
82
- MESH::Mesh.find('D001158') => 1.0,
83
- MESH::Mesh.find('D001808') => 0.333,
84
- MESH::Mesh.find('D002319') => 0.111,
85
- MESH::Mesh.find('D009333') => 1.0,
86
- MESH::Mesh.find('D001829') => 0.333
71
+ @mesh_tree.find('D001158') => 1.0,
72
+ @mesh_tree.find('D001808') => 0.333,
73
+ @mesh_tree.find('D002319') => 0.111,
74
+ @mesh_tree.find('D009333') => 1.0,
75
+ @mesh_tree.find('D001829') => 0.333
87
76
  }],
88
77
 
89
78
  'B' => [1.0, {
90
- MESH::Mesh.find('D006801') => 1.0,
91
- MESH::Mesh.find('D015186') => 0.333,
92
- MESH::Mesh.find('D051079') => 0.111,
93
- MESH::Mesh.find('D000882') => 0.037,
94
- MESH::Mesh.find('D011323') => 0.012,
95
- MESH::Mesh.find('D008322') => 0.004,
96
- MESH::Mesh.find('D014714') => 0.001,
79
+ @mesh_tree.find('D006801') => 1.0,
80
+ @mesh_tree.find('D015186') => 0.333,
81
+ @mesh_tree.find('D051079') => 0.111,
82
+ @mesh_tree.find('D000882') => 0.037,
83
+ @mesh_tree.find('D011323') => 0.012,
84
+ @mesh_tree.find('D008322') => 0.004,
85
+ @mesh_tree.find('D014714') => 0.001,
97
86
  }],
98
87
  'F' => [2.0, {
99
- MESH::Mesh.find('D014836') => 2.0,
100
- MESH::Mesh.find('D008606') => 0.667,
101
- MESH::Mesh.find('D011579') => 0.222,
102
- MESH::Mesh.find('D035781') => 1.0,
103
- MESH::Mesh.find('D009679') => 0.667,
104
- MESH::Mesh.find('D005190') => 0.444,
105
- MESH::Mesh.find('D011593') => 0.148,
106
- MESH::Mesh.find('D001520') => 0.049,
107
- MESH::Mesh.find('D011584') => 0.049,
108
- MESH::Mesh.find('D001525') => 0.049,
109
- MESH::Mesh.find('D004191') => 0.016,
110
- MESH::Mesh.find('D012961') => 0.148,
111
- MESH::Mesh.find('D012942') => 0.099
88
+ @mesh_tree.find('D014836') => 2.0,
89
+ @mesh_tree.find('D008606') => 0.667,
90
+ @mesh_tree.find('D011579') => 0.222,
91
+ @mesh_tree.find('D035781') => 1.0,
92
+ @mesh_tree.find('D009679') => 0.667,
93
+ @mesh_tree.find('D005190') => 0.444,
94
+ @mesh_tree.find('D011593') => 0.148,
95
+ @mesh_tree.find('D001520') => 0.049,
96
+ @mesh_tree.find('D011584') => 0.049,
97
+ @mesh_tree.find('D001525') => 0.049,
98
+ @mesh_tree.find('D004191') => 0.016,
99
+ @mesh_tree.find('D012961') => 0.148,
100
+ @mesh_tree.find('D012942') => 0.099
112
101
  }],
113
102
  'H' => [3.0, {
114
- MESH::Mesh.find('D000715') => 3.0,
115
- MESH::Mesh.find('D001690') => 1.0,
116
- MESH::Mesh.find('D010811') => 0.333
103
+ @mesh_tree.find('D000715') => 3.0,
104
+ @mesh_tree.find('D001690') => 1.0,
105
+ @mesh_tree.find('D010811') => 0.333
117
106
  }],
118
107
  'I' => [2.0, {
119
- MESH::Mesh.find('D013334') => 1.0,
120
- MESH::Mesh.find('D004505') => 0.333,
121
- MESH::Mesh.find('D004493') => 0.778,
122
- MESH::Mesh.find('D013663') => 1.0,
123
- MESH::Mesh.find('D014937') => 1.0,
124
- MESH::Mesh.find('D006802') => 0.333,
125
- MESH::Mesh.find('D018594') => 2.0,
126
- MESH::Mesh.find('D003469') => 0.667,
127
- MESH::Mesh.find('D000884') => 0.222,
128
- MESH::Mesh.find('D000883') => 0.074,
129
- MESH::Mesh.find('D012942') => 0.296,
130
- MESH::Mesh.find('D012961') => 0.370,
131
- MESH::Mesh.find('D035781') => 1.0,
132
- MESH::Mesh.find('D009679') => 0.667,
133
- MESH::Mesh.find('D005190') => 0.444
108
+ @mesh_tree.find('D013334') => 1.0,
109
+ @mesh_tree.find('D004505') => 0.333,
110
+ @mesh_tree.find('D004493') => 0.778,
111
+ @mesh_tree.find('D013663') => 1.0,
112
+ @mesh_tree.find('D014937') => 1.0,
113
+ @mesh_tree.find('D006802') => 0.333,
114
+ @mesh_tree.find('D018594') => 2.0,
115
+ @mesh_tree.find('D003469') => 0.667,
116
+ @mesh_tree.find('D000884') => 0.222,
117
+ @mesh_tree.find('D000883') => 0.074,
118
+ @mesh_tree.find('D012942') => 0.296,
119
+ @mesh_tree.find('D012961') => 0.370,
120
+ @mesh_tree.find('D035781') => 1.0,
121
+ @mesh_tree.find('D009679') => 0.667,
122
+ @mesh_tree.find('D005190') => 0.444
134
123
  }],
135
124
  'K' => [2.0, {
136
- MESH::Mesh.find('D018594') => 2.0,
137
- MESH::Mesh.find('D001154') => 0.667,
138
- MESH::Mesh.find('D006809') => 0.556,
139
- MESH::Mesh.find('D019359') => 1.0
125
+ @mesh_tree.find('D018594') => 2.0,
126
+ @mesh_tree.find('D001154') => 0.667,
127
+ @mesh_tree.find('D006809') => 0.556,
128
+ @mesh_tree.find('D019359') => 1.0
140
129
  }],
141
130
  'L' => [1.0, {
142
- MESH::Mesh.find('D019359') => 1.0,
143
- MESH::Mesh.find('D007254') => 0.333
131
+ @mesh_tree.find('D019359') => 1.0,
132
+ @mesh_tree.find('D007254') => 0.333
144
133
  }],
145
134
  'M' => [1.0, {
146
- MESH::Mesh.find('D013334') => 1.0,
147
- MESH::Mesh.find('D009272') => 0.667,
148
- MESH::Mesh.find('D035781') => 1.0
135
+ @mesh_tree.find('D013334') => 1.0,
136
+ @mesh_tree.find('D009272') => 0.667,
137
+ @mesh_tree.find('D035781') => 1.0
149
138
  }],
150
139
  'Z' => [3.0, {
151
- MESH::Mesh.find('D008131') => 3.0,
152
- MESH::Mesh.find('D002947') => 1.0,
153
- MESH::Mesh.find('D005842') => 0.481,
154
- MESH::Mesh.find('D004739') => 1.0,
155
- MESH::Mesh.find('D006113') => 0.667,
156
- MESH::Mesh.find('D005060') => 0.222,
157
- MESH::Mesh.find('D062312') => 0.222
140
+ @mesh_tree.find('D008131') => 3.0,
141
+ @mesh_tree.find('D002947') => 1.0,
142
+ @mesh_tree.find('D005842') => 0.481,
143
+ @mesh_tree.find('D004739') => 1.0,
144
+ @mesh_tree.find('D006113') => 0.667,
145
+ @mesh_tree.find('D005060') => 0.222,
146
+ @mesh_tree.find('D062312') => 0.222
158
147
  }]
159
148
 
160
149
  }
161
- assert_classification expected, c.classify([{matches: @headings[:good_abstract], weight: 1.0}])
150
+ assert_classification expected, @classifier.classify([{matches: @headings[:good_abstract], weight: 1.0}])
162
151
  end
163
152
 
164
153
  def test_it_should_classify_content
165
- c = MESH::Classifier.new()
154
+
166
155
  expected = {
167
156
  'A' => [10.0, {
168
- MESH::Mesh.find('D001132') => 1.0, MESH::Mesh.find('D034941') => 1.0, MESH::Mesh.find('D005121') => 2.556, MESH::Mesh.find('D001829') => 1.370, MESH::Mesh.find('D001415') => 1.0, MESH::Mesh.find('D060726') => 1.333, MESH::Mesh.find('D005123') => 2.0, MESH::Mesh.find('D005145') => 0.667, MESH::Mesh.find('D006257') => 0.222, MESH::Mesh.find('D012679') => 0.667, MESH::Mesh.find('D006225') => 2.0, MESH::Mesh.find('D006321') => 10.0, MESH::Mesh.find('D002319') => 3.333, MESH::Mesh.find('D007866') => 2.0, MESH::Mesh.find('D035002') => 0.667, MESH::Mesh.find('D013909') => 3.0, MESH::Mesh.find('D001842') => 1.0, MESH::Mesh.find('D012863') => 0.333, MESH::Mesh.find('D009141') => 0.111, MESH::Mesh.find('D003238') => 0.333, MESH::Mesh.find('D014024') => 0.111
157
+ @mesh_tree.find('D001132') => 1.0, @mesh_tree.find('D034941') => 1.0, @mesh_tree.find('D005121') => 2.556, @mesh_tree.find('D001829') => 1.370, @mesh_tree.find('D001415') => 1.0, @mesh_tree.find('D060726') => 1.333, @mesh_tree.find('D005123') => 2.0, @mesh_tree.find('D005145') => 0.667, @mesh_tree.find('D006257') => 0.222, @mesh_tree.find('D012679') => 0.667, @mesh_tree.find('D006225') => 2.0, @mesh_tree.find('D006321') => 10.0, @mesh_tree.find('D002319') => 3.333, @mesh_tree.find('D007866') => 2.0, @mesh_tree.find('D035002') => 0.667, @mesh_tree.find('D013909') => 3.0, @mesh_tree.find('D001842') => 1.0, @mesh_tree.find('D012863') => 0.333, @mesh_tree.find('D009141') => 0.111, @mesh_tree.find('D003238') => 0.333, @mesh_tree.find('D014024') => 0.111
169
158
  }],
170
159
  'B' => [1.0, {
171
- MESH::Mesh.find('D027861') => 1.0, MESH::Mesh.find('D027824') => 0.333, MESH::Mesh.find('D019685') => 0.111, MESH::Mesh.find('D019684') => 0.037, MESH::Mesh.find('D019669') => 0.012, MESH::Mesh.find('D057949') => 0.004, MESH::Mesh.find('D057948') => 0.001
160
+ @mesh_tree.find('D027861') => 1.0, @mesh_tree.find('D027824') => 0.333, @mesh_tree.find('D019685') => 0.111, @mesh_tree.find('D019684') => 0.037, @mesh_tree.find('D019669') => 0.012, @mesh_tree.find('D057949') => 0.004, @mesh_tree.find('D057948') => 0.001
172
161
  }],
173
162
  'C' => [1.0, {
174
- MESH::Mesh.find('D003221') => 1.0, MESH::Mesh.find('D019954') => 1.0, MESH::Mesh.find('D009461') => 0.667, MESH::Mesh.find('D009422') => 0.222, MESH::Mesh.find('D012816') => 0.222, MESH::Mesh.find('D013568') => 0.074
163
+ @mesh_tree.find('D003221') => 1.0, @mesh_tree.find('D019954') => 1.0, @mesh_tree.find('D009461') => 0.667, @mesh_tree.find('D009422') => 0.222, @mesh_tree.find('D012816') => 0.222, @mesh_tree.find('D013568') => 0.074
175
164
  }],
176
165
  'D' => [13.0, {
177
- MESH::Mesh.find('D007854') => 13.0, MESH::Mesh.find('D019216') => 8.667, MESH::Mesh.find('D004602') => 2.889, MESH::Mesh.find('D007287') => 1.926, MESH::Mesh.find('D008670') => 2.889
166
+ @mesh_tree.find('D007854') => 13.0, @mesh_tree.find('D019216') => 8.667, @mesh_tree.find('D004602') => 2.889, @mesh_tree.find('D007287') => 1.926, @mesh_tree.find('D008670') => 2.889
178
167
  }],
179
168
  'E' => [2.0, {
180
- MESH::Mesh.find('D004562') => 2.0, MESH::Mesh.find('D006334') => 0.667, MESH::Mesh.find('D003935') => 0.222, MESH::Mesh.find('D019937') => 0.296, MESH::Mesh.find('D003933') => 0.099, MESH::Mesh.find('D004568') => 0.667
169
+ @mesh_tree.find('D004562') => 2.0, @mesh_tree.find('D006334') => 0.667, @mesh_tree.find('D003935') => 0.222, @mesh_tree.find('D019937') => 0.296, @mesh_tree.find('D003933') => 0.099, @mesh_tree.find('D004568') => 0.667
181
170
  }],
182
171
  'F' => [4.0, {
183
- MESH::Mesh.find('D003221') => 1.0, MESH::Mesh.find('D019954') => 1.0, MESH::Mesh.find('D001520') => 0.333, MESH::Mesh.find('D007858') => 1.0, MESH::Mesh.find('D008606') => 2.0, MESH::Mesh.find('D011579') => 0.704, MESH::Mesh.find('D011588') => 0.333, MESH::Mesh.find('D011585') => 0.111, MESH::Mesh.find('D011584') => 0.111, MESH::Mesh.find('D001525') => 0.037, MESH::Mesh.find('D004191') => 0.012, MESH::Mesh.find('D013850') => 1.0, MESH::Mesh.find('D014836') => 4.0
172
+ @mesh_tree.find('D003221') => 1.0, @mesh_tree.find('D019954') => 1.0, @mesh_tree.find('D001520') => 0.333, @mesh_tree.find('D007858') => 1.0, @mesh_tree.find('D008606') => 2.0, @mesh_tree.find('D011579') => 0.704, @mesh_tree.find('D011588') => 0.333, @mesh_tree.find('D011585') => 0.111, @mesh_tree.find('D011584') => 0.111, @mesh_tree.find('D001525') => 0.037, @mesh_tree.find('D004191') => 0.012, @mesh_tree.find('D013850') => 1.0, @mesh_tree.find('D014836') => 4.0
184
173
  }],
185
174
  'G' => [2.0, {
186
- MESH::Mesh.find('D000200') => 2.0, MESH::Mesh.find('D008564') => 2.0, MESH::Mesh.find('D055592') => 0.667, MESH::Mesh.find('D055585') => 0.691, MESH::Mesh.find('D002468') => 0.667, MESH::Mesh.find('D055724') => 0.667, MESH::Mesh.find('D010829') => 0.222, MESH::Mesh.find('D009424') => 0.667, MESH::Mesh.find('D055687') => 0.222, MESH::Mesh.find('D013995') => 1.0, MESH::Mesh.find('D014919') => 1.0, MESH::Mesh.find('D000392') => 1.0, MESH::Mesh.find('D055907') => 0.333, MESH::Mesh.find('D055691') => 0.111, MESH::Mesh.find('D055669') => 0.416, MESH::Mesh.find('D001686') => 0.139, MESH::Mesh.find('D014887') => 1.0, MESH::Mesh.find('D001272') => 0.889, MESH::Mesh.find('D004777') => 0.506, MESH::Mesh.find('D008685') => 0.630, MESH::Mesh.find('D000388') => 0.333, MESH::Mesh.find('D014965') => 1.0, MESH::Mesh.find('D060733') => 0.667, MESH::Mesh.find('D055590') => 0.222, MESH::Mesh.find('D060328') => 0.074, MESH::Mesh.find('D011827') => 0.333, MESH::Mesh.find('D011839') => 0.333
175
+ @mesh_tree.find('D000200') => 2.0, @mesh_tree.find('D008564') => 2.0, @mesh_tree.find('D055592') => 0.667, @mesh_tree.find('D055585') => 0.691, @mesh_tree.find('D002468') => 0.667, @mesh_tree.find('D055724') => 0.667, @mesh_tree.find('D010829') => 0.222, @mesh_tree.find('D009424') => 0.667, @mesh_tree.find('D055687') => 0.222, @mesh_tree.find('D013995') => 1.0, @mesh_tree.find('D014919') => 1.0, @mesh_tree.find('D000392') => 1.0, @mesh_tree.find('D055907') => 0.333, @mesh_tree.find('D055691') => 0.111, @mesh_tree.find('D055669') => 0.416, @mesh_tree.find('D001686') => 0.139, @mesh_tree.find('D014887') => 1.0, @mesh_tree.find('D001272') => 0.889, @mesh_tree.find('D004777') => 0.506, @mesh_tree.find('D008685') => 0.630, @mesh_tree.find('D000388') => 0.333, @mesh_tree.find('D014965') => 1.0, @mesh_tree.find('D060733') => 0.667, @mesh_tree.find('D055590') => 0.222, @mesh_tree.find('D060328') => 0.074, @mesh_tree.find('D011827') => 0.333, @mesh_tree.find('D011839') => 0.333
187
176
  }],
188
177
  'I' => [1.0, {
189
- MESH::Mesh.find('D014937') => 1.0, MESH::Mesh.find('D006802') => 0.333
178
+ @mesh_tree.find('D014937') => 1.0, @mesh_tree.find('D006802') => 0.333
190
179
  }],
191
180
  'K' => [1.0, {
192
- MESH::Mesh.find('D019368') => 1.0, MESH::Mesh.find('D006809') => 0.333
181
+ @mesh_tree.find('D019368') => 1.0, @mesh_tree.find('D006809') => 0.333
193
182
  }],
194
183
  'L' => [1.0, {
195
- MESH::Mesh.find('D009275') => 1.0, MESH::Mesh.find('D009626') => 0.333, MESH::Mesh.find('D008037') => 0.111, MESH::Mesh.find('D007802') => 0.037, MESH::Mesh.find('D003142') => 0.025, MESH::Mesh.find('D007254') => 0.008
184
+ @mesh_tree.find('D009275') => 1.0, @mesh_tree.find('D009626') => 0.333, @mesh_tree.find('D008037') => 0.111, @mesh_tree.find('D007802') => 0.037, @mesh_tree.find('D003142') => 0.025, @mesh_tree.find('D007254') => 0.008
196
185
  }],
197
186
  'M' => [6.0, {
198
- MESH::Mesh.find('D010361') => 6.0, MESH::Mesh.find('D009272') => 2.0
187
+ @mesh_tree.find('D010361') => 6.0, @mesh_tree.find('D009272') => 2.0
199
188
  }],
200
189
  'N' => [1.0, {
201
- MESH::Mesh.find('D009938') => 1.0, MESH::Mesh.find('D004472') => 0.333, MESH::Mesh.find('D014919') => 1.0, MESH::Mesh.find('D000392') => 1.0, MESH::Mesh.find('D014887') => 1.0, MESH::Mesh.find('D001272') => 0.889, MESH::Mesh.find('D004777') => 0.543, MESH::Mesh.find('D004778') => 0.181, MESH::Mesh.find('D008685') => 0.630, MESH::Mesh.find('D000388') => 0.333, MESH::Mesh.find('D059205') => 0.333, MESH::Mesh.find('D004736') => 0.111
190
+ @mesh_tree.find('D009938') => 1.0, @mesh_tree.find('D004472') => 0.333, @mesh_tree.find('D014919') => 1.0, @mesh_tree.find('D000392') => 1.0, @mesh_tree.find('D014887') => 1.0, @mesh_tree.find('D001272') => 0.889, @mesh_tree.find('D004777') => 0.543, @mesh_tree.find('D004778') => 0.181, @mesh_tree.find('D008685') => 0.630, @mesh_tree.find('D000388') => 0.333, @mesh_tree.find('D059205') => 0.333, @mesh_tree.find('D004736') => 0.111
202
191
  }],
203
192
  'V' => [1.0, {
204
- MESH::Mesh.find('D017203') => 1.0, MESH::Mesh.find('D019215') => 0.333, MESH::Mesh.find('D052181') => 0.111, MESH::Mesh.find('D052180') => 0.148, MESH::Mesh.find('D016456') => 0.111
193
+ @mesh_tree.find('D017203') => 1.0, @mesh_tree.find('D019215') => 0.333, @mesh_tree.find('D052181') => 0.111, @mesh_tree.find('D052180') => 0.148, @mesh_tree.find('D016456') => 0.111
205
194
  }],
206
195
  'Z' => [1.0, {
207
- MESH::Mesh.find('D014481') => 1.0, MESH::Mesh.find('D009656') => 0.333, MESH::Mesh.find('D000569') => 0.111, MESH::Mesh.find('D005842') => 0.037
196
+ @mesh_tree.find('D014481') => 1.0, @mesh_tree.find('D009656') => 0.333, @mesh_tree.find('D000569') => 0.111, @mesh_tree.find('D005842') => 0.037
208
197
  }]
209
198
  }
210
199
 
211
- assert_classification expected, c.classify([{matches: @headings[:medium_content], weight: 1.0}])
200
+ assert_classification expected, @classifier.classify([{matches: @headings[:medium_content], weight: 1.0}])
212
201
  end
213
202
 
214
203
  def test_it_should_classify_other_content_as_well
215
- c = MESH::Classifier.new()
204
+
216
205
  expected = {
217
206
  'A' => [2.0, {
218
- MESH::Mesh.find('D001769') => 1.0, MESH::Mesh.find('D001826') => 0.333, MESH::Mesh.find('D005441') => 0.111, MESH::Mesh.find('D006424') => 0.333, MESH::Mesh.find('D006624') => 1.0, MESH::Mesh.find('D008032') => 0.333, MESH::Mesh.find('D001921') => 0.115, MESH::Mesh.find('D002490') => 0.038, MESH::Mesh.find('D009420') => 0.013, MESH::Mesh.find('D002540') => 0.333, MESH::Mesh.find('D054022') => 0.111, MESH::Mesh.find('D013687') => 0.037, MESH::Mesh.find('D016548') => 0.012, MESH::Mesh.find('D008099') => 2.0, MESH::Mesh.find('D004064') => 1.0, MESH::Mesh.find('D010179') => 1.0
207
+ @mesh_tree.find('D001769') => 1.0, @mesh_tree.find('D001826') => 0.333, @mesh_tree.find('D005441') => 0.111, @mesh_tree.find('D006424') => 0.333, @mesh_tree.find('D006624') => 1.0, @mesh_tree.find('D008032') => 0.333, @mesh_tree.find('D001921') => 0.115, @mesh_tree.find('D002490') => 0.038, @mesh_tree.find('D009420') => 0.013, @mesh_tree.find('D002540') => 0.333, @mesh_tree.find('D054022') => 0.111, @mesh_tree.find('D013687') => 0.037, @mesh_tree.find('D016548') => 0.012, @mesh_tree.find('D008099') => 2.0, @mesh_tree.find('D004064') => 1.0, @mesh_tree.find('D010179') => 1.0
219
208
  }],
220
209
  'D' => [4.136, {
221
- MESH::Mesh.find('D000269') => 1.0, MESH::Mesh.find('D020313') => 0.383, MESH::Mesh.find('D020164') => 0.171, MESH::Mesh.find('D000900') => 1.0, MESH::Mesh.find('D000890') => 0.333, MESH::Mesh.find('D045506') => 0.111, MESH::Mesh.find('D020228') => 0.131, MESH::Mesh.find('D001786') => 2.0, MESH::Mesh.find('D005947') => 1.667, MESH::Mesh.find('D006601') => 0.556, MESH::Mesh.find('D009005') => 0.185, MESH::Mesh.find('D002241') => 4.136, MESH::Mesh.find('D004247') => 2.0, MESH::Mesh.find('D009696') => 0.667, MESH::Mesh.find('D009706') => 0.222, MESH::Mesh.find('D006728') => 1.263, MESH::Mesh.find('D006730') => 0.842, MESH::Mesh.find('D045505') => 0.281, MESH::Mesh.find('D007328') => 4.0, MESH::Mesh.find('D011384') => 2.667, MESH::Mesh.find('D061385') => 1.778, MESH::Mesh.find('D010187') => 1.185, MESH::Mesh.find('D036361') => 0.790, MESH::Mesh.find('D010455') => 0.263, MESH::Mesh.find('D000602') => 0.187, MESH::Mesh.find('D011498') => 0.889, MESH::Mesh.find('D011506') => 0.296, MESH::Mesh.find('D013213') => 1.0, MESH::Mesh.find('D005936') => 0.667, MESH::Mesh.find('D001704') => 0.222, MESH::Mesh.find('D011108') => 0.222, MESH::Mesh.find('D046911') => 0.074, MESH::Mesh.find('D001697') => 0.148, MESH::Mesh.find('D011134') => 0.222
210
+ @mesh_tree.find('D000269') => 1.0, @mesh_tree.find('D020313') => 0.383, @mesh_tree.find('D020164') => 0.171, @mesh_tree.find('D000900') => 1.0, @mesh_tree.find('D000890') => 0.333, @mesh_tree.find('D045506') => 0.111, @mesh_tree.find('D020228') => 0.131, @mesh_tree.find('D001786') => 2.0, @mesh_tree.find('D005947') => 1.667, @mesh_tree.find('D006601') => 0.556, @mesh_tree.find('D009005') => 0.185, @mesh_tree.find('D002241') => 4.136, @mesh_tree.find('D004247') => 2.0, @mesh_tree.find('D009696') => 0.667, @mesh_tree.find('D009706') => 0.222, @mesh_tree.find('D006728') => 1.263, @mesh_tree.find('D006730') => 0.842, @mesh_tree.find('D045505') => 0.281, @mesh_tree.find('D007328') => 4.0, @mesh_tree.find('D011384') => 2.667, @mesh_tree.find('D061385') => 1.778, @mesh_tree.find('D010187') => 1.185, @mesh_tree.find('D036361') => 0.790, @mesh_tree.find('D010455') => 0.263, @mesh_tree.find('D000602') => 0.187, @mesh_tree.find('D011498') => 0.889, @mesh_tree.find('D011506') => 0.296, @mesh_tree.find('D013213') => 1.0, @mesh_tree.find('D005936') => 0.667, @mesh_tree.find('D001704') => 0.222, @mesh_tree.find('D011108') => 0.222, @mesh_tree.find('D046911') => 0.074, @mesh_tree.find('D001697') => 0.148, @mesh_tree.find('D011134') => 0.222
222
211
  }],
223
212
  'F' => [1.0, {
224
- MESH::Mesh.find('D005190') => 1.0, MESH::Mesh.find('D011593') => 0.333, MESH::Mesh.find('D001520') => 0.111, MESH::Mesh.find('D011584') => 0.111, MESH::Mesh.find('D001525') => 0.111, MESH::Mesh.find('D004191') => 0.037, MESH::Mesh.find('D012961') => 0.333, MESH::Mesh.find('D012942') => 0.222
213
+ @mesh_tree.find('D005190') => 1.0, @mesh_tree.find('D011593') => 0.333, @mesh_tree.find('D001520') => 0.111, @mesh_tree.find('D011584') => 0.111, @mesh_tree.find('D001525') => 0.111, @mesh_tree.find('D004191') => 0.037, @mesh_tree.find('D012961') => 0.333, @mesh_tree.find('D012942') => 0.222
225
214
  }],
226
215
  'G' => [1.0, {
227
- MESH::Mesh.find('D012621') => 1.0, MESH::Mesh.find('D010507') => 0.333, MESH::Mesh.find('D013995') => 0.111, MESH::Mesh.find('D055585') => 0.037, MESH::Mesh.find('D002909') => 0.111, MESH::Mesh.find('D010829') => 0.037, MESH::Mesh.find('D002980') => 0.667, MESH::Mesh.find('D004777') => 0.321, MESH::Mesh.find('D055669') => 0.132, MESH::Mesh.find('D001686') => 0.044, MESH::Mesh.find('D001272') => 0.222, MESH::Mesh.find('D008685') => 0.074
216
+ @mesh_tree.find('D012621') => 1.0, @mesh_tree.find('D010507') => 0.333, @mesh_tree.find('D013995') => 0.111, @mesh_tree.find('D055585') => 0.037, @mesh_tree.find('D002909') => 0.111, @mesh_tree.find('D010829') => 0.037, @mesh_tree.find('D002980') => 0.667, @mesh_tree.find('D004777') => 0.321, @mesh_tree.find('D055669') => 0.132, @mesh_tree.find('D001686') => 0.044, @mesh_tree.find('D001272') => 0.222, @mesh_tree.find('D008685') => 0.074
228
217
  }],
229
218
  'I' => [1.0, {
230
- MESH::Mesh.find('D005190') => 1.0, MESH::Mesh.find('D012961') => 0.333, MESH::Mesh.find('D012942') => 0.222
219
+ @mesh_tree.find('D005190') => 1.0, @mesh_tree.find('D012961') => 0.333, @mesh_tree.find('D012942') => 0.222
231
220
  }],
232
221
  'J' => [1.0, {
233
- MESH::Mesh.find('D000269') => 1.0, MESH::Mesh.find('D008420') => 0.444, MESH::Mesh.find('D013676') => 0.148, MESH::Mesh.find('D005389') => 1.0, MESH::Mesh.find('D054041') => 0.333, MESH::Mesh.find('D005502') => 1.0, MESH::Mesh.find('D019602') => 0.333
222
+ @mesh_tree.find('D000269') => 1.0, @mesh_tree.find('D008420') => 0.444, @mesh_tree.find('D013676') => 0.148, @mesh_tree.find('D005389') => 1.0, @mesh_tree.find('D054041') => 0.333, @mesh_tree.find('D005502') => 1.0, @mesh_tree.find('D019602') => 0.333
234
223
  }],
235
224
  'L' => [1.0, {
236
- MESH::Mesh.find('D005246') => 1.0, MESH::Mesh.find('D003491') => 0.333, MESH::Mesh.find('D003142') => 0.111, MESH::Mesh.find('D007254') => 0.037
225
+ @mesh_tree.find('D005246') => 1.0, @mesh_tree.find('D003491') => 0.333, @mesh_tree.find('D003142') => 0.111, @mesh_tree.find('D007254') => 0.037
237
226
  }],
238
227
  'N' => [1.0, {
239
- MESH::Mesh.find('D012621') => 1.0, MESH::Mesh.find('D002980') => 0.667, MESH::Mesh.find('D004777') => 0.321, MESH::Mesh.find('D004778') => 0.107, MESH::Mesh.find('D001272') => 0.222, MESH::Mesh.find('D008685') => 0.074
228
+ @mesh_tree.find('D012621') => 1.0, @mesh_tree.find('D002980') => 0.667, @mesh_tree.find('D004777') => 0.321, @mesh_tree.find('D004778') => 0.107, @mesh_tree.find('D001272') => 0.222, @mesh_tree.find('D008685') => 0.074
240
229
  }]
241
230
  }
242
- assert_classification expected, c.classify([{matches: @headings[:short_content], weight: 1.0}])
231
+ assert_classification expected, @classifier.classify([{matches: @headings[:short_content], weight: 1.0}])
243
232
  end
244
233
 
245
234
  def test_it_should_classify_title_abstract_and_content
246
- c = MESH::Classifier.new()
235
+
247
236
 
248
237
  doc = {
249
238
  title: 'Rotation',
@@ -253,187 +242,178 @@ module MESH
253
242
 
254
243
  expected = {
255
244
  'A' => [2.0, {
256
- MESH::Mesh.find('D001769') => 1.0, MESH::Mesh.find('D001826') => 0.333, MESH::Mesh.find('D005441') => 0.111, MESH::Mesh.find('D006424') => 0.333, MESH::Mesh.find('D006624') => 1.0, MESH::Mesh.find('D008032') => 0.333, MESH::Mesh.find('D001921') => 0.115, MESH::Mesh.find('D002490') => 0.038, MESH::Mesh.find('D009420') => 0.013, MESH::Mesh.find('D002540') => 0.333, MESH::Mesh.find('D054022') => 0.111, MESH::Mesh.find('D013687') => 0.037, MESH::Mesh.find('D016548') => 0.012, MESH::Mesh.find('D008099') => 2.0, MESH::Mesh.find('D004064') => 1.0, MESH::Mesh.find('D010179') => 1.0
245
+ @mesh_tree.find('D001769') => 1.0, @mesh_tree.find('D001826') => 0.333, @mesh_tree.find('D005441') => 0.111, @mesh_tree.find('D006424') => 0.333, @mesh_tree.find('D006624') => 1.0, @mesh_tree.find('D008032') => 0.333, @mesh_tree.find('D001921') => 0.115, @mesh_tree.find('D002490') => 0.038, @mesh_tree.find('D009420') => 0.013, @mesh_tree.find('D002540') => 0.333, @mesh_tree.find('D054022') => 0.111, @mesh_tree.find('D013687') => 0.037, @mesh_tree.find('D016548') => 0.012, @mesh_tree.find('D008099') => 2.0, @mesh_tree.find('D004064') => 1.0, @mesh_tree.find('D010179') => 1.0
257
246
  }],
258
247
  'D' => [4.136, {
259
- MESH::Mesh.find('D000269') => 1.0, MESH::Mesh.find('D020313') => 0.383, MESH::Mesh.find('D020164') => 0.171, MESH::Mesh.find('D000900') => 1.0, MESH::Mesh.find('D000890') => 0.333, MESH::Mesh.find('D045506') => 0.111, MESH::Mesh.find('D020228') => 0.131, MESH::Mesh.find('D001786') => 2.0, MESH::Mesh.find('D005947') => 1.667, MESH::Mesh.find('D006601') => 0.556, MESH::Mesh.find('D009005') => 0.185, MESH::Mesh.find('D002241') => 4.136, MESH::Mesh.find('D004247') => 2.0, MESH::Mesh.find('D009696') => 0.667, MESH::Mesh.find('D009706') => 0.222, MESH::Mesh.find('D006728') => 1.263, MESH::Mesh.find('D006730') => 0.842, MESH::Mesh.find('D045505') => 0.281, MESH::Mesh.find('D007328') => 4.0, MESH::Mesh.find('D011384') => 2.667, MESH::Mesh.find('D061385') => 1.778, MESH::Mesh.find('D010187') => 1.185, MESH::Mesh.find('D036361') => 0.790, MESH::Mesh.find('D010455') => 0.263, MESH::Mesh.find('D000602') => 0.187, MESH::Mesh.find('D011498') => 0.889, MESH::Mesh.find('D011506') => 0.296, MESH::Mesh.find('D013213') => 1.0, MESH::Mesh.find('D005936') => 0.667, MESH::Mesh.find('D001704') => 0.222, MESH::Mesh.find('D011108') => 0.222, MESH::Mesh.find('D046911') => 0.074, MESH::Mesh.find('D001697') => 0.148, MESH::Mesh.find('D011134') => 0.222
248
+ @mesh_tree.find('D000269') => 1.0, @mesh_tree.find('D020313') => 0.383, @mesh_tree.find('D020164') => 0.171, @mesh_tree.find('D000900') => 1.0, @mesh_tree.find('D000890') => 0.333, @mesh_tree.find('D045506') => 0.111, @mesh_tree.find('D020228') => 0.131, @mesh_tree.find('D001786') => 2.0, @mesh_tree.find('D005947') => 1.667, @mesh_tree.find('D006601') => 0.556, @mesh_tree.find('D009005') => 0.185, @mesh_tree.find('D002241') => 4.136, @mesh_tree.find('D004247') => 2.0, @mesh_tree.find('D009696') => 0.667, @mesh_tree.find('D009706') => 0.222, @mesh_tree.find('D006728') => 1.263, @mesh_tree.find('D006730') => 0.842, @mesh_tree.find('D045505') => 0.281, @mesh_tree.find('D007328') => 4.0, @mesh_tree.find('D011384') => 2.667, @mesh_tree.find('D061385') => 1.778, @mesh_tree.find('D010187') => 1.185, @mesh_tree.find('D036361') => 0.790, @mesh_tree.find('D010455') => 0.263, @mesh_tree.find('D000602') => 0.187, @mesh_tree.find('D011498') => 0.889, @mesh_tree.find('D011506') => 0.296, @mesh_tree.find('D013213') => 1.0, @mesh_tree.find('D005936') => 0.667, @mesh_tree.find('D001704') => 0.222, @mesh_tree.find('D011108') => 0.222, @mesh_tree.find('D046911') => 0.074, @mesh_tree.find('D001697') => 0.148, @mesh_tree.find('D011134') => 0.222
260
249
  }],
261
250
  'F' => [1.0, {
262
- MESH::Mesh.find('D005190') => 1.0, MESH::Mesh.find('D011593') => 0.333, MESH::Mesh.find('D001520') => 0.111, MESH::Mesh.find('D011584') => 0.111, MESH::Mesh.find('D001525') => 0.111, MESH::Mesh.find('D004191') => 0.037, MESH::Mesh.find('D012961') => 0.333, MESH::Mesh.find('D012942') => 0.222
251
+ @mesh_tree.find('D005190') => 1.0, @mesh_tree.find('D011593') => 0.333, @mesh_tree.find('D001520') => 0.111, @mesh_tree.find('D011584') => 0.111, @mesh_tree.find('D001525') => 0.111, @mesh_tree.find('D004191') => 0.037, @mesh_tree.find('D012961') => 0.333, @mesh_tree.find('D012942') => 0.222
263
252
  }],
264
253
  'G' => [1.0, {
265
- MESH::Mesh.find('D012621') => 1.0, MESH::Mesh.find('D010507') => 0.333, MESH::Mesh.find('D013995') => 0.111, MESH::Mesh.find('D055585') => 0.037, MESH::Mesh.find('D002909') => 0.111, MESH::Mesh.find('D010829') => 0.037, MESH::Mesh.find('D002980') => 0.667, MESH::Mesh.find('D004777') => 0.321, MESH::Mesh.find('D055669') => 0.132, MESH::Mesh.find('D001686') => 0.044, MESH::Mesh.find('D001272') => 0.222, MESH::Mesh.find('D008685') => 0.074
254
+ @mesh_tree.find('D012621') => 1.0, @mesh_tree.find('D010507') => 0.333, @mesh_tree.find('D013995') => 0.111, @mesh_tree.find('D055585') => 0.037, @mesh_tree.find('D002909') => 0.111, @mesh_tree.find('D010829') => 0.037, @mesh_tree.find('D002980') => 0.667, @mesh_tree.find('D004777') => 0.321, @mesh_tree.find('D055669') => 0.132, @mesh_tree.find('D001686') => 0.044, @mesh_tree.find('D001272') => 0.222, @mesh_tree.find('D008685') => 0.074
266
255
  }],
267
256
  'H' => [7.0, {
268
- MESH::Mesh.find('D002309') => 7.0, MESH::Mesh.find('D007388') => 2.333, MESH::Mesh.find('D008511') => 0.778, MESH::Mesh.find('D006281') => 0.259
257
+ @mesh_tree.find('D002309') => 7.0, @mesh_tree.find('D007388') => 2.333, @mesh_tree.find('D008511') => 0.778, @mesh_tree.find('D006281') => 0.259
269
258
  }],
270
259
  'I' => [3.0, {
271
- MESH::Mesh.find('D013337') => 3.0, MESH::Mesh.find('D013336') => 2.0, MESH::Mesh.find('D013334') => 1.333, MESH::Mesh.find('D004505') => 0.444, MESH::Mesh.find('D004493') => 0.593, MESH::Mesh.find('D005190') => 1.0, MESH::Mesh.find('D012961') => 0.333, MESH::Mesh.find('D012942') => 0.222
260
+ @mesh_tree.find('D013337') => 3.0, @mesh_tree.find('D013336') => 2.0, @mesh_tree.find('D013334') => 1.333, @mesh_tree.find('D004505') => 0.444, @mesh_tree.find('D004493') => 0.593, @mesh_tree.find('D005190') => 1.0, @mesh_tree.find('D012961') => 0.333, @mesh_tree.find('D012942') => 0.222
272
261
  }],
273
262
  'J' => [1.0, {
274
- MESH::Mesh.find('D000269') => 1.0, MESH::Mesh.find('D008420') => 0.444, MESH::Mesh.find('D013676') => 0.148, MESH::Mesh.find('D005389') => 1.0, MESH::Mesh.find('D054041') => 0.333, MESH::Mesh.find('D005502') => 1.0, MESH::Mesh.find('D019602') => 0.333
263
+ @mesh_tree.find('D000269') => 1.0, @mesh_tree.find('D008420') => 0.444, @mesh_tree.find('D013676') => 0.148, @mesh_tree.find('D005389') => 1.0, @mesh_tree.find('D054041') => 0.333, @mesh_tree.find('D005502') => 1.0, @mesh_tree.find('D019602') => 0.333
275
264
  }],
276
265
  'L' => [1.0, {
277
- MESH::Mesh.find('D005246') => 1.0, MESH::Mesh.find('D003491') => 0.333, MESH::Mesh.find('D003142') => 0.111, MESH::Mesh.find('D007254') => 0.037
266
+ @mesh_tree.find('D005246') => 1.0, @mesh_tree.find('D003491') => 0.333, @mesh_tree.find('D003142') => 0.111, @mesh_tree.find('D007254') => 0.037
278
267
  }],
279
268
  'M' => [3.0, {
280
- MESH::Mesh.find('D013337') => 3.0, MESH::Mesh.find('D013336') => 2.0, MESH::Mesh.find('D013334') => 1.333, MESH::Mesh.find('D009272') => 0.444
269
+ @mesh_tree.find('D013337') => 3.0, @mesh_tree.find('D013336') => 2.0, @mesh_tree.find('D013334') => 1.333, @mesh_tree.find('D009272') => 0.444
281
270
  }],
282
271
  'N' => [1.0, {
283
- MESH::Mesh.find('D012621') => 1.0, MESH::Mesh.find('D002980') => 0.667, MESH::Mesh.find('D004777') => 0.321, MESH::Mesh.find('D004778') => 0.107, MESH::Mesh.find('D001272') => 0.222, MESH::Mesh.find('D008685') => 0.074
272
+ @mesh_tree.find('D012621') => 1.0, @mesh_tree.find('D002980') => 0.667, @mesh_tree.find('D004777') => 0.321, @mesh_tree.find('D004778') => 0.107, @mesh_tree.find('D001272') => 0.222, @mesh_tree.find('D008685') => 0.074
284
273
  }]
285
274
  }
286
275
 
287
- assert_classification expected, c.classify([{matches: @headings[:cardiology_title], weight: 7.0}, {matches: @headings[:poor_abstract], weight: 3.0}, {matches: @headings[:short_content], weight: 1.0}])
276
+ assert_classification expected, @classifier.classify([{matches: @headings[:cardiology_title], weight: 7.0}, {matches: @headings[:poor_abstract], weight: 3.0}, {matches: @headings[:short_content], weight: 1.0}])
288
277
 
289
278
  end
290
279
 
291
280
  def setup
292
- #@texts = {
293
- # forearm_anatomy_title: 'Posterior forearm muscular anatomy',
294
- #
295
- # cardiology_title: 'Cardiology in a Heartbeat',
296
- #
297
- # medium_content: 'hi in this tutorial I\'m you talk about electrocardiography so we\'ll be looking at the first principles open electrocardiogram more commonly known as an the CD or an ekgs in the United States there\'s a fairly the information in this tutorial but I\'ll try make it as simple as possible the first people were gonna look at where you attached leave them a CG machine to a patient crucible there are four leaves which are attached to the limbs the patient these are abbreviated LA left arm are a a ride home L the left leg and are I\'ll right leg there are also six leaves which we attach to the chest the patient these called chest leads missed the point of confusion for many people went first learning the PCG their these 10 leads which we\'ve attached to the patient but this is not what we mean when we talk about EC jail aids and EC Jade lead is an mathematically determined recording which is made up from a combination of these physically that are attached to the patient so from here on in when I talk about and a CG laid I\'m going to be talking about these mathematically determined recordings you don\'t need to know how these lead the calculated just know they\'re not the same thing as the lead attached to the patient so in a 12 lead the CJ which is the standard PCG they are 12 they\'d leave and each lead shows the heart from a different view so if I drop a heart like this and we\'re looking at it from me anterior aspect we can thinking these leads as little lies the h3 the heart from a different angle so there are 60 these eyes look at the heart in a corona plane and they look at the heart in the directions are shown here each of these leaves has a name this is laid one this is lead to this is lead gray and the other thing called abe et al I V on and a bf this stands for augmented Victor left right and Fort the chest leads look at the heart in a transverse plane so again these work like little eyes that each look at the heart from a different angle these are labeled much more simply they called v1 v2 b3 be full be polite and basics and that\'s the front and the back the two author now let\'s have a think about the limb leads again if I drop a diagram a the lead directions without the hard we get an image that looks like this if we extend these lines that in the opposite direction to which they point we will see that we have every direction coveted in 30 degree increments now would be a good time to talk about what I mean by looking at the heart the EC G carb see the heart in the wind x-ray came it sees it electrically that is to say it sees whether there is electrical deep polarization all repolarization occurring in the direction of peach laid if you don\'t know what I mean by D polarized nation and repolarization I\'m talking about the flow of cardiac action potentials through the heart you can check out the action potential series at WWW dot hand written tutorials dot com for more information so let me explain this a little further I\'m you draw up a hot here and we\'re gonna look at recordings the taken from lead to lead 3 and aber and we\'re going to look at the polarized nation which is occurring in this direction so any deep polarization that occurs in the direction of the lead cause away from the graph which is positive in nature that is and up with deflection so because lead to is roughly the same direction as the deep polarization the wave on the graph will look like this because lead 3 is perpendicular to the direction the polarization there will be no change in the graph and finally because aber is in the direction opposite to the direction people organization there\'s an inverted way or damn would deflection and that\'s an interview the first principles been a CG in the next tutorial will be looking at the normal patton Albany CG during the cardiac cycle for more free tutorials and the PDF this tutorial visit WWW dot hand written tutorials dot com',
298
- #
299
- # short_content: 'diabetes drug families suck my big NO inhibited gray Taurus suck my big a new inhibiting Glee Taurus so finally arias tells the pancreas you need to release more insulin so fun mines are antibiotics medics mimic natural hormones like interest in Emelin that have similar functions to insulin big one-eyed decreases the liver from making more glucose the liver is a big organ analogues have gone make peptide-1 hookah gone a comedian the increases blood sugar by releasing starch sugar in be eventually lowers blood sugar the feedback stimulate insulin release a great drug would be like glue guns eventual function be but not do function hey that drug is a GOP won analog inhibitors about the glucoside ace glucoside a season enzyme that cuts big sugars into small sugars that food in your blood it\'s the small sugars that cause problems if you give it a glucoside et sans I\'m you have less to be small problem causing sugars good his own perfect DNA use see less insulin resistant magical glitter changes your DNA per superpowers help it go help hippocampus in',
300
- #
301
- # poor_abstract: 'This is a guide to performing a cardiovascular examination in the context of an OSCE exam. It was created by a group of medical students for the free revision website www.geekymedics.com where you can find a written guide to accompany the video. The way in which this examination is carried out varies greatly between individuals & institutions therefore this should be used as a rough framework which you can personalise to suit your own style.',
302
- #
303
- # good_abstract: 'The “Arterial Schematic” represents the intricate three-dimensional human arterial system in a highly simplified two-dimensional design reminiscent of the London Underground Map. Each “line” represents an artery within the body; a black circle marks a major vessel, whilst “stubs” stemming from the main lines represent the distal vasculature. The coloured “zones” represent the main divisions of the human body, for example; the yellow zone indicates the neck. The schematic was inspired by Henry Beck’s work on the first diagrammatic London Underground Map. His aim was to represent complex geographical distribution in a simple and accessible form. He achieved this aim by omitting swathes of information that had plagued previous designers’ versions. Beck’s approach was succinct yet produced a design that was immediately successful in clearly portraying to commuters how to traverse London most efficiently. The “Arterial Schematic” hopes to culminate this idea of communicating complex concepts in a concise manner, mirroring what is expected of medical professionals on a daily basis. The schematic is a prototype design intended to be part of a series of images that will diagrammatically represent the various systems of the human body. The prototype was inspired by a desire to teach anatomy via a fresh and engaging visual medium. Recent years have seen significant debate over reduced undergraduate anatomy teaching and its later consequences. The hope is that the “Arterial Schematic” and its sister diagrams will inspire students to learn anatomy and encourage them to further their knowledge via other sources. PLEASE NOTE: This image is available for purchase in print, please contact l.farmery1@gmail.com if interested. Please follow LFarmery on Twitter and considering sharing the Arterial Schematic on Facebook etc. Many Thanks.'
304
- #}
281
+
282
+ @@mesh_tree ||= MESH::Tree.new
283
+ @mesh_tree = @@mesh_tree
284
+ @classifier ||= MESH::Classifier.new()
305
285
 
306
286
  @headings = {
307
287
 
308
288
  forearm_anatomy_title:
309
289
  [
310
- {heading: MESH::Mesh.find('D000715'), matched: 'Anatomy', index: 26},
311
- {heading: MESH::Mesh.find('D005542'), matched: 'Forearm', index: 9}
290
+ {heading: @mesh_tree.find('D000715'), matched: 'Anatomy', index: 26},
291
+ {heading: @mesh_tree.find('D005542'), matched: 'Forearm', index: 9}
312
292
  ],
313
293
  cardiology_title:
314
294
  [
315
- {heading: MESH::Mesh.find('D002309'), matched: 'Cardiology', index: 0}
295
+ {heading: @mesh_tree.find('D002309'), matched: 'Cardiology', index: 0}
316
296
  ],
317
297
  medium_content:
318
298
  [
319
- {heading: MESH::Mesh.find('D000200'), matched: 'Action Potential', index: 2841},
320
- {heading: MESH::Mesh.find('D000200'), matched: 'Action Potentials', index: 2783},
321
- {heading: MESH::Mesh.find('D001132'), matched: 'Arm', index: 480},
322
- {heading: MESH::Mesh.find('D001415'), matched: 'Back', index: 2080},
323
- {heading: MESH::Mesh.find('D003221'), matched: 'Confusion', index: 652},
324
- {heading: MESH::Mesh.find('D004562'), matched: 'Electrocardiogram', index: 107},
325
- {heading: MESH::Mesh.find('D004562'), matched: 'Electrocardiography', index: 38},
326
- {heading: MESH::Mesh.find('D005121'), matched: 'Limb', index: 2133},
327
- {heading: MESH::Mesh.find('D005121'), matched: 'Limbs', index: 432},
328
- {heading: MESH::Mesh.find('D005123'), matched: 'Eyes', index: 1532},
329
- {heading: MESH::Mesh.find('D005123'), matched: 'Eyes', index: 1910},
330
- {heading: MESH::Mesh.find('D006225'), matched: 'Hand', index: 2876},
331
- {heading: MESH::Mesh.find('D006225'), matched: 'Hand', index: 3876},
332
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1320},
333
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1363},
334
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1481},
335
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1549},
336
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1594},
337
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1850},
338
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 1937},
339
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 2464},
340
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 2492},
341
- {heading: MESH::Mesh.find('D006321'), matched: 'Heart', index: 2813},
342
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 836},
343
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1129},
344
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1193},
345
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1233},
346
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1305},
347
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1690},
348
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 1706},
349
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 2176},
350
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 3045},
351
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 3053},
352
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 3215},
353
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 3316},
354
- {heading: MESH::Mesh.find('D007854'), matched: 'Lead', index: 3429},
355
- {heading: MESH::Mesh.find('D007858'), matched: 'Learning', index: 689},
356
- {heading: MESH::Mesh.find('D007866'), matched: 'Leg', index: 513},
357
- {heading: MESH::Mesh.find('D007866'), matched: 'Leg', index: 536},
358
- {heading: MESH::Mesh.find('D009275'), matched: 'Name', index: 1660},
359
- {heading: MESH::Mesh.find('D009938'), matched: 'Organization', index: 3602},
360
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 367},
361
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 442},
362
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 599},
363
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 755},
364
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 964},
365
- {heading: MESH::Mesh.find('D010361'), matched: 'Patient', index: 1214},
366
- {heading: MESH::Mesh.find('D013850'), matched: 'Thinking', index: 1434},
367
- {heading: MESH::Mesh.find('D013909'), matched: 'Chest', index: 589},
368
- {heading: MESH::Mesh.find('D013909'), matched: 'Chest', index: 620},
369
- {heading: MESH::Mesh.find('D013909'), matched: 'Chest', index: 1826},
370
- {heading: MESH::Mesh.find('D013995'), matched: 'Time', index: 2415},
371
- {heading: MESH::Mesh.find('D014481'), matched: 'United States', index: 176},
372
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 2325},
373
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 3401},
374
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 3493},
375
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 3740},
376
- {heading: MESH::Mesh.find('D014919'), matched: 'Wind', index: 2505},
377
- {heading: MESH::Mesh.find('D014937'), matched: 'Work', index: 1893},
378
- {heading: MESH::Mesh.find('D014965'), matched: 'X-Ray', index: 2510},
379
- {heading: MESH::Mesh.find('D017203'), matched: 'Interview', index: 3678},
380
- {heading: MESH::Mesh.find('D019368'), matched: 'Nature', index: 3267},
381
- {heading: MESH::Mesh.find('D027861'), matched: 'Peach', index: 2663}
299
+ {heading: @mesh_tree.find('D000200'), matched: 'Action Potential', index: 2841},
300
+ {heading: @mesh_tree.find('D000200'), matched: 'Action Potentials', index: 2783},
301
+ {heading: @mesh_tree.find('D001132'), matched: 'Arm', index: 480},
302
+ {heading: @mesh_tree.find('D001415'), matched: 'Back', index: 2080},
303
+ {heading: @mesh_tree.find('D003221'), matched: 'Confusion', index: 652},
304
+ {heading: @mesh_tree.find('D004562'), matched: 'Electrocardiogram', index: 107},
305
+ {heading: @mesh_tree.find('D004562'), matched: 'Electrocardiography', index: 38},
306
+ {heading: @mesh_tree.find('D005121'), matched: 'Limb', index: 2133},
307
+ {heading: @mesh_tree.find('D005121'), matched: 'Limbs', index: 432},
308
+ {heading: @mesh_tree.find('D005123'), matched: 'Eyes', index: 1532},
309
+ {heading: @mesh_tree.find('D005123'), matched: 'Eyes', index: 1910},
310
+ {heading: @mesh_tree.find('D006225'), matched: 'Hand', index: 2876},
311
+ {heading: @mesh_tree.find('D006225'), matched: 'Hand', index: 3876},
312
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1320},
313
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1363},
314
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1481},
315
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1549},
316
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1594},
317
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1850},
318
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 1937},
319
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 2464},
320
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 2492},
321
+ {heading: @mesh_tree.find('D006321'), matched: 'Heart', index: 2813},
322
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 836},
323
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1129},
324
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1193},
325
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1233},
326
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1305},
327
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1690},
328
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 1706},
329
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 2176},
330
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 3045},
331
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 3053},
332
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 3215},
333
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 3316},
334
+ {heading: @mesh_tree.find('D007854'), matched: 'Lead', index: 3429},
335
+ {heading: @mesh_tree.find('D007858'), matched: 'Learning', index: 689},
336
+ {heading: @mesh_tree.find('D007866'), matched: 'Leg', index: 513},
337
+ {heading: @mesh_tree.find('D007866'), matched: 'Leg', index: 536},
338
+ {heading: @mesh_tree.find('D009275'), matched: 'Name', index: 1660},
339
+ {heading: @mesh_tree.find('D009938'), matched: 'Organization', index: 3602},
340
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 367},
341
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 442},
342
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 599},
343
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 755},
344
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 964},
345
+ {heading: @mesh_tree.find('D010361'), matched: 'Patient', index: 1214},
346
+ {heading: @mesh_tree.find('D013850'), matched: 'Thinking', index: 1434},
347
+ {heading: @mesh_tree.find('D013909'), matched: 'Chest', index: 589},
348
+ {heading: @mesh_tree.find('D013909'), matched: 'Chest', index: 620},
349
+ {heading: @mesh_tree.find('D013909'), matched: 'Chest', index: 1826},
350
+ {heading: @mesh_tree.find('D013995'), matched: 'Time', index: 2415},
351
+ {heading: @mesh_tree.find('D014481'), matched: 'United States', index: 176},
352
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 2325},
353
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 3401},
354
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 3493},
355
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 3740},
356
+ {heading: @mesh_tree.find('D014919'), matched: 'Wind', index: 2505},
357
+ {heading: @mesh_tree.find('D014937'), matched: 'Work', index: 1893},
358
+ {heading: @mesh_tree.find('D014965'), matched: 'X-Ray', index: 2510},
359
+ {heading: @mesh_tree.find('D017203'), matched: 'Interview', index: 3678},
360
+ {heading: @mesh_tree.find('D019368'), matched: 'Nature', index: 3267},
361
+ {heading: @mesh_tree.find('D027861'), matched: 'Peach', index: 2663}
382
362
  ],
383
363
  short_content:
384
364
  [
385
- {heading: MESH::Mesh.find('D000269'), matched: 'Glue', index: 586},
386
- {heading: MESH::Mesh.find('D000900'), matched: 'Antibiotics', index: 186},
387
- {heading: MESH::Mesh.find('D001769'), matched: 'Blood', index: 789},
388
- {heading: MESH::Mesh.find('D001786'), matched: 'Blood Sugar', index: 446},
389
- {heading: MESH::Mesh.find('D001786'), matched: 'Blood Sugar', index: 508},
390
- {heading: MESH::Mesh.find('D002241'), matched: 'Sugars', index: 746},
391
- {heading: MESH::Mesh.find('D002241'), matched: 'Sugars', index: 764},
392
- {heading: MESH::Mesh.find('D002241'), matched: 'Sugars', index: 810},
393
- {heading: MESH::Mesh.find('D002241'), matched: 'Sugars', index: 918},
394
- {heading: MESH::Mesh.find('D004247'), matched: 'DNA', index: 946},
395
- {heading: MESH::Mesh.find('D004247'), matched: 'DNA', index: 1010},
396
- {heading: MESH::Mesh.find('D005190'), matched: 'Families', index: 13},
397
- {heading: MESH::Mesh.find('D005246'), matched: 'Feedback', index: 524},
398
- {heading: MESH::Mesh.find('D005389'), matched: 'Guns', index: 591},
399
- {heading: MESH::Mesh.find('D005502'), matched: 'Food', index: 776},
400
- {heading: MESH::Mesh.find('D005947'), matched: 'Glucose', index: 341},
401
- {heading: MESH::Mesh.find('D006624'), matched: 'Hippocampus', index: 1046},
402
- {heading: MESH::Mesh.find('D006728'), matched: 'Hormones', index: 219},
403
- {heading: MESH::Mesh.find('D007328'), matched: 'Insulin', index: 161},
404
- {heading: MESH::Mesh.find('D007328'), matched: 'Insulin', index: 283},
405
- {heading: MESH::Mesh.find('D007328'), matched: 'Insulin', index: 543},
406
- {heading: MESH::Mesh.find('D007328'), matched: 'Insulin', index: 963},
407
- {heading: MESH::Mesh.find('D008099'), matched: 'Liver', index: 318},
408
- {heading: MESH::Mesh.find('D008099'), matched: 'Liver', index: 353},
409
- {heading: MESH::Mesh.find('D010179'), matched: 'Pancreas', index: 127},
410
- {heading: MESH::Mesh.find('D012621'), matched: 'Season', index: 718},
411
- {heading: MESH::Mesh.find('D013213'), matched: 'Starch', index: 471}
365
+ {heading: @mesh_tree.find('D000269'), matched: 'Glue', index: 586},
366
+ {heading: @mesh_tree.find('D000900'), matched: 'Antibiotics', index: 186},
367
+ {heading: @mesh_tree.find('D001769'), matched: 'Blood', index: 789},
368
+ {heading: @mesh_tree.find('D001786'), matched: 'Blood Sugar', index: 446},
369
+ {heading: @mesh_tree.find('D001786'), matched: 'Blood Sugar', index: 508},
370
+ {heading: @mesh_tree.find('D002241'), matched: 'Sugars', index: 746},
371
+ {heading: @mesh_tree.find('D002241'), matched: 'Sugars', index: 764},
372
+ {heading: @mesh_tree.find('D002241'), matched: 'Sugars', index: 810},
373
+ {heading: @mesh_tree.find('D002241'), matched: 'Sugars', index: 918},
374
+ {heading: @mesh_tree.find('D004247'), matched: 'DNA', index: 946},
375
+ {heading: @mesh_tree.find('D004247'), matched: 'DNA', index: 1010},
376
+ {heading: @mesh_tree.find('D005190'), matched: 'Families', index: 13},
377
+ {heading: @mesh_tree.find('D005246'), matched: 'Feedback', index: 524},
378
+ {heading: @mesh_tree.find('D005389'), matched: 'Guns', index: 591},
379
+ {heading: @mesh_tree.find('D005502'), matched: 'Food', index: 776},
380
+ {heading: @mesh_tree.find('D005947'), matched: 'Glucose', index: 341},
381
+ {heading: @mesh_tree.find('D006624'), matched: 'Hippocampus', index: 1046},
382
+ {heading: @mesh_tree.find('D006728'), matched: 'Hormones', index: 219},
383
+ {heading: @mesh_tree.find('D007328'), matched: 'Insulin', index: 161},
384
+ {heading: @mesh_tree.find('D007328'), matched: 'Insulin', index: 283},
385
+ {heading: @mesh_tree.find('D007328'), matched: 'Insulin', index: 543},
386
+ {heading: @mesh_tree.find('D007328'), matched: 'Insulin', index: 963},
387
+ {heading: @mesh_tree.find('D008099'), matched: 'Liver', index: 318},
388
+ {heading: @mesh_tree.find('D008099'), matched: 'Liver', index: 353},
389
+ {heading: @mesh_tree.find('D010179'), matched: 'Pancreas', index: 127},
390
+ {heading: @mesh_tree.find('D012621'), matched: 'Season', index: 718},
391
+ {heading: @mesh_tree.find('D013213'), matched: 'Starch', index: 471}
412
392
  ],
413
393
  poor_abstract:
414
394
  [
415
- {heading: MESH::Mesh.find('D013337'), matched: 'Medical Students', index: 119}
395
+ {heading: @mesh_tree.find('D013337'), matched: 'Medical Students', index: 119}
416
396
  ],
417
397
  good_abstract:
418
398
  [
419
- {heading: MESH::Mesh.find('D000715'), matched: 'Anatomy', index: 1294},
420
- {heading: MESH::Mesh.find('D000715'), matched: 'Anatomy', index: 1411},
421
- {heading: MESH::Mesh.find('D000715'), matched: 'Anatomy', index: 1553},
422
- {heading: MESH::Mesh.find('D001158'), matched: 'Artery', index: 204},
423
- {heading: MESH::Mesh.find('D006801'), matched: 'Human', index: 67},
424
- {heading: MESH::Mesh.find('D008131'), matched: 'London', index: 154},
425
- {heading: MESH::Mesh.find('D008131'), matched: 'London', index: 535},
426
- {heading: MESH::Mesh.find('D008131'), matched: 'London', index: 888},
427
- {heading: MESH::Mesh.find('D009333'), matched: 'Neck', index: 455},
428
- {heading: MESH::Mesh.find('D013334'), matched: 'Students', index: 1535},
429
- {heading: MESH::Mesh.find('D013663'), matched: 'Teaching', index: 1419},
430
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 1175},
431
- {heading: MESH::Mesh.find('D014836'), matched: 'Will', index: 1522},
432
- {heading: MESH::Mesh.find('D014937'), matched: 'Work', index: 504},
433
- {heading: MESH::Mesh.find('D018594'), matched: 'Human Body', index: 400},
434
- {heading: MESH::Mesh.find('D018594'), matched: 'Human Body', index: 1234},
435
- {heading: MESH::Mesh.find('D019359'), matched: 'Knowledge', index: 1597},
436
- {heading: MESH::Mesh.find('D035781'), matched: 'Sister', index: 1506}
399
+ {heading: @mesh_tree.find('D000715'), matched: 'Anatomy', index: 1294},
400
+ {heading: @mesh_tree.find('D000715'), matched: 'Anatomy', index: 1411},
401
+ {heading: @mesh_tree.find('D000715'), matched: 'Anatomy', index: 1553},
402
+ {heading: @mesh_tree.find('D001158'), matched: 'Artery', index: 204},
403
+ {heading: @mesh_tree.find('D006801'), matched: 'Human', index: 67},
404
+ {heading: @mesh_tree.find('D008131'), matched: 'London', index: 154},
405
+ {heading: @mesh_tree.find('D008131'), matched: 'London', index: 535},
406
+ {heading: @mesh_tree.find('D008131'), matched: 'London', index: 888},
407
+ {heading: @mesh_tree.find('D009333'), matched: 'Neck', index: 455},
408
+ {heading: @mesh_tree.find('D013334'), matched: 'Students', index: 1535},
409
+ {heading: @mesh_tree.find('D013663'), matched: 'Teaching', index: 1419},
410
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 1175},
411
+ {heading: @mesh_tree.find('D014836'), matched: 'Will', index: 1522},
412
+ {heading: @mesh_tree.find('D014937'), matched: 'Work', index: 504},
413
+ {heading: @mesh_tree.find('D018594'), matched: 'Human Body', index: 400},
414
+ {heading: @mesh_tree.find('D018594'), matched: 'Human Body', index: 1234},
415
+ {heading: @mesh_tree.find('D019359'), matched: 'Knowledge', index: 1597},
416
+ {heading: @mesh_tree.find('D035781'), matched: 'Sister', index: 1506}
437
417
  ]
438
418
  }
439
419
  end