Fehlermeldung in "Remove resumes that cause errors in spacy"

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Fehlermeldung in “Remove resumes that cause errors in spacy”
Hallo,

Hat jemand den gleichen Fehler oder Ahnung, was den ausgelöst haben könnte?

Es geht um den Teil mit der Überschrift “Remove resumes that cause errors in spacy”.

Der Code ist ja vorgegeben, aber er gibt komische Fehlermeldungen auf die ich mir keinen Reim machen kann…

Thanks already!


Created blank 'en' model
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-14-24a4092a5216> in <module>()
     14 ## call remove method. It may take a few minutes for the method to complete.
     15 ## you will know it is complete when the print output above.
---> 16 X = remove_bad_data(X)

<ipython-input-14-24a4092a5216> in remove_bad_data(training_data)
      2 
      3 def remove_bad_data(training_data):
----> 4     model, baddocs = train_spacy_ner(training_data, debug=True, n_iter=1)
      5     ## training data is list of lists with each list containing a text and annotations
      6     ## baddocs is a set of strings/resume texts.

~\Documents\a_UNI_2019\SAKI\msg\Resume_NER-master\spacy_train_resume_ner.py in train_spacy_ner(training_data, model, n_iter, debug)
     37 
     38     # add labels
---> 39     for _, annotations in training_data:
     40         for ent in annotations.get("entities"):
     41             ner.add_label(ent[2])

ValueError: too many values to unpack (expected 2)

Ich meine mich zu erinnern, dass ich so eine Fehlermeldung auch hatte. Ich hab das beseitigt, indem ich meinen print Output weggelassen habe.


Wie hast du denn X erstellt?
Mögliche Lösung:
X = [[dat[0], dict(entities=filter_ents(dat[1][‘entities’], chosen_entity_labels))] for dat in training_data]


Hab ich genauso :slight_smile: