fix(weibo.py): fix the format of text
Browse files- .gitignore +2 -0
- weibo.py +13 -2
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
download.py
|
2 |
+
save.py
|
weibo.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import datasets
|
2 |
from datasets.download.download_manager import DownloadManager
|
3 |
import pyarrow.parquet as pq
|
|
|
4 |
|
5 |
_DESCRIPTION = """\
|
6 |
The Weibo NER dataset is a Chinese Named Entity Recognition dataset
|
@@ -32,14 +33,14 @@ _URLS = {
|
|
32 |
}
|
33 |
|
34 |
class WeiboNamedEntities(datasets.GeneratorBasedBuilder):
|
35 |
-
VERSION = datasets.Version("1.0.
|
36 |
|
37 |
def _info(self):
|
38 |
return datasets.DatasetInfo(
|
39 |
description=_DESCRIPTION,
|
40 |
features=datasets.Features(
|
41 |
{
|
42 |
-
"text": datasets.Value("string"),
|
43 |
"labels": datasets.Sequence(
|
44 |
datasets.features.ClassLabel(
|
45 |
names=[
|
@@ -111,6 +112,16 @@ class WeiboNamedEntities(datasets.GeneratorBasedBuilder):
|
|
111 |
rows = i.to_pylist()
|
112 |
for row in rows:
|
113 |
_id+=1
|
|
|
|
|
|
|
114 |
yield _id, row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
|
|
|
1 |
import datasets
|
2 |
from datasets.download.download_manager import DownloadManager
|
3 |
import pyarrow.parquet as pq
|
4 |
+
import json
|
5 |
|
6 |
_DESCRIPTION = """\
|
7 |
The Weibo NER dataset is a Chinese Named Entity Recognition dataset
|
|
|
33 |
}
|
34 |
|
35 |
class WeiboNamedEntities(datasets.GeneratorBasedBuilder):
|
36 |
+
VERSION = datasets.Version("1.0.1")
|
37 |
|
38 |
def _info(self):
|
39 |
return datasets.DatasetInfo(
|
40 |
description=_DESCRIPTION,
|
41 |
features=datasets.Features(
|
42 |
{
|
43 |
+
"text": datasets.Sequence(datasets.Value("string")),
|
44 |
"labels": datasets.Sequence(
|
45 |
datasets.features.ClassLabel(
|
46 |
names=[
|
|
|
112 |
rows = i.to_pylist()
|
113 |
for row in rows:
|
114 |
_id+=1
|
115 |
+
# fix string
|
116 |
+
row['text'] = row['text'].replace("'", '"')
|
117 |
+
row['text'] = json.loads(row['text'])
|
118 |
yield _id, row
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
|
127 |
|