Setting Up Custom CSV Format

Hi, I'm a beginner at using prodigy and I wasn't sure if there was a way to setup a custom csv format.
Example I have 3 columns in my csv that an annotator needs to review. How would I format those columns so that they would appear as shown in the following?


I hope I understand the question correctly! Are you mostly just looking to have newlines between the 3 lines? In that case, you should be able to just add a newline \n in your data.

If you're working with more complex data structures, if can often be better to use a more flexible format like JSON or JSONL instead, which will let you provide different fields in the data, and makes it a bit easier to provide text, because you don't have to worry about the delimiter (, or \t) that separates the CSV columns.

Yes I am trying to have newlines for each column of data. I already tried json format with \n but the problem with that is it would take extra steps to format the excel sheet so that when it is converted into a json file each column would have \n before it. Instead I was trying to see if something like this could possibly work.

If this is what you want the JSON data to look like the example you posted, one option could be to use the HTML interface with a custom html_template:

All properties in your task would then be available as variables in the template, so it could look like this:

html_template = "{{Question}}<br />{{Answer}}<br />{{Model}}"

Just make sure to also include a key "html": "" in your JSON, so Prodigy knows to render the main content of your choice interface as HTML.

Another option would be to just generate the text with newlines automatically, which shouldn't be that difficult – you'd just need to add "text": f"{data['Question']}\n{data['Answer']}\n{data['Model']} to each entry.

Ok so I tried looking at the documentation for custom interfaces but I still cant figure out how the html template actually works do I need to add "html_template = "{{Question}}
{{Model}}"" to my json file or can I apply this the command in command prompt or do I have to make a python script to apply the html template. Also is this how I format my data to make it work with the html template?

This isn't going to work, because a dictionary or JSON object can only have one instance of the same key. Otherwise, it'd be overwritten. So if you want to use "html", what I was suggesting would look more like this:

{"html": "Question: ...<br />Answer: ...<br />Model: ..."}

The alternative would be to use a "html_template", which you can either put in the "config" returned by a custom recipe, or in the prodigy.json in your Prodigy directory (typically in .prodigy in your user home directory) or in the local working directory.