Custom semantic relations without unique heads

Is it possible to leverage Prodigy/Spacy for custom semantic relations with multiple heads?

I am following the intent-parser example shown in “Training a parser for custom semantics” ( But my own semantic data allow for multiple incoming and outgoing links between entities. There is not really a concept of “heads” for this data:

Q1 --g--> G1
Q1 --o--> O1
Q2 --g--> G1
Q2 --o--> O2

Regardless of which direction the links go, it is not possible to represent these semantic relations such that each word has only 1 incoming link from a single “head.” Does that make it incompatible with spacy/prodigy?

There’s no direct support for this kind of model at the moment. You can still plug a model that predicts these relations into spaCy, and add the semantic graph as extension attributes, where it will be easy to access in conjunction with the other linguistic attributes. But you won’t be able to use any of the existing classes to write your model — you’ll have to do that part yourself. You might also have a look at AllenNLP, who have a variety of models that might be helpful for what you’re doing.

The situation is similar with Prodigy. I think you should be able to mark your relations with some combination of Prodigy’s interfaces, but there’s no built-in support yet.