Download this file

180 lines (130 with data), 9.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
from EHRKit import EHRKit
if __name__ == '__main__':
print("Welcome to LILY-EHRKit. Here's a complete run-through of all EHRKit text processing functions.")
# initialize EHRKit object
kit = EHRKit()
print("========== Start of SciSpacy Functions ==========")
print('\n\n')
print('Abbreviations')
record = "Spinal and bulbar muscular atrophy (SBMA) is an " \
"inherited motor neuron disease caused by the expansion" \
"of a polyglutamine tract within the androgen receptor (AR)." \
"SBMA can be caused by this easily."
kit.update_and_delete_main_record(record)
print(kit.get_abbreviations())
print('\n\n')
print('Hyponyms')
record = "Keystone plant species such as fig trees are good for the soil."
kit.update_and_delete_main_record(record)
print(kit.get_hyponyms())
print('\n\n')
print('Linked entities')
record = "Spinal and bulbar muscular atrophy (SBMA) is an " \
"inherited motor neuron disease caused by the expansion" \
"of a polyglutamine tract within the androgen receptor (AR)." \
"SBMA can be caused by this easily."
kit.update_and_delete_main_record(record)
print(kit.get_linked_entities())
print('\n\n')
print('Named entities')
record = """
Myeloid derived suppressor cells (MDSC) are immature
myeloid cells with immunosuppressive activity.
They accumulate in tumor-bearing mice and humans
with different types of cancer, including hepatocellular
carcinoma (HCC).
"""
kit.update_and_delete_main_record(record)
print(kit.get_named_entities())
print("========== End of SciSpacy Functions ==========")
print('\n\n')
# translation
print("========== Start of Translation ==========")
# reference: https://qbi.uq.edu.au/brain/brain-anatomy/what-neuron
record = "Neurons (also called neurones or nerve cells) are the fundamental units of the brain and nervous system, " \
"the cells responsible for receiving sensory input from the external world, for sending motor commands to " \
"our muscles, and for transforming and relaying the electrical signals at every step in between. More than " \
"that, their interactions define who we are as people. Having said that, our roughly 100 billion neurons do" \
" interact closely with other cell types, broadly classified as glia (these may actually outnumber neurons, " \
"although it’s not really known)."
kit.update_and_delete_main_record(record)
print(kit.get_translation('French'))
print("========== End of Translation ==========")
# segmentation
print("========== Start of Sentencizer ==========")
record = "Neurons (also called neurones or nerve cells) are the fundamental units of the brain and nervous system, " \
"the cells responsible for receiving sensory input from the external world, for sending motor commands to " \
"our muscles, and for transforming and relaying the electrical signals at every step in between. More than " \
"that, their interactions define who we are as people. Having said that, our roughly 100 billion neurons do" \
" interact closely with other cell types, broadly classified as glia (these may actually outnumber neurons, " \
"although it’s not really known)."
kit.update_and_delete_main_record(record)
print('Using stanza')
print(kit.get_sentences('stanza'))
print('Using PyRush')
print(kit.get_sentences('pyrush'))
print('Using SciSpacy')
print(kit.get_sentences('scispacy'))
print("========== End of Sentencizer ==========")
# clustering
print("========== Start of Clustering ==========")
record = "Neurons (also called neurones or nerve cells) are the fundamental units of the brain and nervous system, " \
"the cells responsible for receiving sensory input from the external world, for sending motor commands to " \
"our muscles, and for transforming and relaying the electrical signals at every step in between. More than " \
"that, their interactions define who we are as people. Having said that, our roughly 100 billion neurons do" \
" interact closely with other cell types, broadly classified as glia (these may actually outnumber neurons, " \
"although it’s not really known)."
# reference: https://www.investopedia.com/terms/n/neuralnetwork.asp
cand1 = "A neural network is a series of algorithms that endeavors to recognize underlying relationships in a set of " \
"data through a process that mimics the way the human brain operates. In this sense, neural networks refer to " \
"systems of neurons, either organic or artificial in nature."
# reference: https://medlineplus.gov/druginfo/meds/a682878.html
cand2 = "Prescription aspirin is used to relieve the symptoms of rheumatoid arthritis (arthritis caused by swelling " \
"of the lining of the joints), osteoarthritis (arthritis caused by breakdown of the lining of the joints), " \
"systemic lupus erythematosus (condition in which the immune system attacks the joints and organs and causes " \
"pain and swelling) and certain other rheumatologic conditions (conditions in which the immune system " \
"attacks parts of the body)."
# reference: https://www.medicalnewstoday.com/articles/161255
cand3 = "People can buy aspirin over the counter without a prescription. Everyday uses include relieving headache, " \
"reducing swelling, and reducing a fever. Taken daily, aspirin can lower the risk of cardiovascular events, " \
"such as a heart attack or stroke, in people with a high risk. Doctors may administer aspirin immediately" \
" after a heart attack to prevent further clots and heart tissue death."
kit.update_and_delete_main_record(record)
kit.replace_supporting_records([cand1, cand2, cand3])
print(kit.get_clusters())
print("========== End of Clustering ==========")
# similar documents
print("========== Start of Similar Documents ==========")
record = "Neurons (also called neurones or nerve cells) are the fundamental units of the brain and nervous system, " \
"the cells responsible for receiving sensory input from the external world, for sending motor commands to " \
"our muscles, and for transforming and relaying the electrical signals at every step in between. More than " \
"that, their interactions define who we are as people. Having said that, our roughly 100 billion neurons do" \
" interact closely with other cell types, broadly classified as glia (these may actually outnumber neurons, " \
"although it’s not really known)."
# reference: https://www.investopedia.com/terms/n/neuralnetwork.asp
cand1 = "A neural network is a series of algorithms that endeavors to recognize underlying relationships in a set of " \
"data through a process that mimics the way the human brain operates. In this sense, neural networks refer to " \
"systems of neurons, either organic or artificial in nature."
# reference: https://medlineplus.gov/druginfo/meds/a682878.html
cand2 = "Prescription aspirin is used to relieve the symptoms of rheumatoid arthritis (arthritis caused by swelling " \
"of the lining of the joints), osteoarthritis (arthritis caused by breakdown of the lining of the joints), " \
"systemic lupus erythematosus (condition in which the immune system attacks the joints and organs and causes " \
"pain and swelling) and certain other rheumatologic conditions (conditions in which the immune system " \
"attacks parts of the body)."
# reference: https://www.medicalnewstoday.com/articles/161255
cand3 = "People can buy aspirin over the counter without a prescription. Everyday uses include relieving headache, " \
"reducing swelling, and reducing a fever. Taken daily, aspirin can lower the risk of cardiovascular events, " \
"such as a heart attack or stroke, in people with a high risk. Doctors may administer aspirin immediately" \
" after a heart attack to prevent further clots and heart tissue death."
kit.update_and_delete_main_record(record)
kit.replace_supporting_records([cand1, cand2, cand3])
print(kit.get_similar_documents(3))
print("========== End of Similar Documents ==========")
""" UNDER CONSTRUCTION """
""" stanza functions """
# print dependencies
record = "A neural network is a series of algorithms that endeavors to recognize underlying relationships in a set of " \
"data through a process that mimics the way the human brain operates. In this sense, neural networks refer to " \
"systems of neurons, either organic or artificial in nature."
kit.update_and_delete_main_record(record)
kit.get_dependency()