#First create the dataset | |
import argilla as rg | |
client = rg.Argilla( | |
api_url="https://javierbarbaesparcia-spanish-legal-ner.hf.space", | |
api_key="apikey", #For security reasons, it has been ofuscated | |
) | |
settings = rg.Settings( | |
guidelines="These are some guidelines.", | |
fields=[ | |
rg.TextField( | |
name="law_cont" | |
), | |
], | |
questions=[ | |
rg.SpanQuestion( | |
field="law_cont", | |
name="label", | |
labels={ | |
"PERSON": "Person", | |
"ORG": "Organization", | |
"LOC": "Location", | |
"DATE": "Date", | |
"REF": "Reference" | |
} | |
), | |
rg.MultiLabelQuestion( | |
name="label_multi", | |
labels={ | |
"RIGHT": "Right", | |
"DUTY": "Duty", | |
"SANC": "Sanction" | |
} | |
) | |
], | |
metadata=[ | |
rg.TermsMetadataProperty( | |
name="content", | |
title="Content", | |
visible_for_annotators="true" | |
), | |
rg.TermsMetadataProperty( | |
name="author", | |
title="Author", | |
visible_for_annotators="true" | |
), | |
] | |
) | |
dataset = rg.Dataset( | |
name="bsc_spanish_legal", | |
settings=settings, | |
) | |
dataset.create() | |
#Then record data | |
import argilla as rg | |
client = rg.Argilla( | |
api_url="https://javierbarbaesparcia-spanish-legal-ner.hf.space", | |
api_key="apikey", #For security resasons it has been ofuscated | |
) | |
dataset=client.datasets("javierbarbaesparcia/bsc_spanish_legal_non_annotated") | |
f=open("archive.txt") #The archive list is available at https://https://zenodo.org/records/5495529#.Y205lpHMKV5 | |
for line in f: | |
if line != "\n": | |
record = [rg.Record( | |
fields={ | |
"law_cont": line, | |
}, | |
metadata={ | |
"content": "Abogacía del Estado", | |
"author": "Asier Gutiérrez-Fandiño and Jordi Armengol-Estapé and Aitor Gonzalez-Agirre and Marta Villegas", | |
}, | |
) | |
] | |
dataset.records.log(record) | |