Combining rel.manual with textcat.manual

Hi,
First of all, thank you for producing this excellent software. I'm wondering whether it's possible to combine the rel and textcat interfaces. I have annotators working with the rel.manual interface, but would like to add two text category check boxes to each training instance.
Thanks for any suggestions!

Hi and thanks! :smiley:

You can definitely achieve this by using the blocks UI with two blocks: relations and choice (for multiple choice questions). You can see a similar example here: https://prodi.gy/docs/custom-interfaces#blocks You can run prodigy stats to find the location of your Prodigy installation, and view the recipe code of rel.manual in recipes/rel.py. (You can then either copy it or update it in place if you just want to hack around and try things out.)

In the recipe, you can change the "view_id" to blocks, add the "blocks" to the config as shown in the example above and then add your "options" to each example in the stream before sending out the examples (see here for the expected format).

def add_options_to_stream(stream):
    for eg in stream:
        eg["options"] = [{"id": "A", "text": "Option A"}, {"id": "B", "text": "Option B"}]
        yield eg

stream = add_options_to_stream(stream)

Depending on how complex your texts are, you might want to consider separating the relation annotation and text classification tasks and making two passes over the data instead of doing it all in one UI. The relations UI already has a lot going on because it's about connecting individual words and phrases, which means it takes more work and attention to process the whole text. If the annotator now also has to think about the general label that applies to the whole text, it increases the cognitive load and can slow them down, or even lead to more mistakes and less consistent data. Under the hood, Prodigy will always store a hash that lets you merge annotations on the same input text – so even if you annotate separately, you'll always be able to create a single corpus later on.

1 Like

Thank you for your quick and detailed reply! This worked perfectly :slight_smile: .

1 Like