0

I am building code using owlread the code has to go throw the text and converts the medical finding to SNOMED ct

import nltk
import pandas as pd
import numpy as np
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from nltk.tokenize import RegexpTokenizer
from nltk.stem import WordNetLemmatizer
import spacy
from nltk.corpus import stopwords
from nltk.classify import SklearnClassifier
from wordcloud import WordCloud, STOPWORDS 
from nltk.stem import WordNetLemmatizer
import string
#pip install spacy

from spacy.lemmatizer import Lemmatizer
from spacy.lookups import Lookups

nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')
import en_core_web_sm

#owlready2 and pymed
from owlready2 import *
from owlready2.pymedtermino2 import *
from owlready2.pymedtermino2.umls import *

onto = get_ontology("http://test.org/onto.owl")
#load SNOMED CT in Python
#default_world.set_backend(filename = "pym.sqlite3")
import_umls("umls-2020AB-full.zip", terminologies = ["ICD10", "SNOMEDCT_US", "CUI"])
default_world.save()
PYM = get_ontology("http://PYM/").load()

SNOMEDCT_US = PYM["SNOMEDCT_US"]

However I got error about SNOMEDCT_US = PYM["SNOMEDCT_US"] the error said TypeError: 'NoneType' object is not subscriptable

I think there is file missing that can identify the PYM["SNOMEDCT_US"] but still I cannot find it?

Thank you

  • Clearly `get_ontology("http://PYM/").load()` ends up returning `None`. What did you expect it to return? Is the URL really correct? – tripleee Nov 06 '20 at 12:40
  • I am not sure about that, but I have not got error about get_ontology("http://PYM/").load() – Fatimah Altuhaifa Nov 06 '20 at 13:42
  • If you don't know what your code does, how do you expect to understand an answer? Anyway, read https://stackoverflow.com/questions/18866657/nonetype-object-is-not-subscriptable and https://stackoverflow.com/questions/8949252/why-do-i-get-attributeerror-nonetype-object-has-no-attribute-something both. – tripleee Nov 06 '20 at 13:50
  • I find the solution for the problem, the problem was I used this "umls-2020AB-full.zip" while I have to use this file ("umls-2019AA-metathesaurus.zip"), and for @tripleee other time is better to answer about something you know rather than being rude, I do know what is my code – Fatimah Altuhaifa Nov 16 '20 at 12:02

0 Answers0