spaCy version 3 cannot add 'negative' example, how can I resolve?

115 Views Asked by At

In spaCy 3, we now train our model with the configuration system, and we need to use DocBin.to_disk("any_name.spacy") to export the training data.

The problem is, we need to first create Span objects to store the entites in the text, and then assign them to doc.ents. During this process, if there are no entities marked in the text, doc.char_span(0,0,"LABEL") (0,0, because there is no entity) will return None, and this cannot be appended into the DocBin.

In simple terms, I cannot add any negative examples into my training data. Have anyone figure out a way to add negative example into their data?

I tried doc.char_span(0,0,"NO_ENTITY") as a place holder and see if it returns a span as "", not it doesn't work.

0

There are 0 best solutions below