cltl / multilingual_factuality

3 stars 2 forks source link

TypeError: 'NoneType' object is not iterable #3

Closed vanatteveldt closed 8 years ago

vanatteveldt commented 8 years ago

I get this error when running the factuality

Traceback (most recent call last):
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 413, in <module>
    main()
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 406, in main
    run_factuality_module(nafobj)
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 392, in run_factuality_module
    events_features = extract_features(feature_extractor, target_events)
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 367, in extract_features
    add_predicate_chain_features(feature_extractor, event, myFeatures)
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 212, in add_predicate_chain_features
    eventObj.predicate_chain_lemmas = feature_extractor.get_lemmas_for_list_term_ids(pred_chain)
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/my_feature_extractor.py", line 182, in get_lemmas_for_list_term_ids
    for term_id in list_term_ids:
TypeError: 'NoneType' object is not iterable
WARNING:elasticsearch:HEAD /nlpipe/annotate__0_0 [status:404 request:0.001s]

As far as I can see, get_list_term_ids_to_root returns None in some cases, which is not expected by the get_lemmas_for_list_term_ids. Adding or None to the return value of the former function prevents the error, but I have no clue what I'm doing so that's probably not a solution.

Let me know if you need the raw input that causes the problem.

rubenIzquierdo commented 8 years ago

I included a couple of checks to make sure we do not get this error. Anyway the source of the problem is that the function get_list_term_ids_to_root(…) returns None instead of a valid list of term identifiers. I would need to have the file generating the problem to reproduce the error and debug it.

Ruben Izquierdo Bevia Vrije University of Amsterdam ruben.izquierdobevia@vu.nlmailto:ruben.izquierdobevia@vu.nl http://rubenizquierdobevia.com/

On 18 May 2016, at 02:04, Wouter van Atteveldt notifications@github.com<mailto:notifications@github.com> wrote:

I get this error when running the factuality

Traceback (most recent call last): File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 413, in main() File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 406, in main run_factuality_module(nafobj) File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 392, in run_factuality_module events_features = extract_features(feature_extractor, target_events) File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 367, in extract_features add_predicate_chain_features(feature_extractor, event, myFeatures) File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 212, in add_predicate_chain_features eventObj.predicate_chain_lemmas = feature_extractor.get_lemmas_for_list_term_ids(pred_chain) File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/my_feature_extractor.py", line 182, in get_lemmas_for_list_term_ids for term_id in list_term_ids: TypeError: 'NoneType' object is not iterable WARNING:elasticsearch:HEAD /nlpipe/annotate__0_0 [status:404 request:0.001s]

As far as I can see, get_list_term_ids_to_root returns None in some cases, which is not expected by the get_lemmas_for_list_term_ids. Adding or None to the return value of the former function prevents the error, but I have no clue what I'm doing so that's probably not a solution.

Let me know if you need the raw input that causes the problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/cltl/multilingual_factuality/issues/3

vanatteveldt commented 8 years ago

You can find an example input file here: http://i.amcat.nl/factinput.naf

The error seems to occur quite often, so if you need more example files give me a shout.

One-liner to recreate the problem:

$ curl -s http://i.amcat.nl/factinput.naf | python modules/multilingual_factuality/feature_extractor/rule_based_factuality.py 
Traceback (most recent call last):
  File "modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 413, in <module>
    main()
  File "modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 406, in main
    run_factuality_module(nafobj)
  File "modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 392, in run_factuality_module
    events_features = extract_features(feature_extractor, target_events)
  File "modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 367, in extract_features
    add_predicate_chain_features(feature_extractor, event, myFeatures)
  File "modules/multilingual_factuality/feature_extractor/rule_based_factuality.py", line 212, in add_predicate_chain_features
    eventObj.predicate_chain_lemmas = feature_extractor.get_lemmas_for_list_term_ids(pred_chain)
  File "/data/wva/newsreader_pipe_nl/modules/multilingual_factuality/feature_extractor/my_feature_extractor.py", line 182, in get_lemmas_for_list_term_ids
    for term_id in list_term_ids:
TypeError: 'NoneType' object is not iterable