ncbi-nlp / NegBio

:newspaper: High-performance tool for negation and uncertainty detection in radiology reports
Other
158 stars 42 forks source link

strange error occur, when I run python negbio/main_chexpert.py text --output=examples/test.neg.xml examples/00019248.txt examples/00000086.txt #48

Open bliu62 opened 2 years ago

bliu62 commented 2 years ago

{'--bllip-model': '~/.local/share/bllipparser/GENIA+PubMed', '--mention_phrases_dir': 'negbio/chexpert/phrases/mention', '--neg-patterns': 'negbio/chexpert/patterns/negation.txt', '--newline_is_sentence_break': False, '--output': 'examples/test.neg.xml', '--post-negation-uncertainty-patterns': 'negbio/chexpert/patterns/post_negation_uncertainty.txt', '--pre-negation-uncertainty-patterns': 'negbio/chexpert/patterns/pre_negation_uncertainty.txt', '--split-document': False, '--unmention_phrases_dir': 'negbio/chexpert/phrases/unmention', '--verbose': False, 'SOURCE': None, 'SOURCES': ['examples/00019248.txt', 'examples/00000086.txt'], 'bioc': False, 'text': True} /home/bo/.local/lib/python3.6/site-packages /home/bo/.local/lib/python3.6/site-packages /home/bo/.local/lib/python3.6/site-packages /home/bo/.local/lib/python3.6/site-packages /home/bo/.local/lib/python3.6/site-packages /home/bo/conda/envs/negbio/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 00019248 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 72 in 00019248 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 123 in 00019248 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 142 in 00019248 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 201 in 00019248 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 73 in 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 94 in 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 122 in 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 139 in 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/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 204 in 00000086 Traceback (most recent call last): File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 120, in convert_doc has_lemmas=self._backend == 'jpype') File "/home/bo/.local/lib/python3.6/site-packages/negbio/pipeline/ptb2ud.py", line 171, in convert_dg index = text.find(node_form, start) TypeError: must be str, not java.lang.String

karanbajaj commented 2 years ago

I ran in to the same thing - I am not a python programmer - But here is my explanation. I think it's the python version issue. After googling and stack overflow it seems that the java objects have to be casted with str(). I have made a few changes on my fork to make it work.