Commit
•
7d23f24
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +150 -0
- dataset_infos.json +144 -0
- dummy/annotations/0.7.0/dummy_data.zip +3 -0
- dummy/entire_dataset/0.7.0/dummy_data.zip +3 -0
- ncslgr.py +144 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
languages:
|
7 |
+
- ase
|
8 |
+
- en
|
9 |
+
licenses:
|
10 |
+
- mit
|
11 |
+
multilinguality:
|
12 |
+
- translation
|
13 |
+
size_categories:
|
14 |
+
- n<1K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- conditional-text-generation
|
19 |
+
task_ids:
|
20 |
+
- machine-translation
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for NCSLGR
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-instances)
|
33 |
+
- [Data Splits](#data-instances)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
|
48 |
+
## Dataset Description
|
49 |
+
|
50 |
+
- **Homepage:** https://www.bu.edu/asllrp/ncslgr.html
|
51 |
+
- **Repository:**
|
52 |
+
- **Paper:**
|
53 |
+
- **Leaderboard:**
|
54 |
+
- **Point of Contact:**
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
|
58 |
+
A small corpus of American Sign Language (ASL) video data from native signers, annotated with non-manual features.
|
59 |
+
|
60 |
+
### Supported Tasks and Leaderboards
|
61 |
+
|
62 |
+
[More Information Needed]
|
63 |
+
|
64 |
+
### Languages
|
65 |
+
|
66 |
+
- American Sign Language
|
67 |
+
- English
|
68 |
+
|
69 |
+
## Dataset Structure
|
70 |
+
|
71 |
+
### Data Instances
|
72 |
+
|
73 |
+
[More Information Needed]
|
74 |
+
|
75 |
+
### Data Fields
|
76 |
+
|
77 |
+
- eaf: path to an ELAN annotation file
|
78 |
+
- videos: sequence of strings to video paths
|
79 |
+
- sentences: sequence of parallel sentences
|
80 |
+
- gloss: American Sign Language gloss annotations
|
81 |
+
- text: English text
|
82 |
+
|
83 |
+
### Data Splits
|
84 |
+
|
85 |
+
None
|
86 |
+
|
87 |
+
## Dataset Creation
|
88 |
+
|
89 |
+
### Curation Rationale
|
90 |
+
|
91 |
+
[More Information Needed]
|
92 |
+
|
93 |
+
### Source Data
|
94 |
+
|
95 |
+
#### Initial Data Collection and Normalization
|
96 |
+
|
97 |
+
[More Information Needed]
|
98 |
+
|
99 |
+
#### Who are the source language producers?
|
100 |
+
|
101 |
+
[More Information Needed]
|
102 |
+
|
103 |
+
### Annotations
|
104 |
+
|
105 |
+
#### Annotation process
|
106 |
+
|
107 |
+
[More Information Needed]
|
108 |
+
|
109 |
+
#### Who are the annotators?
|
110 |
+
|
111 |
+
[More Information Needed]
|
112 |
+
|
113 |
+
### Personal and Sensitive Information
|
114 |
+
|
115 |
+
[More Information Needed]
|
116 |
+
|
117 |
+
## Considerations for Using the Data
|
118 |
+
|
119 |
+
### Social Impact of Dataset
|
120 |
+
|
121 |
+
[More Information Needed]
|
122 |
+
|
123 |
+
### Discussion of Biases
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
### Other Known Limitations
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
## Additional Information
|
132 |
+
|
133 |
+
### Dataset Curators
|
134 |
+
|
135 |
+
[More Information Needed]
|
136 |
+
|
137 |
+
### Licensing Information
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
### Citation Information
|
142 |
+
|
143 |
+
```bibtex
|
144 |
+
@misc{dataset:databases2007volumes,
|
145 |
+
title={Volumes 2--7},
|
146 |
+
author={Databases, NCSLGR},
|
147 |
+
year={2007},
|
148 |
+
publisher={American Sign Language Linguistic Research Project (Distributed on CD-ROM~…}
|
149 |
+
}
|
150 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"entire_dataset": {
|
3 |
+
"description": "\nA small corpus of American Sign Language (ASL) video data from native signers, annotated with non-manual features.\n",
|
4 |
+
"citation": "@misc{dataset:databases2007volumes,\n title={Volumes 2--7},\n author={Databases, NCSLGR},\n year={2007},\n publisher={American Sign Language Linguistic Research Project (Distributed on CD-ROM~\u2026}\n}\n",
|
5 |
+
"homepage": "https://www.bu.edu/asllrp/ncslgr.html",
|
6 |
+
"license": "",
|
7 |
+
"features": {
|
8 |
+
"eaf": {
|
9 |
+
"dtype": "string",
|
10 |
+
"id": null,
|
11 |
+
"_type": "Value"
|
12 |
+
},
|
13 |
+
"sentences": {
|
14 |
+
"feature": {
|
15 |
+
"gloss": {
|
16 |
+
"dtype": "string",
|
17 |
+
"id": null,
|
18 |
+
"_type": "Value"
|
19 |
+
},
|
20 |
+
"text": {
|
21 |
+
"dtype": "string",
|
22 |
+
"id": null,
|
23 |
+
"_type": "Value"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"length": -1,
|
27 |
+
"id": null,
|
28 |
+
"_type": "Sequence"
|
29 |
+
},
|
30 |
+
"videos": {
|
31 |
+
"feature": {
|
32 |
+
"dtype": "string",
|
33 |
+
"id": null,
|
34 |
+
"_type": "Value"
|
35 |
+
},
|
36 |
+
"length": -1,
|
37 |
+
"id": null,
|
38 |
+
"_type": "Sequence"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"post_processed": null,
|
42 |
+
"supervised_keys": null,
|
43 |
+
"builder_name": "ncslgr",
|
44 |
+
"config_name": "entire_dataset",
|
45 |
+
"version": {
|
46 |
+
"version_str": "0.7.0",
|
47 |
+
"description": null,
|
48 |
+
"major": 0,
|
49 |
+
"minor": 7,
|
50 |
+
"patch": 0
|
51 |
+
},
|
52 |
+
"splits": {
|
53 |
+
"train": {
|
54 |
+
"name": "train",
|
55 |
+
"num_bytes": 783504,
|
56 |
+
"num_examples": 870,
|
57 |
+
"dataset_name": "ncslgr"
|
58 |
+
}
|
59 |
+
},
|
60 |
+
"download_checksums": {
|
61 |
+
"http://asl.cs.depaul.edu/corpus/elanBUcorpus.zip": {
|
62 |
+
"num_bytes": 5335358,
|
63 |
+
"checksum": "7e2a49cfec0d2d39a933df1c20e1f1f79f30bca70974b1f65ef05a0df99f2949"
|
64 |
+
},
|
65 |
+
"http://asl.cs.depaul.edu/corpus/video.zip": {
|
66 |
+
"num_bytes": 4108493785,
|
67 |
+
"checksum": "9a71da5ef7a978b42be236794af43a4ba6f5f8119ce28cdf9d9746d9e4481a15"
|
68 |
+
}
|
69 |
+
},
|
70 |
+
"download_size": 4113829143,
|
71 |
+
"post_processing_size": null,
|
72 |
+
"dataset_size": 783504,
|
73 |
+
"size_in_bytes": 4114612647
|
74 |
+
},
|
75 |
+
"annotations": {
|
76 |
+
"description": "\nA small corpus of American Sign Language (ASL) video data from native signers, annotated with non-manual features.\n",
|
77 |
+
"citation": "@misc{dataset:databases2007volumes,\n title={Volumes 2--7},\n author={Databases, NCSLGR},\n year={2007},\n publisher={American Sign Language Linguistic Research Project (Distributed on CD-ROM~\u2026}\n}\n",
|
78 |
+
"homepage": "https://www.bu.edu/asllrp/ncslgr.html",
|
79 |
+
"license": "",
|
80 |
+
"features": {
|
81 |
+
"eaf": {
|
82 |
+
"dtype": "string",
|
83 |
+
"id": null,
|
84 |
+
"_type": "Value"
|
85 |
+
},
|
86 |
+
"sentences": {
|
87 |
+
"feature": {
|
88 |
+
"gloss": {
|
89 |
+
"dtype": "string",
|
90 |
+
"id": null,
|
91 |
+
"_type": "Value"
|
92 |
+
},
|
93 |
+
"text": {
|
94 |
+
"dtype": "string",
|
95 |
+
"id": null,
|
96 |
+
"_type": "Value"
|
97 |
+
}
|
98 |
+
},
|
99 |
+
"length": -1,
|
100 |
+
"id": null,
|
101 |
+
"_type": "Sequence"
|
102 |
+
},
|
103 |
+
"videos": {
|
104 |
+
"feature": {
|
105 |
+
"dtype": "string",
|
106 |
+
"id": null,
|
107 |
+
"_type": "Value"
|
108 |
+
},
|
109 |
+
"length": -1,
|
110 |
+
"id": null,
|
111 |
+
"_type": "Sequence"
|
112 |
+
}
|
113 |
+
},
|
114 |
+
"post_processed": null,
|
115 |
+
"supervised_keys": null,
|
116 |
+
"builder_name": "ncslgr",
|
117 |
+
"config_name": "annotations",
|
118 |
+
"version": {
|
119 |
+
"version_str": "0.7.0",
|
120 |
+
"description": null,
|
121 |
+
"major": 0,
|
122 |
+
"minor": 7,
|
123 |
+
"patch": 0
|
124 |
+
},
|
125 |
+
"splits": {
|
126 |
+
"train": {
|
127 |
+
"name": "train",
|
128 |
+
"num_bytes": 371725,
|
129 |
+
"num_examples": 870,
|
130 |
+
"dataset_name": "ncslgr"
|
131 |
+
}
|
132 |
+
},
|
133 |
+
"download_checksums": {
|
134 |
+
"http://asl.cs.depaul.edu/corpus/elanBUcorpus.zip": {
|
135 |
+
"num_bytes": 5335358,
|
136 |
+
"checksum": "7e2a49cfec0d2d39a933df1c20e1f1f79f30bca70974b1f65ef05a0df99f2949"
|
137 |
+
}
|
138 |
+
},
|
139 |
+
"download_size": 5335358,
|
140 |
+
"post_processing_size": null,
|
141 |
+
"dataset_size": 371725,
|
142 |
+
"size_in_bytes": 5707083
|
143 |
+
}
|
144 |
+
}
|
dummy/annotations/0.7.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a5795ada3b7335036cf7a9650e95f817290a5944fa814ff475466cc6248820c
|
3 |
+
size 29039
|
dummy/entire_dataset/0.7.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a5795ada3b7335036cf7a9650e95f817290a5944fa814ff475466cc6248820c
|
3 |
+
size 29039
|
ncslgr.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
"""NCSLGR: a small American Sign Language corpus annotated with non-manual features"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import os
|
20 |
+
import re
|
21 |
+
from dataclasses import dataclass
|
22 |
+
|
23 |
+
from tqdm import tqdm
|
24 |
+
|
25 |
+
import datasets
|
26 |
+
|
27 |
+
|
28 |
+
_DESCRIPTION = """
|
29 |
+
A small corpus of American Sign Language (ASL) video data from native signers, annotated with non-manual features.
|
30 |
+
"""
|
31 |
+
|
32 |
+
_CITATION = """\
|
33 |
+
@misc{dataset:databases2007volumes,
|
34 |
+
title={Volumes 2--7},
|
35 |
+
author={Databases, NCSLGR},
|
36 |
+
year={2007},
|
37 |
+
publisher={American Sign Language Linguistic Research Project (Distributed on CD-ROM~…}
|
38 |
+
}
|
39 |
+
"""
|
40 |
+
|
41 |
+
_URL_ANNOTATIONS = "http://asl.cs.depaul.edu/corpus/elanBUcorpus.zip"
|
42 |
+
_URL_VIDEOS = "http://asl.cs.depaul.edu/corpus/video.zip"
|
43 |
+
|
44 |
+
_HOMEPAGE = "https://www.bu.edu/asllrp/ncslgr.html"
|
45 |
+
|
46 |
+
|
47 |
+
@dataclass
|
48 |
+
class NCSLGRConfig(datasets.BuilderConfig):
|
49 |
+
"""BuilderConfig for NCSLGR."""
|
50 |
+
|
51 |
+
videos: bool = True
|
52 |
+
|
53 |
+
|
54 |
+
class NCSLGR(datasets.GeneratorBasedBuilder):
|
55 |
+
"""NCSLGR: a small American Sign Language corpus annotated with non-manual features"""
|
56 |
+
|
57 |
+
VERSION = datasets.Version("0.7.0")
|
58 |
+
|
59 |
+
BUILDER_CONFIG_CLASS = NCSLGRConfig
|
60 |
+
|
61 |
+
BUILDER_CONFIGS = [
|
62 |
+
NCSLGRConfig(
|
63 |
+
name="entire_dataset",
|
64 |
+
version=datasets.Version("0.7.0"),
|
65 |
+
description="Entire dataset containing both videos and annotations.",
|
66 |
+
videos=True,
|
67 |
+
),
|
68 |
+
NCSLGRConfig(
|
69 |
+
name="annotations",
|
70 |
+
version=datasets.Version("0.7.0"),
|
71 |
+
description="Dataset including only annotations, without videos",
|
72 |
+
videos=False,
|
73 |
+
),
|
74 |
+
]
|
75 |
+
|
76 |
+
def _info(self):
|
77 |
+
return datasets.DatasetInfo(
|
78 |
+
description=_DESCRIPTION,
|
79 |
+
# This defines the different columns of the dataset and their types
|
80 |
+
features=datasets.Features(
|
81 |
+
{
|
82 |
+
"eaf": datasets.Value("string"), # EAF path
|
83 |
+
"sentences": datasets.features.Sequence(
|
84 |
+
{
|
85 |
+
"gloss": datasets.Value("string"), # ASL Gloss
|
86 |
+
"text": datasets.Value("string"), # English Text
|
87 |
+
}
|
88 |
+
),
|
89 |
+
"videos": datasets.features.Sequence(datasets.Value("string")), # Videos paths
|
90 |
+
}
|
91 |
+
),
|
92 |
+
homepage=_HOMEPAGE,
|
93 |
+
citation=_CITATION,
|
94 |
+
)
|
95 |
+
|
96 |
+
def _split_generators(self, dl_manager):
|
97 |
+
"""Returns SplitGenerators."""
|
98 |
+
|
99 |
+
eaf_path = os.path.join(dl_manager.download_and_extract(_URL_ANNOTATIONS), "elanBUcorpus")
|
100 |
+
videos_path = dl_manager.download_and_extract(_URL_VIDEOS) if self.config.videos else None
|
101 |
+
|
102 |
+
return [
|
103 |
+
datasets.SplitGenerator(
|
104 |
+
name=datasets.Split.TRAIN,
|
105 |
+
gen_kwargs={"eaf_path": eaf_path, "videos_path": videos_path},
|
106 |
+
)
|
107 |
+
]
|
108 |
+
|
109 |
+
def _extract_sentences(self, elan_xml: str):
|
110 |
+
def get_tier_values(name: str):
|
111 |
+
tiers = re.findall('TIER_ID="' + name + '">([\\s\\S]*?)</TIER>', elan_xml)
|
112 |
+
if len(tiers) == 0:
|
113 |
+
return []
|
114 |
+
tier = tiers[0]
|
115 |
+
return [
|
116 |
+
(int(s[2:]), int(e[2:]), t)
|
117 |
+
for s, e, t in re.findall(
|
118 |
+
'TIME_SLOT_REF1="(.*)" TIME_SLOT_REF2="(.*)">\n.*<ANNOTATION_VALUE>(.*?)</ANNOTATION_VALUE>', tier
|
119 |
+
)
|
120 |
+
]
|
121 |
+
|
122 |
+
gloss = get_tier_values("main gloss")
|
123 |
+
texts = get_tier_values("English translation")
|
124 |
+
|
125 |
+
for s, e, text in texts:
|
126 |
+
relevant_gloss = [t for (s2, e2, t) in gloss if s2 >= s and e2 <= e]
|
127 |
+
yield {"gloss": " ".join(relevant_gloss), "text": text}
|
128 |
+
|
129 |
+
def _generate_examples(self, eaf_path: str, videos_path: str):
|
130 |
+
""" Yields examples. """
|
131 |
+
|
132 |
+
for i, eaf_file in enumerate(tqdm(os.listdir(eaf_path))):
|
133 |
+
eaf_file_path = os.path.join(eaf_path, eaf_file)
|
134 |
+
videos = []
|
135 |
+
with open(eaf_file_path, "r", encoding="utf-8") as f:
|
136 |
+
content = f.read()
|
137 |
+
|
138 |
+
if self.config.videos:
|
139 |
+
videos_relative = re.findall('RELATIVE_MEDIA_URL="(.*)"', content)
|
140 |
+
videos = [os.path.join(videos_path, v[3:]) for v in videos_relative]
|
141 |
+
|
142 |
+
sentences = list(self._extract_sentences(content))
|
143 |
+
|
144 |
+
yield i, {"eaf": eaf_file_path, "videos": videos, "sentences": sentences}
|