KoichiYasuoka
commited on
Commit
·
6da92f1
1
Parent(s):
367a3fd
algorithm improved
Browse files
ud.py
CHANGED
@@ -67,7 +67,9 @@ class UniversalDependenciesCausalPipeline(BellmanFordTokenClassificationPipeline
|
|
67 |
for i,t in reversed(list(enumerate(w))):
|
68 |
p=t.pop("entity")
|
69 |
if p.startswith("I-"):
|
70 |
-
w[i-1]["end"]=w.pop(i)["end"]
|
|
|
|
|
71 |
elif p.startswith("B-"):
|
72 |
t["entity_group"]=p[2:]
|
73 |
else:
|
|
|
67 |
for i,t in reversed(list(enumerate(w))):
|
68 |
p=t.pop("entity")
|
69 |
if p.startswith("I-"):
|
70 |
+
w[i-1]["end"]=max(w.pop(i)["end"],w[i-1]["end"])
|
71 |
+
elif i>0 and w[i-1]["end"]>w[i]["start"]:
|
72 |
+
w[i-1]["end"]=max(w.pop(i)["end"],w[i-1]["end"])
|
73 |
elif p.startswith("B-"):
|
74 |
t["entity_group"]=p[2:]
|
75 |
else:
|