Does Prodigy supports hierarchical annotation?

Why are you converting to match patterns here? I don't think that's what you want to do – I think you just want to export the annotated examples? You can use the db-out command, or even load the annotations from the database programmatically in your recipe.

This means that eg is a string. I think you're missing the step that actually loads the examples? So whatever you pass in as examples (like the path to a file) is passed through here. So it's trying to acccess the index ['accept'] of a string like /path/to/something, which isn't going to work.