stanfordmlgroup / chexpert-labeler

CheXpert NLP tool to extract observations from radiology reports.
MIT License
350 stars 79 forks source link

ERROR:Cannot process sentence 0 in 0 #47

Open giantke opened 1 year ago

giantke commented 1 year ago

Thanks for open sourcing your labeler! I'm running into the following error with the sample reports:

/root/miniconda3/envs/chexpert-label/lib/python3.8/site-packages/StanfordDependencies/JPypeBackend.py:160: UserWarning: This jar doesn't support universal dependencies, falling back to Stanford Depen dencies. To suppress this message, call with universal=False warnings.warn("This jar doesn't support universal " ERROR:root:Cannot process sentence 0 in 0 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 39 in 0 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 62 in 0 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process 0 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/negdetect.py", line 75, in detect total_loc = ann.get_total_location() AttributeError: 'BioCAnnotation' object has no attribute 'get_total_location' ERROR:root:Cannot process sentence 0 in 1 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 52 in 1 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 84 in 1 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process 1 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/negdetect.py", line 75, in detect total_loc = ann.get_total_location() AttributeError: 'BioCAnnotation' object has no attribute 'get_total_location' ERROR:root:Cannot process sentence 0 in 2 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process 2 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/negdetect.py", line 75, in detect total_loc = ann.get_total_location() AttributeError: 'BioCAnnotation' object has no attribute 'get_total_location' ERROR:root:Cannot process sentence 0 in 3 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 29 in 3 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 118, in convert_doc anns, rels = convert_dg(dependency_graph, sentence.text, File "/root/Y_chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process 3 Traceback (most recent call last): File "/root/Y_chexpert-labeler-master/negbio/pipeline/negdetect.py", line 75, in detect total_loc = ann.get_total_location() AttributeError: 'BioCAnnotation' object has no attribute 'get_total_location'

One of the problems here is that 'TypeError: must be str'. However, when I print the type of sample_report, it is indeed str type.

['Heart size normal and lungs are clear. No edema or pneumonia. No effusion', '1. Left pleural effusion with adjacent atelectasis. Right effusion is also present.\n\n2. Cardiomegaly without overt ede ma.', 'Minimal patchy airspace disease within the lingula, may reflect atelectasis or consolidation.', '1. Stable mild cardiomegaly. 2. Hyperexpanded but clear lungs.'] 0 <class 'str'> 1 <class 'str'> 2 <class 'str'> 3 <class 'str'>

How can I fix it? Is it an issue of incompatibility with the Conda environment?

giantke commented 1 year ago

I found the above errors occur when processing the code classifier.classify(loader.collection) in label.py

After the above errors, incorrect classification results can still be obtained in the final CSV file. I'm so confused, anybody help me

zoule41 commented 1 year ago

I have the same questions,when I run 'python label.py reports_path 'sample_reports.csv': /home/zoule/anaconda3/envs/chexpert-label/lib/python3.6/site-packages/StanfordDependencies/JPypeBackend.py:160: UserWarning: This jar doesn't support universal dependencies, falling back to Stanford Dependencies. To suppress this message, call with universal=False warnings.warn("This jar doesn't support universal " ERROR:root:Cannot process sentence 0 in 0 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 39 in 0 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 62 in 0 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 0 in 1 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 52 in 1 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 84 in 1 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 0 in 2 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 0 in 3 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String ERROR:root:Cannot process sentence 29 in 3 Traceback (most recent call last): File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/media/zoule/Elements/chexpert-labeler/chexpert-labeler-master/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String

Have you fixed the problem? If yes, can you tell me how to fix it? Thank you~

gysabc commented 1 year ago

Have you fixed the problem?

santosh9sanjeev commented 1 year ago

Did anyone fix this problem?