Override NER with EntityRuler - Only if labels are different

Hi all, how can I add logic to the pipeline that would allow me to override the NER result with the pattern match (EntityRuler) result, but only if the labels (entity types) are different? I am seeing a few cases where I would want to override with the EntityRuler, but not in all cases (a few cases the pattern match span is not as extensive and I miss some valuable info). Is this possible?

Would I use a custom function(component)? I can easily add the override flag, but that doesn't cover the cases I mentioned above. In my pipeline, I have tagger, parser, customer_ner_model, patter_matcher.


A bit more detail.


For "white lifted truck" the NER model would hopefully pick all of that up, where my pattern matching rules just pick up "truck". In that case, given they are both returning VEHICLE, I don't want the pattern matching to win. 

Another example:

However, if my NER model returns "yellow bus" as LOCATION, I would want my pattern matching which would see bus as a VEHICLE to win. 

Basically a few conditionals that I would like to apply in the pipeline, if possible.