Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR:Cannot process sentence 0 in 0 #47

Open
giantke opened this issue May 18, 2023 · 5 comments
Open

ERROR:Cannot process sentence 0 in 0 #47

giantke opened this issue May 18, 2023 · 5 comments

Comments

@giantke
Copy link

giantke commented May 18, 2023

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
Copy link
Author

giantke commented May 20, 2023

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
Copy link

zoule41 commented Jun 16, 2023

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
Copy link

gysabc commented Jul 29, 2023

Have you fixed the problem?

@santosh9sanjeev
Copy link

Did anyone fix this problem?

@confesion
Copy link

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

yeah,while it's not equal to initial csv file of authors', have you solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants