update
Browse files- UTS_WTK_v1.py +17 -4
UTS_WTK_v1.py
CHANGED
@@ -50,7 +50,20 @@ class UTS_WTK_v1(datasets.GeneratorBasedBuilder):
|
|
50 |
with open(filepath, encoding="utf-8") as f:
|
51 |
guid = 0
|
52 |
for line in f:
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
with open(filepath, encoding="utf-8") as f:
|
51 |
guid = 0
|
52 |
for line in f:
|
53 |
+
tokens = []
|
54 |
+
tags = []
|
55 |
+
if line.startswith("-DOCSTART-") or line == "" or line == "\n":
|
56 |
+
if tokens:
|
57 |
+
yield guid, {
|
58 |
+
"id": str(guid),
|
59 |
+
"tokens": tokens,
|
60 |
+
"pos_tags": tags
|
61 |
+
}
|
62 |
+
guid += 1
|
63 |
+
tokens = []
|
64 |
+
tags = []
|
65 |
+
else:
|
66 |
+
# each line is tab separated
|
67 |
+
splits = line.split("\t")
|
68 |
+
tokens.append(splits[0])
|
69 |
+
tags.append(splits[1])
|