set Loader file as a variable

Hi, I need to annotate a set of .txt files and want to call the loaders as a variable defined previously in order to simplificate the script.
For example, I´ve this code:

prodigy ner.manual prueba es_core_news_lg C:/Users/Aulamultimedia/prueba.txt --label ETQ

and want to replace the file path with a string variable.
I´m using VSC for windows.
Thank you!

Hi @ezeguins , welcome to Prodigy!

First off, I think you're missing the --loader parameter. You can pass it like so (note the additional --loader txt line):

prodigy ner.manual prueba es_core_news_lg ./path/to/dataset.txt --loader txt --label ETQ

Do you want to annotate all the text files in a single session? Perhaps it might be better to combine all of them first before passing them in the command. Another option is to write a custom recipe that allows you to load a directory containing those text files.

1 Like

Prodigy will guess the loader from the file name so you shouldn't need to set the --loader here explicitly.

I'm not sure I understand the question correctly, but you could just use environment variables? For example, in a bash shell, you could do:

export FILE_PATH=/path/to/your/file.txt
python -m prodigy ner.manual test blank:en $FILE_PATH

On Windows, I think you have to use set instead of export, though.

1 Like