KoichiYasuoka
commited on
Commit
·
c3338db
1
Parent(s):
177720c
aggregation_strategy
Browse files
ud.py
CHANGED
@@ -25,7 +25,7 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
|
25 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
26 |
v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]
|
27 |
q=[self.model.config.id2label[p[i,j]].split("|") for i,j in enumerate(h)]
|
28 |
-
if "aggregation_strategy" in kwargs and kwargs["aggregation_strategy"]
|
29 |
for i,j in reversed(list(enumerate(q[2:],2))):
|
30 |
if j[-1]=="goeswith":
|
31 |
h=[b if i>b else b-1 for a,b in enumerate(h) if i!=a]
|
|
|
25 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
26 |
v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]
|
27 |
q=[self.model.config.id2label[p[i,j]].split("|") for i,j in enumerate(h)]
|
28 |
+
if "aggregation_strategy" in kwargs and kwargs["aggregation_strategy"]!="none":
|
29 |
for i,j in reversed(list(enumerate(q[2:],2))):
|
30 |
if j[-1]=="goeswith":
|
31 |
h=[b if i>b else b-1 for a,b in enumerate(h) if i!=a]
|