tobiasbrugger
commited on
Commit
•
581a7d6
1
Parent(s):
4367980
update
Browse files- Multilingual-SBD.py +5 -6
- README.md +42 -42
Multilingual-SBD.py
CHANGED
@@ -65,17 +65,15 @@ class MultilingualSBD(datasets.GeneratorBasedBuilder):
|
|
65 |
def _info(self):
|
66 |
features = datasets.Features(
|
67 |
{
|
68 |
-
#"language": datasets.Value("string"), #in _LANGUAGES
|
69 |
-
#"type": datasets.Value("string"), # in _TYPES
|
70 |
-
#"subtype": datasets.Value("string"), # in _SUBTYPES
|
71 |
"text": datasets.Value("string"),
|
72 |
"spans": [
|
73 |
{
|
74 |
"start": datasets.Value("int64"),
|
75 |
"end": datasets.Value("int64"),
|
|
|
76 |
"token_start": datasets.Value("int64"),
|
77 |
-
"token_end": datasets.Value("int64")
|
78 |
-
|
79 |
}
|
80 |
],
|
81 |
"tokens": [
|
@@ -108,7 +106,6 @@ class MultilingualSBD(datasets.GeneratorBasedBuilder):
|
|
108 |
return dl_manager.download(url)
|
109 |
languages = _LANGUAGES if self.config.language == "all" else [self.config.language]
|
110 |
types = _TYPES if self.config.type == 'all' else [self.config.type]
|
111 |
-
#sources = _SOURCES if self.config.source == 'all' else [self.config.source]
|
112 |
|
113 |
split_generators = []
|
114 |
for split in [datasets.Split.TRAIN]:
|
@@ -138,6 +135,8 @@ class MultilingualSBD(datasets.GeneratorBasedBuilder):
|
|
138 |
|
139 |
for json_str in json_list:
|
140 |
example = json.loads(json_str)
|
|
|
|
|
141 |
if example is not None and isinstance(example, dict):
|
142 |
yield id_, example
|
143 |
id_ +=1
|
|
|
65 |
def _info(self):
|
66 |
features = datasets.Features(
|
67 |
{
|
|
|
|
|
|
|
68 |
"text": datasets.Value("string"),
|
69 |
"spans": [
|
70 |
{
|
71 |
"start": datasets.Value("int64"),
|
72 |
"end": datasets.Value("int64"),
|
73 |
+
"label": datasets.Value("string"),
|
74 |
"token_start": datasets.Value("int64"),
|
75 |
+
"token_end": datasets.Value("int64")
|
76 |
+
|
77 |
}
|
78 |
],
|
79 |
"tokens": [
|
|
|
106 |
return dl_manager.download(url)
|
107 |
languages = _LANGUAGES if self.config.language == "all" else [self.config.language]
|
108 |
types = _TYPES if self.config.type == 'all' else [self.config.type]
|
|
|
109 |
|
110 |
split_generators = []
|
111 |
for split in [datasets.Split.TRAIN]:
|
|
|
135 |
|
136 |
for json_str in json_list:
|
137 |
example = json.loads(json_str)
|
138 |
+
if id_ == 0:
|
139 |
+
print(example)
|
140 |
if example is not None and isinstance(example, dict):
|
141 |
yield id_, example
|
142 |
id_ +=1
|
README.md
CHANGED
@@ -212,12 +212,12 @@ dataset_info:
|
|
212 |
dtype: int64
|
213 |
- name: end
|
214 |
dtype: int64
|
|
|
|
|
215 |
- name: token_start
|
216 |
dtype: int64
|
217 |
- name: token_end
|
218 |
dtype: int64
|
219 |
-
- name: label
|
220 |
-
dtype: string
|
221 |
- name: tokens
|
222 |
list:
|
223 |
- name: text
|
@@ -282,12 +282,12 @@ dataset_info:
|
|
282 |
dtype: int64
|
283 |
- name: end
|
284 |
dtype: int64
|
|
|
|
|
285 |
- name: token_start
|
286 |
dtype: int64
|
287 |
- name: token_end
|
288 |
dtype: int64
|
289 |
-
- name: label
|
290 |
-
dtype: string
|
291 |
- name: tokens
|
292 |
list:
|
293 |
- name: text
|
@@ -352,12 +352,12 @@ dataset_info:
|
|
352 |
dtype: int64
|
353 |
- name: end
|
354 |
dtype: int64
|
|
|
|
|
355 |
- name: token_start
|
356 |
dtype: int64
|
357 |
- name: token_end
|
358 |
dtype: int64
|
359 |
-
- name: label
|
360 |
-
dtype: string
|
361 |
- name: tokens
|
362 |
list:
|
363 |
- name: text
|
@@ -422,12 +422,12 @@ dataset_info:
|
|
422 |
dtype: int64
|
423 |
- name: end
|
424 |
dtype: int64
|
|
|
|
|
425 |
- name: token_start
|
426 |
dtype: int64
|
427 |
- name: token_end
|
428 |
dtype: int64
|
429 |
-
- name: label
|
430 |
-
dtype: string
|
431 |
- name: tokens
|
432 |
list:
|
433 |
- name: text
|
@@ -492,12 +492,12 @@ dataset_info:
|
|
492 |
dtype: int64
|
493 |
- name: end
|
494 |
dtype: int64
|
|
|
|
|
495 |
- name: token_start
|
496 |
dtype: int64
|
497 |
- name: token_end
|
498 |
dtype: int64
|
499 |
-
- name: label
|
500 |
-
dtype: string
|
501 |
- name: tokens
|
502 |
list:
|
503 |
- name: text
|
@@ -528,12 +528,12 @@ dataset_info:
|
|
528 |
dtype: int64
|
529 |
- name: end
|
530 |
dtype: int64
|
|
|
|
|
531 |
- name: token_start
|
532 |
dtype: int64
|
533 |
- name: token_end
|
534 |
dtype: int64
|
535 |
-
- name: label
|
536 |
-
dtype: string
|
537 |
- name: tokens
|
538 |
list:
|
539 |
- name: text
|
@@ -564,12 +564,12 @@ dataset_info:
|
|
564 |
dtype: int64
|
565 |
- name: end
|
566 |
dtype: int64
|
|
|
|
|
567 |
- name: token_start
|
568 |
dtype: int64
|
569 |
- name: token_end
|
570 |
dtype: int64
|
571 |
-
- name: label
|
572 |
-
dtype: string
|
573 |
- name: tokens
|
574 |
list:
|
575 |
- name: text
|
@@ -600,12 +600,12 @@ dataset_info:
|
|
600 |
dtype: int64
|
601 |
- name: end
|
602 |
dtype: int64
|
|
|
|
|
603 |
- name: token_start
|
604 |
dtype: int64
|
605 |
- name: token_end
|
606 |
dtype: int64
|
607 |
-
- name: label
|
608 |
-
dtype: string
|
609 |
- name: tokens
|
610 |
list:
|
611 |
- name: text
|
@@ -636,12 +636,12 @@ dataset_info:
|
|
636 |
dtype: int64
|
637 |
- name: end
|
638 |
dtype: int64
|
|
|
|
|
639 |
- name: token_start
|
640 |
dtype: int64
|
641 |
- name: token_end
|
642 |
dtype: int64
|
643 |
-
- name: label
|
644 |
-
dtype: string
|
645 |
- name: tokens
|
646 |
list:
|
647 |
- name: text
|
@@ -672,12 +672,12 @@ dataset_info:
|
|
672 |
dtype: int64
|
673 |
- name: end
|
674 |
dtype: int64
|
|
|
|
|
675 |
- name: token_start
|
676 |
dtype: int64
|
677 |
- name: token_end
|
678 |
dtype: int64
|
679 |
-
- name: label
|
680 |
-
dtype: string
|
681 |
- name: tokens
|
682 |
list:
|
683 |
- name: text
|
@@ -708,12 +708,12 @@ dataset_info:
|
|
708 |
dtype: int64
|
709 |
- name: end
|
710 |
dtype: int64
|
|
|
|
|
711 |
- name: token_start
|
712 |
dtype: int64
|
713 |
- name: token_end
|
714 |
dtype: int64
|
715 |
-
- name: label
|
716 |
-
dtype: string
|
717 |
- name: tokens
|
718 |
list:
|
719 |
- name: text
|
@@ -744,12 +744,12 @@ dataset_info:
|
|
744 |
dtype: int64
|
745 |
- name: end
|
746 |
dtype: int64
|
|
|
|
|
747 |
- name: token_start
|
748 |
dtype: int64
|
749 |
- name: token_end
|
750 |
dtype: int64
|
751 |
-
- name: label
|
752 |
-
dtype: string
|
753 |
- name: tokens
|
754 |
list:
|
755 |
- name: text
|
@@ -778,12 +778,12 @@ dataset_info:
|
|
778 |
dtype: int64
|
779 |
- name: end
|
780 |
dtype: int64
|
|
|
|
|
781 |
- name: token_start
|
782 |
dtype: int64
|
783 |
- name: token_end
|
784 |
dtype: int64
|
785 |
-
- name: label
|
786 |
-
dtype: string
|
787 |
- name: tokens
|
788 |
list:
|
789 |
- name: text
|
@@ -814,12 +814,12 @@ dataset_info:
|
|
814 |
dtype: int64
|
815 |
- name: end
|
816 |
dtype: int64
|
|
|
|
|
817 |
- name: token_start
|
818 |
dtype: int64
|
819 |
- name: token_end
|
820 |
dtype: int64
|
821 |
-
- name: label
|
822 |
-
dtype: string
|
823 |
- name: tokens
|
824 |
list:
|
825 |
- name: text
|
@@ -850,12 +850,12 @@ dataset_info:
|
|
850 |
dtype: int64
|
851 |
- name: end
|
852 |
dtype: int64
|
|
|
|
|
853 |
- name: token_start
|
854 |
dtype: int64
|
855 |
- name: token_end
|
856 |
dtype: int64
|
857 |
-
- name: label
|
858 |
-
dtype: string
|
859 |
- name: tokens
|
860 |
list:
|
861 |
- name: text
|
@@ -886,12 +886,12 @@ dataset_info:
|
|
886 |
dtype: int64
|
887 |
- name: end
|
888 |
dtype: int64
|
|
|
|
|
889 |
- name: token_start
|
890 |
dtype: int64
|
891 |
- name: token_end
|
892 |
dtype: int64
|
893 |
-
- name: label
|
894 |
-
dtype: string
|
895 |
- name: tokens
|
896 |
list:
|
897 |
- name: text
|
@@ -922,12 +922,12 @@ dataset_info:
|
|
922 |
dtype: int64
|
923 |
- name: end
|
924 |
dtype: int64
|
|
|
|
|
925 |
- name: token_start
|
926 |
dtype: int64
|
927 |
- name: token_end
|
928 |
dtype: int64
|
929 |
-
- name: label
|
930 |
-
dtype: string
|
931 |
- name: tokens
|
932 |
list:
|
933 |
- name: text
|
@@ -958,12 +958,12 @@ dataset_info:
|
|
958 |
dtype: int64
|
959 |
- name: end
|
960 |
dtype: int64
|
|
|
|
|
961 |
- name: token_start
|
962 |
dtype: int64
|
963 |
- name: token_end
|
964 |
dtype: int64
|
965 |
-
- name: label
|
966 |
-
dtype: string
|
967 |
- name: tokens
|
968 |
list:
|
969 |
- name: text
|
@@ -994,12 +994,12 @@ dataset_info:
|
|
994 |
dtype: int64
|
995 |
- name: end
|
996 |
dtype: int64
|
|
|
|
|
997 |
- name: token_start
|
998 |
dtype: int64
|
999 |
- name: token_end
|
1000 |
dtype: int64
|
1001 |
-
- name: label
|
1002 |
-
dtype: string
|
1003 |
- name: tokens
|
1004 |
list:
|
1005 |
- name: text
|
@@ -1030,12 +1030,12 @@ dataset_info:
|
|
1030 |
dtype: int64
|
1031 |
- name: end
|
1032 |
dtype: int64
|
|
|
|
|
1033 |
- name: token_start
|
1034 |
dtype: int64
|
1035 |
- name: token_end
|
1036 |
dtype: int64
|
1037 |
-
- name: label
|
1038 |
-
dtype: string
|
1039 |
- name: tokens
|
1040 |
list:
|
1041 |
- name: text
|
@@ -1066,12 +1066,12 @@ dataset_info:
|
|
1066 |
dtype: int64
|
1067 |
- name: end
|
1068 |
dtype: int64
|
|
|
|
|
1069 |
- name: token_start
|
1070 |
dtype: int64
|
1071 |
- name: token_end
|
1072 |
dtype: int64
|
1073 |
-
- name: label
|
1074 |
-
dtype: string
|
1075 |
- name: tokens
|
1076 |
list:
|
1077 |
- name: text
|
|
|
212 |
dtype: int64
|
213 |
- name: end
|
214 |
dtype: int64
|
215 |
+
- name: label
|
216 |
+
dtype: string
|
217 |
- name: token_start
|
218 |
dtype: int64
|
219 |
- name: token_end
|
220 |
dtype: int64
|
|
|
|
|
221 |
- name: tokens
|
222 |
list:
|
223 |
- name: text
|
|
|
282 |
dtype: int64
|
283 |
- name: end
|
284 |
dtype: int64
|
285 |
+
- name: label
|
286 |
+
dtype: string
|
287 |
- name: token_start
|
288 |
dtype: int64
|
289 |
- name: token_end
|
290 |
dtype: int64
|
|
|
|
|
291 |
- name: tokens
|
292 |
list:
|
293 |
- name: text
|
|
|
352 |
dtype: int64
|
353 |
- name: end
|
354 |
dtype: int64
|
355 |
+
- name: label
|
356 |
+
dtype: string
|
357 |
- name: token_start
|
358 |
dtype: int64
|
359 |
- name: token_end
|
360 |
dtype: int64
|
|
|
|
|
361 |
- name: tokens
|
362 |
list:
|
363 |
- name: text
|
|
|
422 |
dtype: int64
|
423 |
- name: end
|
424 |
dtype: int64
|
425 |
+
- name: label
|
426 |
+
dtype: string
|
427 |
- name: token_start
|
428 |
dtype: int64
|
429 |
- name: token_end
|
430 |
dtype: int64
|
|
|
|
|
431 |
- name: tokens
|
432 |
list:
|
433 |
- name: text
|
|
|
492 |
dtype: int64
|
493 |
- name: end
|
494 |
dtype: int64
|
495 |
+
- name: label
|
496 |
+
dtype: string
|
497 |
- name: token_start
|
498 |
dtype: int64
|
499 |
- name: token_end
|
500 |
dtype: int64
|
|
|
|
|
501 |
- name: tokens
|
502 |
list:
|
503 |
- name: text
|
|
|
528 |
dtype: int64
|
529 |
- name: end
|
530 |
dtype: int64
|
531 |
+
- name: label
|
532 |
+
dtype: string
|
533 |
- name: token_start
|
534 |
dtype: int64
|
535 |
- name: token_end
|
536 |
dtype: int64
|
|
|
|
|
537 |
- name: tokens
|
538 |
list:
|
539 |
- name: text
|
|
|
564 |
dtype: int64
|
565 |
- name: end
|
566 |
dtype: int64
|
567 |
+
- name: label
|
568 |
+
dtype: string
|
569 |
- name: token_start
|
570 |
dtype: int64
|
571 |
- name: token_end
|
572 |
dtype: int64
|
|
|
|
|
573 |
- name: tokens
|
574 |
list:
|
575 |
- name: text
|
|
|
600 |
dtype: int64
|
601 |
- name: end
|
602 |
dtype: int64
|
603 |
+
- name: label
|
604 |
+
dtype: string
|
605 |
- name: token_start
|
606 |
dtype: int64
|
607 |
- name: token_end
|
608 |
dtype: int64
|
|
|
|
|
609 |
- name: tokens
|
610 |
list:
|
611 |
- name: text
|
|
|
636 |
dtype: int64
|
637 |
- name: end
|
638 |
dtype: int64
|
639 |
+
- name: label
|
640 |
+
dtype: string
|
641 |
- name: token_start
|
642 |
dtype: int64
|
643 |
- name: token_end
|
644 |
dtype: int64
|
|
|
|
|
645 |
- name: tokens
|
646 |
list:
|
647 |
- name: text
|
|
|
672 |
dtype: int64
|
673 |
- name: end
|
674 |
dtype: int64
|
675 |
+
- name: label
|
676 |
+
dtype: string
|
677 |
- name: token_start
|
678 |
dtype: int64
|
679 |
- name: token_end
|
680 |
dtype: int64
|
|
|
|
|
681 |
- name: tokens
|
682 |
list:
|
683 |
- name: text
|
|
|
708 |
dtype: int64
|
709 |
- name: end
|
710 |
dtype: int64
|
711 |
+
- name: label
|
712 |
+
dtype: string
|
713 |
- name: token_start
|
714 |
dtype: int64
|
715 |
- name: token_end
|
716 |
dtype: int64
|
|
|
|
|
717 |
- name: tokens
|
718 |
list:
|
719 |
- name: text
|
|
|
744 |
dtype: int64
|
745 |
- name: end
|
746 |
dtype: int64
|
747 |
+
- name: label
|
748 |
+
dtype: string
|
749 |
- name: token_start
|
750 |
dtype: int64
|
751 |
- name: token_end
|
752 |
dtype: int64
|
|
|
|
|
753 |
- name: tokens
|
754 |
list:
|
755 |
- name: text
|
|
|
778 |
dtype: int64
|
779 |
- name: end
|
780 |
dtype: int64
|
781 |
+
- name: label
|
782 |
+
dtype: string
|
783 |
- name: token_start
|
784 |
dtype: int64
|
785 |
- name: token_end
|
786 |
dtype: int64
|
|
|
|
|
787 |
- name: tokens
|
788 |
list:
|
789 |
- name: text
|
|
|
814 |
dtype: int64
|
815 |
- name: end
|
816 |
dtype: int64
|
817 |
+
- name: label
|
818 |
+
dtype: string
|
819 |
- name: token_start
|
820 |
dtype: int64
|
821 |
- name: token_end
|
822 |
dtype: int64
|
|
|
|
|
823 |
- name: tokens
|
824 |
list:
|
825 |
- name: text
|
|
|
850 |
dtype: int64
|
851 |
- name: end
|
852 |
dtype: int64
|
853 |
+
- name: label
|
854 |
+
dtype: string
|
855 |
- name: token_start
|
856 |
dtype: int64
|
857 |
- name: token_end
|
858 |
dtype: int64
|
|
|
|
|
859 |
- name: tokens
|
860 |
list:
|
861 |
- name: text
|
|
|
886 |
dtype: int64
|
887 |
- name: end
|
888 |
dtype: int64
|
889 |
+
- name: label
|
890 |
+
dtype: string
|
891 |
- name: token_start
|
892 |
dtype: int64
|
893 |
- name: token_end
|
894 |
dtype: int64
|
|
|
|
|
895 |
- name: tokens
|
896 |
list:
|
897 |
- name: text
|
|
|
922 |
dtype: int64
|
923 |
- name: end
|
924 |
dtype: int64
|
925 |
+
- name: label
|
926 |
+
dtype: string
|
927 |
- name: token_start
|
928 |
dtype: int64
|
929 |
- name: token_end
|
930 |
dtype: int64
|
|
|
|
|
931 |
- name: tokens
|
932 |
list:
|
933 |
- name: text
|
|
|
958 |
dtype: int64
|
959 |
- name: end
|
960 |
dtype: int64
|
961 |
+
- name: label
|
962 |
+
dtype: string
|
963 |
- name: token_start
|
964 |
dtype: int64
|
965 |
- name: token_end
|
966 |
dtype: int64
|
|
|
|
|
967 |
- name: tokens
|
968 |
list:
|
969 |
- name: text
|
|
|
994 |
dtype: int64
|
995 |
- name: end
|
996 |
dtype: int64
|
997 |
+
- name: label
|
998 |
+
dtype: string
|
999 |
- name: token_start
|
1000 |
dtype: int64
|
1001 |
- name: token_end
|
1002 |
dtype: int64
|
|
|
|
|
1003 |
- name: tokens
|
1004 |
list:
|
1005 |
- name: text
|
|
|
1030 |
dtype: int64
|
1031 |
- name: end
|
1032 |
dtype: int64
|
1033 |
+
- name: label
|
1034 |
+
dtype: string
|
1035 |
- name: token_start
|
1036 |
dtype: int64
|
1037 |
- name: token_end
|
1038 |
dtype: int64
|
|
|
|
|
1039 |
- name: tokens
|
1040 |
list:
|
1041 |
- name: text
|
|
|
1066 |
dtype: int64
|
1067 |
- name: end
|
1068 |
dtype: int64
|
1069 |
+
- name: label
|
1070 |
+
dtype: string
|
1071 |
- name: token_start
|
1072 |
dtype: int64
|
1073 |
- name: token_end
|
1074 |
dtype: int64
|
|
|
|
|
1075 |
- name: tokens
|
1076 |
list:
|
1077 |
- name: text
|