javierbarbaesparcia commited on
Commit
304b3f3
·
verified ·
1 Parent(s): 12a6192

Create bsc_spanish_legal_non_annotated.py

Browse files
Files changed (1) hide show
  1. bsc_spanish_legal_non_annotated.py +88 -0
bsc_spanish_legal_non_annotated.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #First create the dataset
2
+
3
+ import argilla as rg
4
+
5
+ client = rg.Argilla(
6
+ api_url="https://javierbarbaesparcia-spanish-legal-ner.hf.space",
7
+ api_key="apikey", #For security reasons, it has been ofuscated
8
+ )
9
+
10
+ settings = rg.Settings(
11
+ guidelines="These are some guidelines.",
12
+ fields=[
13
+ rg.TextField(
14
+ name="law_cont"
15
+ ),
16
+ ],
17
+ questions=[
18
+ rg.SpanQuestion(
19
+ field="law_cont",
20
+ name="label",
21
+ labels={
22
+ "PERSON": "Person",
23
+ "ORG": "Organization",
24
+ "LOC": "Location",
25
+ "DATE": "Date",
26
+ "REF": "Reference"
27
+ }
28
+ ),
29
+ rg.MultiLabelQuestion(
30
+ name="label_multi",
31
+ labels={
32
+ "RIGHT": "Right",
33
+ "DUTY": "Duty",
34
+ "SANC": "Sanction"
35
+ }
36
+ )
37
+ ],
38
+ metadata=[
39
+ rg.TermsMetadataProperty(
40
+ name="content",
41
+ title="Content",
42
+ visible_for_annotators="true"
43
+ ),
44
+ rg.TermsMetadataProperty(
45
+ name="author",
46
+ title="Author",
47
+ visible_for_annotators="true"
48
+ ),
49
+ ]
50
+ )
51
+
52
+ dataset = rg.Dataset(
53
+ name="bsc_spanish_legal",
54
+ settings=settings,
55
+ )
56
+
57
+ dataset.create()
58
+
59
+ #Then record data
60
+
61
+ import argilla as rg
62
+
63
+ client = rg.Argilla(
64
+ api_url="https://javierbarbaesparcia-spanish-legal-ner.hf.space",
65
+ api_key="apikey", #For security resasons it has been ofuscated
66
+ )
67
+ dataset=client.datasets("javierbarbaesparcia/bsc_spanish_legal_non_annotated")
68
+ f=open("archive.txt") #The archive list is available at https://https://zenodo.org/records/5495529#.Y205lpHMKV5
69
+
70
+
71
+ for line in f:
72
+
73
+ if line != "\n":
74
+ record = [rg.Record(
75
+ fields={
76
+ "law_cont": line,
77
+ },
78
+ metadata={
79
+ "content": "Abogacía del Estado",
80
+ "author": "Asier Gutiérrez-Fandiño and Jordi Armengol-Estapé and Aitor Gonzalez-Agirre and Marta Villegas",
81
+
82
+ },
83
+ )
84
+ ]
85
+
86
+ dataset.records.log(record)
87
+
88
+