CyberMD / pyContextNLP

Automatically exported from code.google.com/p/negex
0 stars 0 forks source link

Error in negex.py when negPossible flag is set to True #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. edit wrapper.py testing script on line 16 to set negP=True
2. run wrapper.py

What is the expected output? What do you see instead?
Expected output is negex_output.txt file with entries annotate as "possible" 
"affirmed" or "negated"
Instead, receive error message below:
Traceback (most recent call last):
  File "wrapper.py", line 30, in <module>
    if __name__ == '__main__': main()
  File "wrapper.py", line 16, in main
    tagger = negTagger(sentence = report[2], phrases = [report[1]], rules = irules) #, negP=False)
  File "/Users/grundmeier/svn/negex-read-only/negex.python/negex.py", line 155, in __init__
    sb3 = sb3 + ' ' + sentenceTokens[i]
TypeError: can only concatenate list (not "str") to list

What version of the product are you using? On what operating system?
using revision 170 on Mac OSX 1.6.8 with python 2.6.1

Please provide any additional information below.
Here is the edit I made locally to correct the problem.  I hope it helps!
===================================================================
--- negex.python/negex.py   (revision 170)
+++ negex.python/negex.py   (working copy)
@@ -152,7 +152,7 @@
                     sentenceTokens[i] = sentenceTokens[i].replace('[PHRASE]', '[POSSIBLE]')
                     sentencePortion = sentencePortion + ' ' + sentenceTokens[i]

-                sb3 = sb3 + ' ' + sentenceTokens[i]
+                sb3.append(sentenceTokens[i])

             if sentencePortion.strip():
                 aScopes.append(sentencePortion.strip())

Original issue reported on code.google.com by r...@alum.mit.edu on 19 Aug 2013 at 1:06