rock3125 / enhanced-subject-verb-object-extraction

Enhanced Subject Word Object Extraction
Apache License 2.0
148 stars 50 forks source link

Getting error "TypeError: cannot unpack non-iterable NoneType object" #9

Closed fatihbozdag closed 4 years ago

fatihbozdag commented 4 years ago

Greetings,

When I try to execute the code on python shell, I got the error

"Traceback (most recent call last): File "", line 1, in File "", line 10, in findSVOs TypeError: cannot unpack non-iterable NoneType object"

Can you help me about it?

Regards.

rock3125 commented 4 years ago

strange... please try installing it like so - I've just checked it with the spacy 2.2.5 models;

I ran it like so:

git clone https://github.com/peter3125/enhanced-subject-verb-object-extraction.git cd enhanced-subject-verb-object-extraction sudo pip3 install spacy sudo python3 -m spacy download en_core_web_sm python3 demo.py

fatihbozdag commented 4 years ago

now I got the error;

You can now load the model via spacy.load('en_core_web_sm') fatihunalbozdag@Fatihs-iMac ~ % python3 /Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master/demo.py Traceback (most recent call last): File "/Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master/demo.py", line 1, in from subject_verb_object_extract import findSVOs, nlp ImportError: cannot import name 'nlp' from 'subject_verb_object_extract' (/Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master/subject_verb_object_extract.py) fatihunalbozdag@Fatihs-iMac ~ % python3 /Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3: can't find 'main' module in '/Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master' fatihunalbozdag@Fatihs-iMac ~ %

fatihbozdag commented 4 years ago

Strange thou, I cannot trace the error no matter what.

rock3125 commented 4 years ago

strange indeed - make sure you run it inside its directory - don't add all the paths - because Python can't just look for files without writing explicit code to do so.

So in your case; make sure you change into the directory before running it

cd /Users/fatihunalbozdag/Desktop/enhanced-subject-verb-object-extraction-master/

and then

python3 demo.py

fatihbozdag commented 4 years ago

now it's working. Rather than OS X terminal I used IDLE Python Shell, seems like working.

Meanwhile is it possible to extend the scope of query? For instance, I'm working on dative alternation, thus I need to extract object after dative, like "He gave me an apple vs He gave an apple to me". I guess script only extracts triples? SVO? How about S,V, dative(prep) + Object? or S V Dobj + Obj.

rock3125 commented 4 years ago

No idea - I haven't worked on this project for two years. Give it a try if you like. I'll merge it in.