Update tajik-text-segmentation.py
Browse files- tajik-text-segmentation.py +11 -2
tajik-text-segmentation.py
CHANGED
@@ -37,6 +37,7 @@ _HOMEPAGE = ""
|
|
37 |
_LICENSE = ""
|
38 |
|
39 |
|
|
|
40 |
class TajikTextSegmentation(datasets.GeneratorBasedBuilder):
|
41 |
"""A dataset of sentence-wise text segmentation in Tajik language."""
|
42 |
|
@@ -68,20 +69,26 @@ class TajikTextSegmentation(datasets.GeneratorBasedBuilder):
|
|
68 |
# Citation for the dataset
|
69 |
citation=_CITATION,
|
70 |
)
|
71 |
-
|
72 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
73 |
return [
|
74 |
datasets.SplitGenerator(
|
75 |
name=datasets.Split.TRAIN,
|
76 |
# These kwargs will be passed to _generate_examples
|
77 |
gen_kwargs={
|
78 |
-
"directory_path": './annotations',
|
|
|
79 |
},
|
80 |
),
|
81 |
]
|
82 |
|
83 |
def _generate_examples(self, directory_path):
|
84 |
"""This function returns the examples."""
|
|
|
85 |
|
86 |
annotations = load_yedda_annotations(directory_path)
|
87 |
|
@@ -99,3 +106,5 @@ class TajikTextSegmentation(datasets.GeneratorBasedBuilder):
|
|
99 |
"labels": file_annotation['labels'],
|
100 |
"number_of_labels": number_of_labels,
|
101 |
}
|
|
|
|
|
|
37 |
_LICENSE = ""
|
38 |
|
39 |
|
40 |
+
|
41 |
class TajikTextSegmentation(datasets.GeneratorBasedBuilder):
|
42 |
"""A dataset of sentence-wise text segmentation in Tajik language."""
|
43 |
|
|
|
69 |
# Citation for the dataset
|
70 |
citation=_CITATION,
|
71 |
)
|
|
|
72 |
def _split_generators(self, dl_manager):
|
73 |
+
# path = dl_manager.download_custom('https://huggingface.co/datasets/sobir-hf/tajik-text-segmentation/tree/main/annotations')
|
74 |
+
|
75 |
+
path = snapshot_download(repo_id="sobir-hf/tajik-text-segmentation", repo_type='dataset')
|
76 |
+
path = os.path.join(path, 'annotations')
|
77 |
+
# path = dl_manager.download([f'annotations/{i:04}.ann' for i in range(110)])
|
78 |
return [
|
79 |
datasets.SplitGenerator(
|
80 |
name=datasets.Split.TRAIN,
|
81 |
# These kwargs will be passed to _generate_examples
|
82 |
gen_kwargs={
|
83 |
+
# "directory_path": './annotations',
|
84 |
+
"directory_path": path,
|
85 |
},
|
86 |
),
|
87 |
]
|
88 |
|
89 |
def _generate_examples(self, directory_path):
|
90 |
"""This function returns the examples."""
|
91 |
+
print(directory_path)
|
92 |
|
93 |
annotations = load_yedda_annotations(directory_path)
|
94 |
|
|
|
106 |
"labels": file_annotation['labels'],
|
107 |
"number_of_labels": number_of_labels,
|
108 |
}
|
109 |
+
|
110 |
+
|