Hello , Folks!
My name is Leonardo and I'm new here in this forum.
Thanks for this oportunity!
I'm trying capture the pair concept|concept using this code below.
My pc works until the file reaches 7mb.
Have you been through this kind of problem?
Thank you in advance for your help.
Att
Leonardo
CODE
-----------------------------------------------------------------------------------------
from owlready2 import *
import p07_allconcepts as f
default_world.set_backend(filename="pymedtermino.sqlite3")
PYM = get_ontology("
http://PYM/").load()
SNOMEDCT_US = PYM["SNOMEDCT_US"]
CUI = PYM["CUI"]
for d in SNOMEDCT_US.descendant_concepts():
for e in d.children:
f.conceito(d,e)
print('************************')
print('end')
print('************************')
-----------------------------------------------------------------------------------------
from owlready2 import *
def conceito(d,e):
l = (str(d.unifieds) + '|' + str(e.unifieds))
a = str(d.unifieds)
b = str(e.unifieds)
a = a.split('#')
b = b.split('#')
a = a[0].replace("[CUI[", "")
a = a.replace("]", "")
a = a.replace('"', "")
a = a.replace(' ', "")
b = b[0].replace("[CUI[", "")
b = b.replace("]", "")
b = b.replace('"', "")
b = b.replace(' ', "")
# print(d)
# print(e)
linha = str(a) + '|' + str(b) + '\n'
# print(linha)
text_file = open("Output.txt", "a")
text_file.write(linha)
text_file.close()