ramybaly
commited on
Commit
·
3cb0756
1
Parent(s):
774debe
fixed bug in dataset script
Browse files- prepare_data.py +4 -7
- test.txt +2 -2
- train.txt +2 -2
- validation.txt +2 -2
prepare_data.py
CHANGED
|
@@ -5,7 +5,7 @@ import pickle
|
|
| 5 |
|
| 6 |
def main():
|
| 7 |
id2label = {int(i): tag for i, tag in json.load(open('./id2coarse_tags.json', 'r')).items()}
|
| 8 |
-
|
| 9 |
|
| 10 |
files = glob.glob('./*json')
|
| 11 |
|
|
@@ -24,13 +24,10 @@ def main():
|
|
| 24 |
ner_tags_fine_ids = sentence['fine_tags']
|
| 25 |
|
| 26 |
ner_tags = [id2label[t] for t in ner_tags_ids]
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
for token, tag in zip(tokens, ner_tags):
|
| 33 |
-
f.write(f'{token}\t{tag}\n')
|
| 34 |
|
| 35 |
f.write('\n')
|
| 36 |
|
|
|
|
| 5 |
|
| 6 |
def main():
|
| 7 |
id2label = {int(i): tag for i, tag in json.load(open('./id2coarse_tags.json', 'r')).items()}
|
| 8 |
+
id2label_fine = {int(i): tag for i, tag in json.load(open('./id2fine_tags.json', 'r')).items()}
|
| 9 |
|
| 10 |
files = glob.glob('./*json')
|
| 11 |
|
|
|
|
| 24 |
ner_tags_fine_ids = sentence['fine_tags']
|
| 25 |
|
| 26 |
ner_tags = [id2label[t] for t in ner_tags_ids]
|
| 27 |
+
ner_tags_fine = [id2label_fine[t] for t in ner_tags_fine_ids]
|
| 28 |
|
| 29 |
+
for token, tag, tag_fine in zip(tokens, ner_tags, ner_tags_fine):
|
| 30 |
+
f.write(f'{token}\t{tag}\t{tag_fine}\n')
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
f.write('\n')
|
| 33 |
|
test.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21cf6a9c4fc2e1ac0ba8489c85eaa1d041f8a6361c29e08c49bcd583c511ef2d
|
| 3 |
+
size 12476547
|
train.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fc9919a3888e99e2aac82492d5b68e9558ffb50ad3189937f0498014cf489ff3
|
| 3 |
+
size 43745611
|
validation.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b82191955d865685eb24175af4458008d14b6c6c10a1c98ed417a2334885deea
|
| 3 |
+
size 6269291
|